Uploaded image for project: 'Axiom'
  1. Axiom
  2. AXIOM-509

Reading and writing a file with & outputs &

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Blocker
    • Resolution: Fixed
    • 1.3.0
    • 1.4.0
    • Core Model
    • None
    • Important

    Description

      On some documents when an element contains a mixture of elements and 2 or more text nodes and one of those text nodes contains an & then when the document is written out it writes out & instead of &.  This causes the document to be invalid when it is read in the next time because & should be & in XML.  Take this simple case (notice there is a space after the entry element):

      <entry> <ref:pagenum="4469"/> SUBTOTAL SYSTEM DEVELOPMENT & DEMONSTRATION </entry>

      This is valid XML but when it is written back out it is:

      <entry> <ref:pagenum="4469"/> SUBTOTAL SYSTEM DEVELOPMENT & DEMONSTRATION </entry>

      This is not valid XML and will cause the document to fail when it is read in the next time.  I have not found a way to work around this yet.

       

      To read the document in 

       
                  XMLInputFactory xmlFactory = XMLInputFactory.newInstance();
                  xmlFactory.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, false);
                  xmlFactory.setProperty(XMLInputFactory.SUPPORT_DTD, false);
                  xmlFactory.setProperty(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES, false);
                  xmlFactory.setProperty(XMLInputFactory.IS_COALESCING, true);
                  
                  XMLStreamReader xmlStreamReader = xmlFactory.createXMLStreamReader(inputStream, encodingFormat);
                  OMXMLParserWrapper staxOMBuilder = OMXMLBuilderFactory.createStAXOMBuilder(xmlStreamReader);
                  omDocument = staxOMBuilder.getDocument();
       

      Attachments

        Issue Links

          Activity

            People

              veithen Andreas Veithen
              kylabohon Kyla Miller
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: