[
https://issues.apache.org/jira/browse/XERCESJ-1749?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
John Poole updated XERCESJ-1749:
--------------------------------
Description:
Suppose a3.xml:
{noformat}
<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>{noformat}
Xerces 2.12.2 rejects the XML with:
edit: added CLASSPATH recital below to provide context for following session:
{code:java}
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>{code}
was:
Suppose a3.xml:
{noformat}
<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>{noformat}
Xerces 2.12.2 rejects the XML with:
edit: added CLASSPATH recital below to provide context for following session:
{code:java}
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 ${code}
{noformat}
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>{code}
> XInclude parsing fails on legal construct
> -----------------------------------------
>
> Key: XERCESJ-1749
> URL: https://issues.apache.org/jira/browse/XERCESJ-1749
> Project: Xerces2-J
> Issue Type: Bug
> Components: XInclude 1.0
> Affects Versions: 2.12.2
> Environment: jlpoole@ares /usr/local/src/xerces_2.12.2/xerces-2_12_2
> $ java -version
> openjdk version "1.8.0_332"
> OpenJDK Runtime Environment (Temurin)(build 1.8.0_332-b09)
> OpenJDK 64-Bit Server VM (Temurin)(build 25.332-b09, mixed mode)
> jlpoole@ares /usr/local/src/xerces_2.12.2/xerces-2_12_2 $
> I downloaded Xerces-J-src.2.12.2.tar.gz and Xerces-J-tools.2.12.2.tar.gz and
> built same, then tested with the example file above.
> Attaching examples_log.txt, dated Wednesday Aug 17, 2022 11:35:34 AM, of
> runs for both files also showing xmllint output successfully resolving the
> XIncludes.
> Reporter: John Poole
> Priority: Critical
> Labels: XInclude
> Attachments: examples_log.txt
>
>
> Suppose a3.xml:
> {noformat}
> <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>{noformat}
> Xerces 2.12.2 rejects the XML with:
> edit: added CLASSPATH recital below to provide context for following session:
> {code:java}
> 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>{code}
>
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]