You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jaxme-dev@ws.apache.org by ja...@ws.apache.org on 2004/10/18 05:38:51 UTC

[jira] Updated: (JAXME-41) JAXBSource serializes XML and forces it to be reparsed.

The following issue has been updated:

    Updater: Richard Zschech (mailto:richard.zschech@cqrdata.com)
       Date: Sun, 17 Oct 2004 8:38 PM
    Comment:
Heres my implementation.

I agree that the JAXB 2.0 javadocs statement about extending SAXSource being implementation detail implies that my solution is the intended one.

Thanks for the speedyness of your responses.
    Changes:
             Attachment changed to JAXBSource.java
    ---------------------------------------------------------------------
For a full history of the issue, see:

  http://issues.apache.org/jira/browse/JAXME-41?page=history

---------------------------------------------------------------------
View the issue:
  http://issues.apache.org/jira/browse/JAXME-41

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: JAXME-41
    Summary: JAXBSource serializes XML and forces it to be reparsed.
       Type: Improvement

     Status: Unassigned
   Priority: Major

    Project: JaxMe
 Components: 
             JAXB API
   Versions:
             current (nightly)

   Assignee: 
   Reporter: Richard Zschech

    Created: Fri, 15 Oct 2004 1:33 AM
    Updated: Sun, 17 Oct 2004 8:38 PM

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.


---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: jaxme-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: jaxme-dev-help@ws.apache.org