[xml] xinclude on same resource - xpointer="element(c2/1)" fails



Hi,

 I'm using xinclude with xpointer element()-scheme to include an existing element of the same resource at a 
different location. The following bar.xml gives an example. In cruft-element with ID "c4" I'm including 
<fnac>a</fnac>. In cruft-element with ID "c5" I'm trying to include <fnac>b</fnac>. In cruft-element "c6" I'm 
trying to include <fnac>c</fnac> and added therefore a href="bar.xml" to avoid any "Resource Error". I'm 
doing all this with IDs defined in bar.xsd. Here comes the complete example:

<bar xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns:xi="http://www.w3.org/2001/XInclude";
xsi:noNamespaceSchemaLocation="bar.xsd">
<fnorb id="snip">
<cruft id="c1"><fnac>a</fnac></cruft>
<cruft id="c2"><fnac>b</fnac></cruft>
<cruft id="c3"><fnac>c</fnac></cruft>
<cruft id="c4"><xi:include xpointer="element(/1/1/1/1)"/></cruft>
<cruft id="c5"><xi:include xpointer="element(c2/1)"/></cruft>
<cruft id="c6"><xi:include href="bar.xml" xpointer="element(c3/1)"/></cruft>
</fnorb>
</bar>

While this first works fine with xmllint --xinclude bar.xml, the later two fail:

bar.xml:10: element include: XInclude error : detected a recursion in bar.xml
bar.xml:9: element include: XInclude error : XPointer evaluation failed: #elemen
t(c2/1)
bar.xml:9: element include: XInclude error : could not load bar.xml, and no fall
back was found
<?xml version="1.0" encoding="UTF-8"?>
<bar xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xmlns:xi="http://www.
w3.org/2001/XInclude" xsi:noNamespaceSchemaLocation="bar.xsd">
        <fnorb id="snip">
                <cruft id="c1"><fnac>a</fnac></cruft>
                <cruft id="c2"><fnac>b</fnac></cruft>
                <cruft id="c3"><fnac>c</fnac></cruft>
                <cruft id="c4"><fnac>a</fnac></cruft>
                <cruft id="c5"><xi:include xpointer="element(c2/1)"/></cruft>
                <cruft id="c6"><xi:include href="bar.xml" xpointer="element(c2/1
)"/></cruft>
        </fnorb>
</bar>

Reading the recommendation at http://www.w3.org/TR/2006/REC-xinclude-20061115/#loops it says: " In other 
words, the following are all legal: [...]An xi:include element may identify a different part of the same 
local resource (same href, different xpointer)." This is what the first xi:include does successfully. I'm 
wondering why the other both don't work. Has anybody an idea?

To make the example complete, I append here the bar.xsd:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";>
        <xs:import namespace="http://www.w3.org/XML/1998/namespace"/>
        <xs:element name="fnorb">
                <xs:complexType>
                        <xs:sequence>
                                <xs:element ref="cruft" maxOccurs="unbounded"/>
                        </xs:sequence>
                        <xs:attribute name="id" type="xs:ID" use="required"/>
                </xs:complexType>
        </xs:element>
        <xs:element name="cruft">
                <xs:complexType>
                        <xs:sequence>
                                <xs:element ref="fnac" maxOccurs="unbounded"/>
                        </xs:sequence>
                        <xs:attribute name="id" type="xs:ID" use="required"/>
                </xs:complexType>
        </xs:element>
        <xs:element name="fnac">
                <xs:complexType>
                        <xs:simpleContent>
                                <xs:extension base="xs:string"/>
                        </xs:simpleContent>
                </xs:complexType>
        </xs:element>
        <xs:element name="bar">
                <xs:complexType>
                        <xs:sequence>
                                <xs:element ref="fnorb"/>
                        </xs:sequence>
                </xs:complexType>
        </xs:element>
</xs:schema>

Kind regards,
Sabine


Immer auf dem Laufenden! Sport, Auto, Reise, Politik und Promis. Von uns für Sie: der neue 
Arcor.de-Newsletter!
Jetzt anmelden und einfach alles wissen: http://www.arcor.de/rd/footer.newsletter



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]