2009/11/19

Devoxx 2009: Using XML with Java: Sploit for Choice?

19/11/2009, Michael Kay, Saxonica

Xml interfaces in java, from low level to high level
  • SAX/Stax
    • high performance: +/- 40 MB/sec
    • low-level
    • SAX/Stax: comparable performance
    • use pipelines:
      • SAX: push
        • best for multiple output
      • Stax: pull:
        • best for multiple input
  • DOM: tree based
    • don't use plain DOM, prefer JDOM, DOM4J or XOM – I once experienced problems with the XOM-handling of unicode characters
    • uses a lot of memory: +/- 5 times the document size
    • complex, tedious usage
  • databinding: compile to / (un)marshall from java objects
    • like JAXB
    • fits for simple xml
    • not for complex xml or document xmls → create too much java classes
    • give 2 views on the same: xml <> java objects
  • language support:
    • doesn't exist in Java...
    • scala: XQuery-like capabilities
  • XSLT/XQuery
    • should be your default choice
    • good performance: +/- 10MB/sec
    • XSLT:
      • more for documents
      • transformations
      • richer functionality
    • XQuery:
      • more for data
      • xml-database
      • easier to optimize
Architectures
  • prefer xml pipelines: (xproc pipelines)xml database → xquery → xslt → rest → xforms
  • don't mix data: objects & xml

No comments: