Recursive XInclusion with XPointer fragment selection
Posted: Mon Jan 23, 2006 11:29 am
Hello!
I have three XML files: "a.xml", "b.xml" and "c.xml". Full XML files are at the end of this message.
1) "c.xml" is simple XML file.
2) "b.xml" does simple XInclusion of "c.xml" as '<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="c.xml" parse="xml" />'.
3) "a.xml" does XInclusion of "b.xml" using XPointer as '<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="b.xml" xpointer="element(/1/1)" parse="xml" />'.
I want to have "a.xml", which contains part of "b.xml" and whole "c.xml". I am not able to do this. I receive "a.xml" containing part of "b.xml" with just reference to "c.xml" (there is not done XInclusion of "c.xml") – unparsed "b.xml". I can receive "a.xml" with (whole) "b.xml" and "c.xml", but only if I do not use XPointer. What am I doing wrong? I am using JAXP in Java 1.5.0_xx. Can You help me?
Also I did not find how to see result of XInclusion (of e.g. above "a.xml") in oXygen 7.0. Some kind of "Preview". Has oXygen such feature?
Thank You for answers. Stepan
"c.xml":
<?xml version="1.0" encoding="UTF-8"?>
<c xmlns:xi="http://www.w3.org/2001/XInclude">
<element>
<text>ccc</text>
</element>
</c>
"b.xml":
<?xml version="1.0" encoding="UTF-8"?>
<b xmlns:xi="http://www.w3.org/2001/XInclude">
<element>
<text>bbb</text>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="c.xml" parse="xml"/>
</element>
</b>
"a.xml":
<?xml version="1.0" encoding="UTF-8"?>
<a xmlns:xi="http://www.w3.org/2001/XInclude">
<element>
<text>aaa</text>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="b.xml" xpointer="element(/1/1)" parse="xml" />
</element>
</a>
part of my simple Java 1.5.0_xx code:
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
documentBuilderFactory.setNamespaceAware(true);
documentBuilderFactory.setXIncludeAware(true);
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
Document document = documentBuilder.parse(new File("a.xml"));
I have three XML files: "a.xml", "b.xml" and "c.xml". Full XML files are at the end of this message.
1) "c.xml" is simple XML file.
2) "b.xml" does simple XInclusion of "c.xml" as '<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="c.xml" parse="xml" />'.
3) "a.xml" does XInclusion of "b.xml" using XPointer as '<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="b.xml" xpointer="element(/1/1)" parse="xml" />'.
I want to have "a.xml", which contains part of "b.xml" and whole "c.xml". I am not able to do this. I receive "a.xml" containing part of "b.xml" with just reference to "c.xml" (there is not done XInclusion of "c.xml") – unparsed "b.xml". I can receive "a.xml" with (whole) "b.xml" and "c.xml", but only if I do not use XPointer. What am I doing wrong? I am using JAXP in Java 1.5.0_xx. Can You help me?
Also I did not find how to see result of XInclusion (of e.g. above "a.xml") in oXygen 7.0. Some kind of "Preview". Has oXygen such feature?
Thank You for answers. Stepan
"c.xml":
<?xml version="1.0" encoding="UTF-8"?>
<c xmlns:xi="http://www.w3.org/2001/XInclude">
<element>
<text>ccc</text>
</element>
</c>
"b.xml":
<?xml version="1.0" encoding="UTF-8"?>
<b xmlns:xi="http://www.w3.org/2001/XInclude">
<element>
<text>bbb</text>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="c.xml" parse="xml"/>
</element>
</b>
"a.xml":
<?xml version="1.0" encoding="UTF-8"?>
<a xmlns:xi="http://www.w3.org/2001/XInclude">
<element>
<text>aaa</text>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="b.xml" xpointer="element(/1/1)" parse="xml" />
</element>
</a>
part of my simple Java 1.5.0_xx code:
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
documentBuilderFactory.setNamespaceAware(true);
documentBuilderFactory.setXIncludeAware(true);
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
Document document = documentBuilder.parse(new File("a.xml"));