How does Scala XML support work?

scala, xml

Solution

Large documents (several hundred of MB) can be processed with `scala.xml.pull.XMLEventReader`. See nightly scaladoc (assuming you'll be using 2.8). This is using a pull parser model like StAX.

In general compared to Java, Scala is doing its own thing when dealing with XML. The XML is immutable. Also you can use XML literals directly in your Scala code which tends to make the code more readable.

In response to the comment, `XML.load` uses javax.xml.parsers.{ SAXParser, SAXParserFactory } as underlying technology. I also assume that the resulting xml is loaded in memory.

Problem

I'm sure it should be obvious, but I could find any references on my question. What underlying technology does Scala XML uses? Is it something DOM-like or SAX-like or StAX like? What performance penalties should I be aware of when processing large documents? Is StAX still more efficient? Thanks in advance.

Original source