hunterhacker/jdom — pull request #105 by gburgett (2013-01-02 07:19:24+00:00)
Title: Created SAX reader and writer to read/write directly from JDOM Documents...

Hi,

I've been working for fun on an embedded XML database using JDOM 2.x. I found that I needed to use JAXB to serialize a Pojo directly to an `Element`. Unfortunately there was no direct way to do this, so I created a SAX Reader and a SAX Writer to read and write directly to JDOM `Document` objects in memory. Using this I was able to marshal and unmarshal to JDOM documents very easily:

```java
JAXBContext context = JAXBContext.newInstance(Baz.class);

Baz baz;
JDOMStreamReader instance = new JDOMStreamReader(doc);
try{
baz = (Baz)context.createUnmarshaller().unmarshal(instance);
}
finally{
instance.close();
}
```

I think this would be valuable to include in the JDOM API. This would provide more options to convert to and from JDOM documents.

Also, if you'd like to check out my embedded XML db, take a look at it here https://github.com/gburgett/XFlat