elena 2003/02/10 11:12:33 Modified: java/tests/dom/serialize TestNS.java expectedoutput.xml Log: Add tests (to check that serializer won't output multiple namespace declarations) and modify the output accordingly. See bug: http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16612 Revision Changes Path 1.9 +21 -1 xml-xerces/java/tests/dom/serialize/TestNS.java Index: TestNS.java =================================================================== RCS file: /home/cvs/xml-xerces/java/tests/dom/serialize/TestNS.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- TestNS.java 15 Aug 2002 21:12:30 -0000 1.8 +++ TestNS.java 10 Feb 2003 19:12:33 -0000 1.9 @@ -200,6 +200,16 @@ System.out.println("Modifying information for the element: "+element.getNodeName()); } + + element.appendChild(core.createComment("attributes: make sure that NS* prefix is created")); + element.appendChild(core.createTextNode("\n")); + Element e1 = core.createElementNS(null, "root"); + element.appendChild(e1); + e1.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:xx", "foo"); + e1.setAttributeNS("http://rsa2", "xx:attr", "value"); + element.appendChild(e1); + element.appendChild(core.createTextNode("\n\n")); + // add element in same scope element.appendChild(core.createComment("add element in the same scope")); @@ -226,6 +236,16 @@ element.appendChild(core.createElementNS(null,"child4")); element.appendChild(core.createTextNode("\n\n")); + element.appendChild(core.createComment("make sure only one 'xmlns:m1'declaration appears not several")); + element.appendChild(core.createTextNode("\n")); + e1 = core.createElementNS("http://rsa", "m1:root"); + element.appendChild(e1); + Element e2 = core.createElementNS("http://rsa", "m1:e1"); + e2.setAttributeNS("http://rsa", "m1:a1", "v"); + e2.setAttributeNS("http://rsa2", "m2:a2", "v"); + e1.appendChild(e2); + element.appendChild(core.createTextNode("\n\n")); + Text text; // add xmlns attribute 1.7 +8 -2 xml-xerces/java/tests/dom/serialize/expectedoutput.xml Index: expectedoutput.xml =================================================================== RCS file: /home/cvs/xml-xerces/java/tests/dom/serialize/expectedoutput.xml,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- expectedoutput.xml 15 Aug 2002 21:12:29 -0000 1.6 +++ expectedoutput.xml 10 Feb 2003 19:12:33 -0000 1.7 @@ -6,7 +6,7 @@ <!-- xmlns is removed during the modifications --> <empty xmlns=""> - <elem xmlns=""/> + <elem/> <elem xmlns="newURI"><a/></elem> </empty> @@ -22,6 +22,9 @@ <good a="1" n1:a="2" xmlns:n1="http://www.w3.org"/> </x> +<!--attributes: make sure that NS* prefix is created--> +<root xmlns="" xmlns:xx="foo" xmlns:NS1="http://rsa2" NS1:attr="value"/> + <!--add element in the same scope--> <s:child1/> @@ -34,6 +37,9 @@ <!--add element no prefix no namespace--> <child4 xmlns=""/> +<!--make sure only one 'xmlns:m1'declaration appears not several--> +<m1:root xmlns:m1="http://rsa"><m1:e1 m1:a1="v" xmlns:m2="http://rsa2" m2:a2="v"/></m1:root> + <!--create element: prefix bound to http://child7, local declaration of xmlns:prefix = http://child8--> <prefix:child7 xmlns:prefix="http://child7"/> @@ -53,7 +59,7 @@ <!-- 1) attr_B with no prefix and http://attr_B 2) attr_A had no prefix and http://attr_A. There is local default decl bound to the same namespace--> -<s:testAttributes2 xmlns:NS2="http://attr_A" NS2:attr_A="" xmlns:NS3="http://attr_B" NS3:attr_B="" xmlns="http://attr_A"/> +<s:testAttributes2 xmlns:NS1="http://attr_A" NS1:attr_A="" xmlns:NS2="http://attr_B" NS2:attr_B="" xmlns="http://attr_A"/> </s:Body> </s:Envelope>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]