Uploaded image for project: 'JaxMe'
  1. JaxMe
  2. JAXME-41

JAXBSource serializes XML and forces it to be reparsed.

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • current (nightly)
    • None
    • JAXB API
    • 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.

      Attachments

        1. JAXBSource.java
          6 kB
          Richard Zschech

        Activity

          People

            Unassigned Unassigned
            rzschech Richard Zschech
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: