Hi,
 
I am trying to use JAXB in our project in a way such that the xml document is not loaded completely in memory while unmarshalling. I use the SAXReader and created a pruning ElementHandler which unmarshalls the org.dom4j.Element in the onEnd method whenever the specified ElementPath is encountered.
 
Works great, but now I need to replace a small part of this xml file (unmarshall an element tree, change the unmarshalled object and marshall it back to the document), also without having the complete document in memory.
 
I could also use an ElementHandler, which replaces the Element that needs to be modified, but how can I write the correct structure back to the xml file?
I know the XMLWriter is able to handle SAX events which are generated by the SAXReader, but something needs to filter these events whenever the ElementHandler has to perform the replacement ((un)marshalling) first.
 
Please advise.
Wonne
 
PS: I already tried to implement an extension of the SAXContentHandler, but that requires the ElementStack to be public and I'd need an additional method in it...
 

Reply via email to