Uploaded image for project: 'Xerces2-J'
  1. Xerces2-J
  2. XERCESJ-1749

XInclude parsing fails on legal construct

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Critical
    • Resolution: Unresolved
    • 2.12.2
    • None
    • XInclude 1.0
    • Important

    Description

      Suppose a3.xml:

      <book xmlns="http://docbook.org/ns/docbook"
          xmlns:xlink="http://www.w3.org/1999/xlink"
          xmlns:xi="http://www.w3.org/2001/XInclude"
          xml:id="a-book"
          version="5.0">
          <title>A</title>
          <chapter xml:id="a-chapter">
              <title>a chapter</title>
              <BurstingPara xml:id="t1000">Warning: Read following paragraph carefully.</BurstingPara>
              <para>foo</para>
              <xi:include href="a3.xml" xpointer="t1000"/>
              <para>foo2</para>
              <xi:include href="a3.xml" xpointer="t1000"/>
              <para>foo3</para>
          </chapter>
         <xi:include href="a3.xml" xpointer="a-chapter"/>
      </book>

      Xerces 2.12.2 rejects the XML with:

      edit: added CLASSPATH recital below to provide context for following session:

      jlpoole@ares /usr/local/src/xerces_2.12.2/xerces-2_12_2 $ date;echo $CLASSPATH
      Wed Aug 17 12:19:41 PDT 2022
      .:build/xercesSamples.jar:build/xercesImpl.jar:build/serializer.jar:build/resolver.jar
      jlpoole@ares /usr/local/src/xerces_2.12.2/xerces-2_12_2 $
      
      jlpoole@ares /usr/local/src/xerces_2.12.2/xerces-2_12_2 $ java dom.Writer -xi a3.xml
      [Fatal Error] a3.xml:1:1: Recursive include detected.  Document 'file:///usr/local/src/xerces_2.12.2/xerces-2_12_2/a3.xml' was already processed.
      [Fatal Error] a3.xml:11:53: Error attempting to parse XML file (href='a3.xml').
      jlpoole@ares /usr/local/src/xerces_2.12.2/xerces-2_12_2 $ {noformat}
      The XML XIncludes above are a legal construct, yet Xerces throws an error when the parser should process the XIncludes.
      
      This bug mimics the bug encountered in the Gnome XMLParser2 project:[ xmllint handling of recursion|[https://gitlab.gnome.org/GNOME/libxml2/-/issues/348]]
      
      Here is another sample file illustrating the failure:
      {code:java}
      <book xmlns="http://docbook.org/ns/docbook"
          xmlns:xlink="http://www.w3.org/1999/xlink"
          xmlns:xi="http://www.w3.org/2001/XInclude"
          xml:id="b-book"
          version="5.0">
          <title>B</title>
          <chapter xml:id="b-chapter">
              <title>b chapter</title>
              <para>foo</para>
          </chapter>
          <xi:include href="a3.xml" xpointer="a-chapter"/>
      </book>

       

       

      Attachments

        1. examples_log.txt
          5 kB
          John Poole

        Activity

          People

            Unassigned Unassigned
            JohnLPoole John Poole
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: