Saxparserfactory setvalidating true

DOM also allows you to write to the document with Xslt transformations.

Example: SAX Parser: Solely to read a XML document.

This allows us to serialize java objects from a document.

You read the document with a class that implements a interface to bind.

You use annotations to specify which classes should be elements (@Xml Root Element) and which fields are elements(@Xml Element) or attributes (@Xml Attribute, what a surprise!

) Examples shamelessly copied from some old lecture slides ;-) Edit: About "which API shoild I use? Well it depends - not all APIs have the same capabilities as you see, but if you have control over the classes you use to map the XML document JAXB is my personal favorite, really elegant and simple solution (though I haven't used it for really large documents, it could get a bit complex).

Unmarshaller (you get a class for this from Instance).

We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion.

I'm searching the java library for parsing XML (complex configuration and data files), I googled a bit but couldn't found other than dom4j (Seems like they are working on V2)..

I have taken look at commons configuration but didn't liked it, Other apache projects on XML seems under hibernation.

The W3C Document hierarchy is verbose and hard to use, so both DOM4J and JDOM try to make it easier.

I like Elliott Rusty Harold, so I tend to reach for JDOM first.

Leave a Reply