Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
current (nightly)
-
None
-
None
Description
The implementation of JAXBSource serializes the XML into a string which will then need to be reparsed to be usefull.
Ive come up with a better way of doing this before I even discovered the JAXBSource class.
Basically you implement an XMLReader which calls the Marshaller when its parse method is called as follows:
private class JAXBSourceXMLReader implements XMLReader {
private ContentHandler contentHandler;
private Marshaller marshaller;
private Object contentObject;
public void parse(String systemId) throws IOException,SAXException
{ parse(); }public void parse(InputSource input) throws IOException,SAXException
{ parse(); }
private void parse() throws IOException, SAXException
{ marshaller.marshal(contentObject, getContentHandler()); }public void setContentHandler(ContentHandler handler)
{ this.contentHandler = handler; }public ContentHandler getContentHandler()
{ return contentHandler; } ...........
}
This removes the requirement of serializing and reparsing the xml.
Its just a suggestion but it works much faster.
From Richard.