123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249 |
- <?xml version="1.0"?>
- <tests>
- <test name="adopt_recon_default">
-
- <doc name="doc1"><![CDATA[<p1 xmlns="urn:test:AAA"><a/></p1>]]></doc>
- <doc name="doc2"><![CDATA[<p1 xmlns="urn:test:BBB"><b/></p1>]]></doc>
- <doc name="doc3"><![CDATA[<p2 xmlns="urn:test:ZZZ"/>]]></doc>
- <var name="a">
- <xpath doc="doc1" select-node="/a:p1/a:a">
- <reg-ns prefix="a" ns="urn:test:AAA"/>
- </xpath>
- </var>
- <var name="b" >
- <xpath doc="doc2" select-node="/b:p1/b:b">
- <reg-ns prefix="b" ns="urn:test:BBB"/>
- </xpath>
- </var>
- <var name="p2">
- <xpath doc="doc3" select-node="/z:p2">
- <reg-ns prefix="z" ns="urn:test:ZZZ"/>
- </xpath>
- </var>
- <remove node="a"/>
- <adopt dest-doc="doc3" node="a"/>
- <append-child parent="p2" child="a"/>
- <!-- This time without a previous removing. -->
- <adopt dest-doc="doc3" node="b"/>
- <append-child parent="p2" child="b"/>
- <reconcile-ns node="p2"/>
- <expected doc="doc3"><![CDATA[<p2 xmlns="urn:test:ZZZ"><a xmlns="urn:test:AAA"/><b xmlns="urn:test:BBB"/></p2>]]></expected>
- </test>
- <test name="adopt_recon">
- <doc name="doc1"><![CDATA[<a:p1 xmlns:a="urn:test:AAA"><a:a/></a:p1>]]></doc>
- <doc name="doc2"><![CDATA[<a:p2 xmlns:a="urn:test:AAA"/>]]></doc>
- <var name="a">
- <xpath doc="doc1" select-node="/a:p1/a:a">
- <reg-ns prefix="a" ns="urn:test:AAA"/>
- </xpath>
- </var>
- <var name="p2">
- <xpath doc="doc2" select-node="/a:p2">
- <reg-ns prefix="a" ns="urn:test:AAA"/>
- </xpath>
- </var>
- <adopt dest-doc="doc2" node="a"/>
- <append-child parent="p2" child="a"/>
- <reconcile-ns node="a"/>
- <expected doc="doc2"><![CDATA[<a:p2 xmlns:a="urn:test:AAA"><a:a/></a:p2>]]></expected>
- </test>
- <test name="adopt_recon_attr">
- <doc name="doc1"><![CDATA[<p1 xmlns:b="urn:test:BBB" b:attr="marvin"/>]]></doc>
- <doc name="doc2"><![CDATA[<a:p2 xmlns:a="urn:test:AAA"/>]]></doc>
- <var name="attr">
- <xpath doc="doc1" select-node="/p1/@b:attr">
- <reg-ns prefix="b" ns="urn:test:BBB"/>
- </xpath>
- </var>
- <var name="p2">
- <xpath doc="doc2" select-node="/a:p2">
- <reg-ns prefix="a" ns="urn:test:AAA"/>
- </xpath>
- </var>
- <adopt dest-doc="doc2" node="attr" />
- <append-child parent="p2" child="attr"/>
- <reconcile-ns node="p2"/>
- <expected doc="doc2"><![CDATA[<a:p2 xmlns:a="urn:test:AAA" xmlns:b="urn:test:BBB" b:attr="marvin"/>]]></expected>
- </test>
- <test name="adopt_recon_attr_2">
- <!-- Here we will specify a destination-parent for adoption. -->
- <doc name="doc1"><![CDATA[<p1 xmlns:b="urn:test:BBB" b:attr="marvin"/>]]></doc>
- <doc name="doc2"><![CDATA[<a:p2 xmlns:a="urn:test:AAA"/>]]></doc>
- <var name="attr">
- <xpath doc="doc1" select-node="/p1/@b:attr">
- <reg-ns prefix="b" ns="urn:test:BBB"/>
- </xpath>
- </var>
- <var name="p2">
- <xpath doc="doc2" select-node="/a:p2">
- <reg-ns prefix="a" ns="urn:test:AAA"/>
- </xpath>
- </var>
- <adopt dest-doc="doc2" dest-parent="p2" node="attr" />
- <append-child parent="p2" child="attr"/>
- <reconcile-ns node="p2"/>
- <expected doc="doc2"><![CDATA[<a:p2 xmlns:a="urn:test:AAA" xmlns:b="urn:test:BBB" b:attr="marvin"/>]]></expected>
- </test>
- <test name="adopt_recon_attr_3">
- <!-- Conflicting ns-prefixes for the added attribute. -->
- <doc name="doc1"><![CDATA[<p1 xmlns:a="urn:test:AAA" a:attr="marvin"/>]]></doc>
- <doc name="doc2"><![CDATA[<a:p2 xmlns:a="urn:test:aaa"/>]]></doc>
- <var name="attr">
- <xpath doc="doc1" select-node="/p1/@a:attr">
- <reg-ns prefix="a" ns="urn:test:AAA"/>
- </xpath>
- </var>
- <var name="p2">
- <xpath doc="doc2" select-node="/a:p2">
- <reg-ns prefix="a" ns="urn:test:aaa"/>
- </xpath>
- </var>
- <adopt dest-doc="doc2" node="attr" />
- <append-child parent="p2" child="attr"/>
- <reconcile-ns node="p2"/>
- <expected doc="doc2"><![CDATA[<a:p2 xmlns:a="urn:test:aaa" xmlns:a1="urn:test:AAA" a1:attr="marvin"/>]]></expected>
- </test>
- <test name="adopt_recon_attr_4">
- <!-- Qualified attribute added to default namespaced elem. -->
- <doc name="doc1"><![CDATA[<p1 xmlns:a="urn:test:AAA" a:attr="marvin"/>]]></doc>
- <doc name="doc2"><![CDATA[<p2 xmlns="urn:test:AAA"/>]]></doc>
- <var name="attr">
- <xpath doc="doc1" select-node="/p1/@a:attr">
- <reg-ns prefix="a" ns="urn:test:AAA"/>
- </xpath>
- </var>
- <var name="p2">
- <xpath doc="doc2" select-node="/a:p2">
- <reg-ns prefix="a" ns="urn:test:AAA"/>
- </xpath>
- </var>
- <adopt dest-doc="doc2" node="attr" />
- <append-child parent="p2" child="attr"/>
- <reconcile-ns node="p2"/>
- <expected doc="doc2"><![CDATA[<p2 xmlns="urn:test:AAA" xmlns:a="urn:test:AAA" a:attr="marvin"/>]]></expected>
- </test>
- <test name="adopt_recon_attr_5">
- <!-- Shadowed and conflicting prefix. dest-parent IS given. -->
- <doc name="doc1"><![CDATA[<p1 xmlns:a="urn:test:AAA" a:attr="marvin"/>]]></doc>
- <doc name="doc2"><![CDATA[<p2 xmlns:a="urn:test:AAA"><a:p3 xmlns:a="urn:test:ZZZ"/></p2>]]></doc>
- <var name="attr">
- <xpath doc="doc1" select-node="/p1/@a:attr">
- <reg-ns prefix="a" ns="urn:test:AAA"/>
- </xpath>
- </var>
- <var name="p3">
- <xpath doc="doc2" select-node="/p2/a:p3">
- <reg-ns prefix="a" ns="urn:test:ZZZ"/>
- </xpath>
- </var>
- <adopt dest-doc="doc2" node="attr" dest-parent="p3"/>
- <append-child parent="p3" child="attr"/>
- <!-- Note that we don't need to reconcile here, since done during
- adoption. -->
- <expected doc="doc2"><![CDATA[
- <p2 xmlns:a="urn:test:AAA">
- <a:p3 xmlns:a="urn:test:ZZZ" xmlns:a1="urn:test:AAA" a1:attr="marvin"/>
- </p2>]]></expected>
- </test>
- <test name="adopt_recon_attr_6">
- <!-- Shadowed and conflicting prefix. dest-parent NOT given. -->
- <doc name="doc1"><![CDATA[<p1 xmlns:a="urn:test:AAA" a:attr="marvin"/>]]></doc>
- <doc name="doc2"><![CDATA[<p2 xmlns:a="urn:test:AAA"><a:p3 xmlns:a="urn:test:ZZZ"/></p2>]]></doc>
- <var name="attr">
- <xpath doc="doc1" select-node="/p1/@a:attr">
- <reg-ns prefix="a" ns="urn:test:AAA"/>
- </xpath>
- </var>
- <var name="p3">
- <xpath doc="doc2" select-node="/p2/a:p3">
- <reg-ns prefix="a" ns="urn:test:ZZZ"/>
- </xpath>
- </var>
- <adopt dest-doc="doc2" node="attr"/>
- <append-child parent="p3" child="attr"/>
- <reconcile-ns node="p3"/>
- <expected doc="doc2"><![CDATA[
- <p2 xmlns:a="urn:test:AAA">
- <a:p3 xmlns:a="urn:test:ZZZ" xmlns:a1="urn:test:AAA" a1:attr="marvin"/>
- </p2>]]></expected>
- </test>
-
- <test name="shadow_1">
-
- <doc name="doc"><![CDATA[
- <foo xmlns:foo="urn:test:mine">
- <p xmlns:bar="urn:test:mine"/>
- <a1>
- <a2 xmlns:bar="urn:test:OTHER">
- <foo:a3/>
- </a2>
- </a1>
- </foo>
- ]]></doc>
- <var name="a1">
- <xpath doc="doc" select-node="/foo/a1"/>
- </var>
- <var name="p" >
- <xpath doc="doc" select-node="/foo/p"/>
- </var>
- <remove node="a1"/>
- <append-child parent="p" child="a1"/>
- <reconcile-ns node="a1"/>
- <expected doc="doc"><![CDATA[
- <foo xmlns:foo="urn:test:mine">
- <p xmlns:bar="urn:test:mine">
- <a1>
- <a2 xmlns:bar="urn:test:OTHER">
- <foo:a3/>
- </a2>
- </a1>
- </p>
- </foo>
- ]]></expected>
- </test>
- <test name="norm_1">
-
- <doc name="doc"><![CDATA[
- <foo>
- <p1 xmlns:a="urn:test:A" xmlns:b="urn:test:B" xmlns:c="urn:test:C">
- <a:a>
- <b:b a:attr="dont" c:attr="panic"/>
- </a:a>
- </p1>
- <p2/>
- </foo>
- ]]></doc>
- <var name="a">
- <xpath doc="doc" select-node="/foo/p1/a:a">
- <reg-ns prefix="a" ns="urn:test:A"/>
- </xpath>
- </var>
- <var name="p2" >
- <xpath doc="doc" select-node="/foo/p2"/>
- </var>
- <remove node="a"/>
- <append-child parent="p2" child="a"/>
- <reconcile-ns node="a"/>
- <expected doc="doc"><![CDATA[
- <foo>
- <p1 xmlns:a="urn:test:A" xmlns:b="urn:test:B" xmlns:c="urn:test:C"/>
- <p2>
- <a:a xmlns:a="urn:test:A">
- <b:b xmlns:b="urn:test:B" xmlns:c="urn:test:C" a:attr="dont" c:attr="panic"/>
- </a:a>
- </p2>
- </foo>
- ]]></expected>
- </test>
- </tests>
|