Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6311488

XML: CDATA sections are parsed incorrectly

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 6
    • jaxp_1.4
    • xml

      When loading an XML file containing the fragment

        <brackets><![CDATA[{}()[]]]></brackets>


      get the error shown below. it worked right under b40. It looks like the parser is treating the first instance of "]]" as the end of the CDATA section, then getting out of sync because the next character isn't ">". tested this by changing the third bracket to something else, like so:

        <brackets><![CDATA[{}()[]]*></brackets>

      and got the exact same error.

      Here's the relevant portion of the stack trace:

      org.xml.sax.SAXParseException: The element type "brackets" must be terminated by the matching end-tag "</brackets>".
      at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException( ErrorHandlerWrapper.java:236)
      at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError( ErrorHandlerWrapper.java:215)
      at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError( XMLErrorReporter.java:388)
      at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError( XMLScanner.java:1419)
      at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement( XMLDocumentFragmentScannerImpl.java:1763)
      at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next( XMLDocumentFragmentScannerImpl.java:2944)
      at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next( XMLDocumentScannerImpl.java:664)
      at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next( XMLNSDocumentScannerImpl.java:158)
      at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument( XMLDocumentFragmentScannerImpl.java:524)
      at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse( XML11Configuration.java:844)
      at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse( XML11Configuration.java:774)
      at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse( XMLParser.java:148)
      at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse( AbstractSAXParser.java:1255)

            sreddysunw Sunitha Reddy (Inactive)
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: