Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/prefix02.java URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/prefix02.java?rev=1896456&view=auto ============================================================================== --- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/prefix02.java (added) +++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/prefix02.java Mon Dec 27 20:28:38 2021 @@ -0,0 +1,73 @@ +/* +This Java source file was generated by test-to-java.xsl +and is a derived work from the source document. +The source document contained the following notice: + + + +Copyright (c) 2001 World Wide Web Consortium, +(Massachusetts Institute of Technology, Institut National de +Recherche en Informatique et en Automatique, Keio University). All +Rights Reserved. This program is distributed under the W3C's Software +Intellectual Property License. This program is distributed in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. + +See W3C License http://www.w3.org/Consortium/Legal/ for more details. + + +*/ + +package org.w3c.domts.level2.core; + + +import org.junit.Test; +import org.w3c.dom.Document; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.w3c.domts.DOMTestCase; + +import static org.junit.Assert.assertEquals; + + +/** + * The "getPrefix()" method + * returns the namespace prefix of this node, or null if unspecified. + * For nodes of any type other than ELEMENT_NODE and ATTRIBUTE_NODE, + * this is always null. + * <p> + * Retrieve the first emp:employeeId node and get the first child of this node. + * Since the first child is Text node invoking the "getPrefix()" + * method will cause "null" to be returned. + * + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeNSPrefix">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeNSPrefix</a> + */ +public class prefix02 extends DOMTestCase { + @Test + public void testRun() throws Throwable { + Document doc; + NodeList elementList; + Node testEmployee; + Node textNode; + String prefix; + String sExpected = null; + doc = load("staffNS", false); + elementList = doc.getElementsByTagName("emp:employeeId"); + testEmployee = elementList.item(0); + textNode = testEmployee.getFirstChild(); + prefix = textNode.getPrefix(); + assertEquals("textNodePrefix", sExpected, prefix); + + } + + /** + * Gets URI that identifies the test + * + * @return uri identifier of test + */ + public String getTargetURI() { + return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/prefix02"; + } + +}
Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/prefix03.java URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/prefix03.java?rev=1896456&view=auto ============================================================================== --- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/prefix03.java (added) +++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/prefix03.java Mon Dec 27 20:28:38 2021 @@ -0,0 +1,67 @@ +/* +This Java source file was generated by test-to-java.xsl +and is a derived work from the source document. +The source document contained the following notice: + + + +Copyright (c) 2001 World Wide Web Consortium, +(Massachusetts Institute of Technology, Institut National de +Recherche en Informatique et en Automatique, Keio University). All +Rights Reserved. This program is distributed under the W3C's Software +Intellectual Property License. This program is distributed in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. + +See W3C License http://www.w3.org/Consortium/Legal/ for more details. + + +*/ + +package org.w3c.domts.level2.core; + + +import org.junit.Test; +import org.w3c.dom.Document; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.w3c.domts.DOMTestCase; + +import static org.junit.Assert.assertEquals; + + +/** + * The "getPrefix()" method for a node + * returns the namespace prefix of this node, or null if it is unspecified. + * <p> + * Retrieve the first emp:employee node and invoke the getPrefix() method." + * The method should return "emp". + * + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeNSPrefix">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeNSPrefix</a> + */ +public class prefix03 extends DOMTestCase { + @Test + public void testRun() throws Throwable { + Document doc; + NodeList elementList; + Node testEmployee; + String prefix; + doc = load("staffNS", false); + elementList = doc.getElementsByTagName("emp:employee"); + testEmployee = elementList.item(0); + prefix = testEmployee.getPrefix(); + assertEquals("prefix", "emp", prefix); + + } + + /** + * Gets URI that identifies the test + * + * @return uri identifier of test + */ + public String getTargetURI() { + return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/prefix03"; + } + +} Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/prefix04.java URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/prefix04.java?rev=1896456&view=auto ============================================================================== --- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/prefix04.java (added) +++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/prefix04.java Mon Dec 27 20:28:38 2021 @@ -0,0 +1,69 @@ +/* +This Java source file was generated by test-to-java.xsl +and is a derived work from the source document. +The source document contained the following notice: + + + +Copyright (c) 2001 World Wide Web Consortium, +(Massachusetts Institute of Technology, Institut National de +Recherche en Informatique et en Automatique, Keio University). All +Rights Reserved. This program is distributed under the W3C's Software +Intellectual Property License. This program is distributed in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. + +See W3C License http://www.w3.org/Consortium/Legal/ for more details. + + +*/ + +package org.w3c.domts.level2.core; + + +import org.junit.Ignore; +import org.junit.Test; +import org.w3c.dom.Document; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.w3c.domts.DOMTestCase; + +import static org.junit.Assert.assertNull; + + +/** + * The "getPrefix()" method for a node + * returns the namespace prefix of this node, or null if it is unspecified. + * <p> + * Retrieve the first employee node and invoke the getPrefix() method." + * The method should return "null". + * + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeNSPrefix">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeNSPrefix</a> + */ +public class prefix04 extends DOMTestCase { + @Test + @Ignore + public void testRun() throws Throwable { + Document doc; + NodeList elementList; + Node testEmployee; + String prefix; + doc = load("staffNS", false); + elementList = doc.getElementsByTagName("employee"); + testEmployee = elementList.item(0); + prefix = testEmployee.getPrefix(); + assertNull("throw_Null", prefix); + + } + + /** + * Gets URI that identifies the test + * + * @return uri identifier of test + */ + public String getTargetURI() { + return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/prefix04"; + } + +} Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/prefix05.java URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/prefix05.java?rev=1896456&view=auto ============================================================================== --- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/prefix05.java (added) +++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/prefix05.java Mon Dec 27 20:28:38 2021 @@ -0,0 +1,80 @@ +/* +This Java source file was generated by test-to-java.xsl +and is a derived work from the source document. +The source document contained the following notice: + + + +Copyright (c) 2001 World Wide Web Consortium, +(Massachusetts Institute of Technology, Institut National de +Recherche en Informatique et en Automatique, Keio University). All +Rights Reserved. This program is distributed under the W3C's Software +Intellectual Property License. This program is distributed in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. + +See W3C License http://www.w3.org/Consortium/Legal/ for more details. + + +*/ + +package org.w3c.domts.level2.core; + + +import org.junit.Test; +import org.w3c.dom.*; +import org.w3c.domts.DOMTestCase; + +import static org.junit.Assert.assertTrue; + + +/** + * The "setPrefix(prefix)" method raises a + * NAMESPACE_ERR DOMException if the specified node is an attribute + * and the specified prefix is xmlns and the namespaceURI is different from + * http://www.w3.org/2000/xmlns. + * <p> + * Attempt to insert "xmlns" as the new namespace prefix on the emp:domestic + * attribute within the emp:address node. + * An exception should be raised since the namespaceURI of this node is not + * http://www.w3.org/2000/xmlns. + * + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NAMESPACE_ERR'])">http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NAMESPACE_ERR'])</a> + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeNSPrefix">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeNSPrefix</a> + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-NodeNSPrefix')/setraises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR'])">http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-NodeNSPrefix')/setraises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR'])</a> + */ +public class prefix05 extends DOMTestCase { + @Test + public void testRun() throws Throwable { + Document doc; + NodeList elementList; + Element addrNode; + Attr addrAttr; + doc = load("staffNS", true); + elementList = doc.getElementsByTagName("emp:address"); + addrNode = (Element) elementList.item(0); + addrAttr = addrNode.getAttributeNode("emp:domestic"); + + { + boolean success = false; + try { + addrAttr.setPrefix("xmlns"); + } catch (DOMException ex) { + success = (ex.code == DOMException.NAMESPACE_ERR); + } + assertTrue("throw_NAMESPACE_ERR", success); + } + + } + + /** + * Gets URI that identifies the test + * + * @return uri identifier of test + */ + public String getTargetURI() { + return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/prefix05"; + } + +} Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/prefix06.java URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/prefix06.java?rev=1896456&view=auto ============================================================================== --- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/prefix06.java (added) +++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/prefix06.java Mon Dec 27 20:28:38 2021 @@ -0,0 +1,79 @@ +/* +This Java source file was generated by test-to-java.xsl +and is a derived work from the source document. +The source document contained the following notice: + + + +Copyright (c) 2001 World Wide Web Consortium, +(Massachusetts Institute of Technology, Institut National de +Recherche en Informatique et en Automatique, Keio University). All +Rights Reserved. This program is distributed under the W3C's Software +Intellectual Property License. This program is distributed in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. + +See W3C License http://www.w3.org/Consortium/Legal/ for more details. + + +*/ + +package org.w3c.domts.level2.core; + + +import org.junit.Test; +import org.w3c.dom.DOMException; +import org.w3c.dom.Document; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.w3c.domts.DOMTestCase; + +import static org.junit.Assert.assertTrue; + + +/** + * The "setPrefix(prefix)" method raises a + * INVALID_CHARACTER_ERR DOMException if the specified + * prefix contains an illegal character. + * <p> + * Attempt to insert a new namespace prefix on the first employee node. + * An exception should be raised since the namespace prefix has an invalid + * character. + * + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR'])">http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR'])</a> + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeNSPrefix">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeNSPrefix</a> + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-NodeNSPrefix')/setraises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR'])">http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-NodeNSPrefix')/setraises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR'])</a> + */ +public class prefix06 extends DOMTestCase { + @Test + public void testRun() throws Throwable { + Document doc; + NodeList elementList; + Node employeeNode; + doc = load("staffNS", true); + elementList = doc.getElementsByTagName("employee"); + employeeNode = elementList.item(0); + + { + boolean success = false; + try { + employeeNode.setPrefix("pre^fix xmlns='http//www.nist.gov'"); + } catch (DOMException ex) { + success = (ex.code == DOMException.INVALID_CHARACTER_ERR); + } + assertTrue("throw_INVALID_CHARACTER_ERR", success); + } + + } + + /** + * Gets URI that identifies the test + * + * @return uri identifier of test + */ + public String getTargetURI() { + return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/prefix06"; + } + +} Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/prefix07.java URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/prefix07.java?rev=1896456&view=auto ============================================================================== --- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/prefix07.java (added) +++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/prefix07.java Mon Dec 27 20:28:38 2021 @@ -0,0 +1,79 @@ +/* +This Java source file was generated by test-to-java.xsl +and is a derived work from the source document. +The source document contained the following notice: + + + +Copyright (c) 2001 World Wide Web Consortium, +(Massachusetts Institute of Technology, Institut National de +Recherche en Informatique et en Automatique, Keio University). All +Rights Reserved. This program is distributed under the W3C's Software +Intellectual Property License. This program is distributed in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. + +See W3C License http://www.w3.org/Consortium/Legal/ for more details. + + +*/ + +package org.w3c.domts.level2.core; + + +import org.junit.Test; +import org.w3c.dom.DOMException; +import org.w3c.dom.Document; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.w3c.domts.DOMTestCase; + +import static org.junit.Assert.assertTrue; + + +/** + * The "setPrefix(prefix)" method raises a + * NAMESPACE_ERR DOMException if the specified + * prefix if malformed. + * <p> + * Attempt to insert a new namespace prefix on the second employee node. + * An exception should be raised since the namespace prefix is malformed. + * + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NAMESPACE_ERR'])">http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NAMESPACE_ERR'])</a> + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeNSPrefix">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeNSPrefix</a> + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-NodeNSPrefix')/setraises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR'])">http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-NodeNSPrefix')/setraises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR'])</a> + */ +public class prefix07 extends DOMTestCase { + @Test + public void testRun() throws Throwable { + Document doc; + NodeList elementList; + Node employeeNode; + doc = load("staffNS", true); + elementList = doc.getElementsByTagName("employee"); + employeeNode = elementList.item(0); + + { + boolean success = false; + try { + employeeNode.setPrefix("emp::"); + } catch (DOMException ex) { + + success = (ex.code == DOMException.NAMESPACE_ERR); + } + assertTrue("throw_NAMESPACE_ERR, specified prefix if malformed", success); + } + + } + + /** + * Gets URI that identifies the test + * + * @return uri identifier of test + */ + public String getTargetURI() { + return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/prefix07"; + } + +} Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/prefix08.java URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/prefix08.java?rev=1896456&view=auto ============================================================================== --- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/prefix08.java (added) +++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/prefix08.java Mon Dec 27 20:28:38 2021 @@ -0,0 +1,97 @@ +/* +This Java source file was generated by test-to-java.xsl +and is a derived work from the source document. +The source document contained the following notice: + + + +Copyright (c) 2001 World Wide Web Consortium, +(Massachusetts Institute of Technology, Institut National de +Recherche en Informatique et en Automatique, Keio University). All +Rights Reserved. This program is distributed under the W3C's Software +Intellectual Property License. This program is distributed in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. + +See W3C License http://www.w3.org/Consortium/Legal/ for more details. + + +*/ + +package org.w3c.domts.level2.core; + + +import org.junit.Ignore; +import org.junit.Test; +import org.w3c.dom.DOMException; +import org.w3c.dom.Document; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.w3c.domts.DOMTestCase; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + + +/** + * The "setPrefix(prefix)" method causes the + * DOMException NO_MODIFICATION_ALLOWED_ERR to be raised + * if the node is readonly. + * <p> + * Obtain the children of the THIRD "gender" element. The elements + * content is an entity reference. Get the FIRST item + * from the entity reference and execute the "setPrefix(prefix)" method. + * This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown. + * + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])">http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])</a> + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeNSPrefix">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeNSPrefix</a> + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-NodeNSPrefix')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])">http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-NodeNSPrefix')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])</a> + */ +public class prefix08 extends DOMTestCase { + @Test + @Ignore + public void testRun() throws Throwable { + Document doc; + NodeList genderList; + Node genderNode; + Node entRef; + Node entElement; + Node createdNode; + doc = load("staff", true); + + if (!isExpandEntityReferences()) { + genderList = doc.getElementsByTagName("gender"); + genderNode = genderList.item(2); + entRef = genderNode.getFirstChild(); + } else { + entRef = doc.createEntityReference("ent4"); + } + + assertNotNull("entityRef", entRef); + entElement = entRef.getFirstChild(); + assertNotNull("entElement", entElement); + createdNode = doc.createElement("text3"); + + { + boolean success = false; + try { + entElement.setPrefix("newPrefix"); + } catch (DOMException ex) { + success = (ex.code == DOMException.NO_MODIFICATION_ALLOWED_ERR); + } + assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR", success); + } + + } + + /** + * Gets URI that identifies the test + * + * @return uri identifier of test + */ + public String getTargetURI() { + return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/prefix08"; + } + +} Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/prefix09.java URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/prefix09.java?rev=1896456&view=auto ============================================================================== --- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/prefix09.java (added) +++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/prefix09.java Mon Dec 27 20:28:38 2021 @@ -0,0 +1,79 @@ +/* +This Java source file was generated by test-to-java.xsl +and is a derived work from the source document. +The source document contained the following notice: + + + +Copyright (c) 2001 World Wide Web Consortium, +(Massachusetts Institute of Technology, Institut National de +Recherche en Informatique et en Automatique, Keio University). All +Rights Reserved. This program is distributed under the W3C's Software +Intellectual Property License. This program is distributed in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. + +See W3C License http://www.w3.org/Consortium/Legal/ for more details. + + +*/ + +package org.w3c.domts.level2.core; + + +import org.junit.Test; +import org.w3c.dom.*; +import org.w3c.domts.DOMTestCase; + +import static org.junit.Assert.assertTrue; + + +/** + * The "setPrefix(prefix)" method raises a + * NAMESPACE_ERR DOMException if the specified node is an attribute + * and the qualifiedName of this node is xmlns. + * <p> + * Attempt to set the prefix on the xmlns attribute within the fourth address + * element. + * An exception should be raised since the qualifiedName of this attribute + * is "xmlns". + * + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NAMESPACE_ERR'])">http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NAMESPACE_ERR'])</a> + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeNSPrefix">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeNSPrefix</a> + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-NodeNSPrefix')/setraises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR'])">http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-NodeNSPrefix')/setraises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR'])</a> + */ +public class prefix09 extends DOMTestCase { + @Test + public void testRun() throws Throwable { + Document doc; + NodeList elementList; + Element addrNode; + Attr addrAttr; + doc = load("staffNS", true); + elementList = doc.getElementsByTagName("address"); + addrNode = (Element) elementList.item(3); + addrAttr = addrNode.getAttributeNode("xmlns"); + + { + boolean success = false; + try { + addrAttr.setPrefix("xxx"); + } catch (DOMException ex) { + success = (ex.code == DOMException.NAMESPACE_ERR); + } + assertTrue("throw_NAMESPACE_ERR", success); + } + + } + + /** + * Gets URI that identifies the test + * + * @return uri identifier of test + */ + public String getTargetURI() { + return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/prefix09"; + } + +} Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/prefix10.java URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/prefix10.java?rev=1896456&view=auto ============================================================================== --- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/prefix10.java (added) +++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/prefix10.java Mon Dec 27 20:28:38 2021 @@ -0,0 +1,80 @@ +/* +This Java source file was generated by test-to-java.xsl +and is a derived work from the source document. +The source document contained the following notice: + + + +Copyright (c) 2001 World Wide Web Consortium, +(Massachusetts Institute of Technology, Institut National de +Recherche en Informatique et en Automatique, Keio University). All +Rights Reserved. This program is distributed under the W3C's Software +Intellectual Property License. This program is distributed in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. + +See W3C License http://www.w3.org/Consortium/Legal/ for more details. + + +*/ + +package org.w3c.domts.level2.core; + + +import org.junit.Test; +import org.w3c.dom.DOMException; +import org.w3c.dom.Document; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.w3c.domts.DOMTestCase; + +import static org.junit.Assert.assertTrue; + + +/** + * The "setPrefix(prefix)" method raises a + * NAMESPACE_ERR DOMException if the specified + * prefix is xml and the namespaceURI is different from + * http://www.w3.org/XML/1998/namespace. + * <p> + * Attempt to insert "xml" as the new namespace prefix on the first employee node. + * An exception should be raised since the namespaceURI of this node is not + * http://www.w3.org/XML/1998/namespace. + * + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NAMESPACE_ERR'])">http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NAMESPACE_ERR'])</a> + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeNSPrefix">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeNSPrefix</a> + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-NodeNSPrefix')/setraises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR'])">http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-NodeNSPrefix')/setraises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR'])</a> + */ +public class prefix10 extends DOMTestCase { + @Test + public void testRun() throws Throwable { + Document doc; + NodeList elementList; + Node employeeNode; + doc = load("staffNS", true); + elementList = doc.getElementsByTagName("employee"); + employeeNode = elementList.item(1); + + { + boolean success = false; + try { + employeeNode.setPrefix("xml"); + } catch (DOMException ex) { + success = (ex.code == DOMException.NAMESPACE_ERR); + } + assertTrue("throw_NAMESPACE_ERR", success); + } + + } + + /** + * Gets URI that identifies the test + * + * @return uri identifier of test + */ + public String getTargetURI() { + return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/prefix10"; + } + +} Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/prefix11.java URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/prefix11.java?rev=1896456&view=auto ============================================================================== --- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/prefix11.java (added) +++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/prefix11.java Mon Dec 27 20:28:38 2021 @@ -0,0 +1,81 @@ +/* +This Java source file was generated by test-to-java.xsl +and is a derived work from the source document. +The source document contained the following notice: + + + +Copyright (c) 2001 World Wide Web Consortium, +(Massachusetts Institute of Technology, Institut National de +Recherche en Informatique et en Automatique, Keio University). All +Rights Reserved. This program is distributed under the W3C's Software +Intellectual Property License. This program is distributed in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. + +See W3C License http://www.w3.org/Consortium/Legal/ for more details. + + +*/ + +package org.w3c.domts.level2.core; + + +import org.junit.Test; +import org.w3c.dom.DOMException; +import org.w3c.dom.Document; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.w3c.domts.DOMTestCase; + +import static org.junit.Assert.assertTrue; + + +/** + * The "setPrefix(prefix)" method raises a + * NAMESPACE_ERR DOMException if the specified + * prefix is set on a node with a namespaceURI that is null. + * <p> + * Attempt to insert a new namespace prefix on the second employee node. + * An exception should be raised since the namespace prefix is set + * on a node whose namespaceURI is null. + * + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NAMESPACE_ERR'])">http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NAMESPACE_ERR'])</a> + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#">http://www.w3.org/TR/DOM-Level-2-Core/core#</a> + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('')/setraises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR'])">http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('')/setraises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR'])</a> + */ +public class prefix11 extends DOMTestCase { + @Test + public void testRun() throws Throwable { + Document doc; + NodeList elementList; + Node employeeNode; + String namespaceURI; + doc = load("staffNS", true); + elementList = doc.getElementsByTagName("employee"); + employeeNode = elementList.item(1); + namespaceURI = employeeNode.getNamespaceURI(); + + { + boolean success = false; + try { + employeeNode.setPrefix("employee1"); + } catch (DOMException ex) { + success = (ex.code == DOMException.NAMESPACE_ERR); + } + assertTrue("throw_NAMESPACE_ERR", success); + } + + } + + /** + * Gets URI that identifies the test + * + * @return uri identifier of test + */ + public String getTargetURI() { + return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/prefix11"; + } + +} Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/publicId01.java URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/publicId01.java?rev=1896456&view=auto ============================================================================== --- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/publicId01.java (added) +++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/publicId01.java Mon Dec 27 20:28:38 2021 @@ -0,0 +1,67 @@ +/* +This Java source file was generated by test-to-java.xsl +and is a derived work from the source document. +The source document contained the following notice: + + + +Copyright (c) 2001 World Wide Web Consortium, +(Massachusetts Institute of Technology, Institut National de +Recherche en Informatique et en Automatique, Keio University). All +Rights Reserved. This program is distributed under the W3C's Software +Intellectual Property License. This program is distributed in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. + +See W3C License http://www.w3.org/Consortium/Legal/ for more details. + + +*/ + +package org.w3c.domts.level2.core; + + +import org.junit.Ignore; +import org.junit.Test; +import org.w3c.dom.Document; +import org.w3c.dom.DocumentType; +import org.w3c.domts.DOMTestCase; + +import static org.junit.Assert.assertEquals; + + +/** + * The "getPublicId()" method of a documenttype node contains + * the public identifier associated with the external subset. + * <p> + * Retrieve the documenttype. + * Apply the "getPublicId()" method. The string "STAFF" should be + * returned. + * + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-Core-DocType-publicId">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-Core-DocType-publicId</a> + */ +public class publicId01 extends DOMTestCase { + @Test + @Ignore + public void testRun() throws Throwable { + Document doc; + DocumentType docType; + String publicId; + doc = load("staffNS", false); + docType = doc.getDoctype(); + publicId = docType.getPublicId(); + assertEquals("throw_Equals", "STAFF", publicId); + + } + + /** + * Gets URI that identifies the test + * + * @return uri identifier of test + */ + public String getTargetURI() { + return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/publicId01"; + } + +} Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/removeAttributeNS01.java URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/removeAttributeNS01.java?rev=1896456&view=auto ============================================================================== --- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/removeAttributeNS01.java (added) +++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/removeAttributeNS01.java Mon Dec 27 20:28:38 2021 @@ -0,0 +1,96 @@ +/* +This Java source file was generated by test-to-java.xsl +and is a derived work from the source document. +The source document contained the following notice: + + + +Copyright (c) 2001 World Wide Web Consortium, +(Massachusetts Institute of Technology, Institut National de +Recherche en Informatique et en Automatique, Keio University). All +Rights Reserved. This program is distributed under the W3C's Software +Intellectual Property License. This program is distributed in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. + +See W3C License http://www.w3.org/Consortium/Legal/ for more details. + + +*/ + +package org.w3c.domts.level2.core; + + +import org.junit.Ignore; +import org.junit.Test; +import org.w3c.dom.*; +import org.w3c.domts.DOMTestCase; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + + +/** + * The "removeAttributeNS(namespaceURI,localName)" method for an attribute causes the + * DOMException NO_MODIFICATION_ALLOWED_ERR to be raised + * if the node is readonly. + * <p> + * Obtain the children of the THIRD "gender" element. The elements + * content is an entity reference. Try to remove an attribute + * from the entity reference by executing the + * "removeAttributeNS(namespaceURI,localName)" method. + * This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown. + * + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])">http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])</a> + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElRemAtNS">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElRemAtNS</a> + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-ElRemAtNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])">http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-ElRemAtNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])</a> + */ +public class removeAttributeNS01 extends DOMTestCase { + @Test + @Ignore + public void testRun() throws Throwable { + Document doc; + NodeList genderList; + Node gender; + NodeList genList; + Node gen; + NodeList gList; + Element genElement; + doc = load("staffNS", true); + + if (!isExpandEntityReferences()) { + genderList = doc.getElementsByTagName("gender"); + gender = genderList.item(2); + genList = gender.getChildNodes(); + gen = genList.item(0); + } else { + gen = doc.createEntityReference("ent4"); + } + + gList = gen.getChildNodes(); + genElement = (Element) gList.item(0); + assertNotNull("notnull", genElement); + + { + boolean success = false; + try { + genElement.removeAttributeNS("www.xyz.com", "local1"); + } catch (DOMException ex) { + success = (ex.code == DOMException.NO_MODIFICATION_ALLOWED_ERR); + } + assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR", success); + } + + } + + /** + * Gets URI that identifies the test + * + * @return uri identifier of test + */ + public String getTargetURI() { + return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/removeAttributeNS01"; + } + +} Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/removeAttributeNS02.java URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/removeAttributeNS02.java?rev=1896456&view=auto ============================================================================== --- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/removeAttributeNS02.java (added) +++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/removeAttributeNS02.java Mon Dec 27 20:28:38 2021 @@ -0,0 +1,87 @@ +/* +This Java source file was generated by test-to-java.xsl +and is a derived work from the source document. +The source document contained the following notice: + + + +Copyright (c) 2001-2003 World Wide Web Consortium, +(Massachusetts Institute of Technology, Institut National de +Recherche en Informatique et en Automatique, Keio University). All +Rights Reserved. This program is distributed under the W3C's Software +Intellectual Property License. This program is distributed in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. + +See W3C License http://www.w3.org/Consortium/Legal/ for more details. + + +*/ + +package org.w3c.domts.level2.core; + + +import org.junit.Ignore; +import org.junit.Test; +import org.w3c.dom.*; +import org.w3c.domts.DOMTestCase; + +import static org.junit.Assert.assertEquals; + + +/** + * The "removeAttributeNS(namespaceURI,localName)" removes an attribute by + * local name and namespace URI. If the removed attribute has a + * default value it is immediately replaced. The replacing attribute has the same + * namespace URI and local name, as well as the original prefix. + * Retrieve the attribute named "emp:local" from emp:address + * node, then remove the "emp:local" + * attribute by invoking the "removeAttributeNS(namespaceURI,localName)" method. + * The "emp:local" attribute has a default value defined in the + * DTD file, that value should immediately replace the old + * value. + * + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElRemAtNS">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElRemAtNS</a> + * @see <a href="http://www.w3.org/Bugs/Public/show_bug.cgi?id=238">http://www.w3.org/Bugs/Public/show_bug.cgi?id=238</a> + */ +public class removeAttributeNS02 extends DOMTestCase { + @Test + @Ignore + public void testRun() throws Throwable { + Document doc; + NodeList elementList; + Node testAddr; + Attr addrAttr; + String attr; + String namespaceURI; + String localName; + String prefix; + doc = load("staffNS", true); + elementList = doc.getElementsByTagName("emp:address"); + testAddr = elementList.item(0); + ((Element) /*Node */testAddr).removeAttributeNS("http://www.nist.gov", "local1"); + elementList = doc.getElementsByTagName("emp:address"); + testAddr = elementList.item(0); + addrAttr = ((Element) /*Node */testAddr).getAttributeNodeNS("http://www.nist.gov", "local1"); + attr = ((Element) /*Node */testAddr).getAttributeNS("http://www.nist.gov", "local1"); + namespaceURI = addrAttr.getNamespaceURI(); + localName = addrAttr.getLocalName(); + prefix = testAddr.getPrefix(); + assertEquals("attr", "FALSE", attr); + assertEquals("uri", "http://www.nist.gov", namespaceURI); + assertEquals("lname", "local1", localName); + assertEquals("prefix", "emp", prefix); + + } + + /** + * Gets URI that identifies the test + * + * @return uri identifier of test + */ + public String getTargetURI() { + return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/removeAttributeNS02"; + } + +} Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/removeNamedItemNS01.java URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/removeNamedItemNS01.java?rev=1896456&view=auto ============================================================================== --- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/removeNamedItemNS01.java (added) +++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/removeNamedItemNS01.java Mon Dec 27 20:28:38 2021 @@ -0,0 +1,75 @@ +/* +This Java source file was generated by test-to-java.xsl +and is a derived work from the source document. +The source document contained the following notice: + + + +Copyright (c) 2001 World Wide Web Consortium, +(Massachusetts Institute of Technology, Institut National de +Recherche en Informatique et en Automatique, Keio University). All +Rights Reserved. This program is distributed under the W3C's Software +Intellectual Property License. This program is distributed in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. + +See W3C License http://www.w3.org/Consortium/Legal/ for more details. + + +*/ + +package org.w3c.domts.level2.core; + + +import org.junit.Test; +import org.w3c.dom.*; +import org.w3c.domts.DOMTestCase; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; + + +/** + * The "removeNamedItemNS(namespaceURI,localName)" method for a + * NamedNodeMap should remove a node specified by localName and namespaceURI. + * <p> + * Retrieve a list of elements with tag name "address". + * Access the second element from the list and get its attributes. + * Try to remove the attribute node with local name "domestic" + * and namespace uri "http://www.usa.com" with + * method removeNamedItemNS(namespaceURI,localName). + * Check to see if the node has been removed. + * + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-1074577549">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-1074577549</a> + */ +public class removeNamedItemNS01 extends DOMTestCase { + @Test + public void testRun() throws Throwable { + Document doc; + NodeList elementList; + Node testAddress; + NamedNodeMap attributes; + Attr newAttr; + Node removedNode; + doc = load("staffNS", true); + elementList = doc.getElementsByTagName("address"); + testAddress = elementList.item(1); + attributes = testAddress.getAttributes(); + removedNode = attributes.removeNamedItemNS("http://www.usa.com", "domestic"); + assertNotNull("retval", removedNode); + newAttr = (Attr) attributes.getNamedItem("dmstc:domestic"); + assertNull("nodeRemoved", newAttr); + + } + + /** + * Gets URI that identifies the test + * + * @return uri identifier of test + */ + public String getTargetURI() { + return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/removeNamedItemNS01"; + } + +} Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/removeNamedItemNS02.java URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/removeNamedItemNS02.java?rev=1896456&view=auto ============================================================================== --- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/removeNamedItemNS02.java (added) +++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/removeNamedItemNS02.java Mon Dec 27 20:28:38 2021 @@ -0,0 +1,84 @@ +/* +This Java source file was generated by test-to-java.xsl +and is a derived work from the source document. +The source document contained the following notice: + + + +Copyright (c) 2001 World Wide Web Consortium, +(Massachusetts Institute of Technology, Institut National de +Recherche en Informatique et en Automatique, Keio University). All +Rights Reserved. This program is distributed under the W3C's Software +Intellectual Property License. This program is distributed in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. + +See W3C License http://www.w3.org/Consortium/Legal/ for more details. + + +*/ + +package org.w3c.domts.level2.core; + + +import org.junit.Test; +import org.w3c.dom.*; +import org.w3c.domts.DOMTestCase; + +import static org.junit.Assert.assertTrue; + + +/** + * The "removeNamedItemNS(namespaceURI,localName)" method for a + * NamedNodeMap should raise NOT_FOUND_ERR DOMException if + * there is no node with the specified namespaceURI and localName in this map. + * <p> + * Retrieve a list of elements with tag name "address". + * Access the second element from the list and get its attributes. + * Try to remove an attribute node with local name "domest" + * and namespace uri "http://www.usa.com" with + * method removeNamedItemNS(namespaceURI,localName). + * This should raise NOT_FOUND_ERR DOMException. + * + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NOT_FOUND_ERR'])">http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NOT_FOUND_ERR'])</a> + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-removeNamedItemNS">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-removeNamedItemNS</a> + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-removeNamedItemNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NOT_FOUND_ERR'])">http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-removeNamedItemNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NOT_FOUND_ERR'])</a> + */ +public class removeNamedItemNS02 extends DOMTestCase { + @Test + public void testRun() throws Throwable { + String namespaceURI = "http://www.usa.com"; + String localName = "domest"; + Document doc; + NodeList elementList; + Node testAddress; + NamedNodeMap attributes; + Node removedNode; + doc = load("staffNS", true); + elementList = doc.getElementsByTagName("address"); + testAddress = elementList.item(1); + attributes = testAddress.getAttributes(); + + { + boolean success = false; + try { + removedNode = attributes.removeNamedItemNS(namespaceURI, localName); + } catch (DOMException ex) { + success = (ex.code == DOMException.NOT_FOUND_ERR); + } + assertTrue("throw_NOT_FOUND_ERR", success); + } + + } + + /** + * Gets URI that identifies the test + * + * @return uri identifier of test + */ + public String getTargetURI() { + return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/removeNamedItemNS02"; + } + +} Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/removeNamedItemNS03.java URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/removeNamedItemNS03.java?rev=1896456&view=auto ============================================================================== --- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/removeNamedItemNS03.java (added) +++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/removeNamedItemNS03.java Mon Dec 27 20:28:38 2021 @@ -0,0 +1,102 @@ +/* +This Java source file was generated by test-to-java.xsl +and is a derived work from the source document. +The source document contained the following notice: + + + +Copyright (c) 2001 World Wide Web Consortium, +(Massachusetts Institute of Technology, Institut National de +Recherche en Informatique et en Automatique, Keio University). All +Rights Reserved. This program is distributed under the W3C's Software +Intellectual Property License. This program is distributed in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. + +See W3C License http://www.w3.org/Consortium/Legal/ for more details. + + +*/ + +package org.w3c.domts.level2.core; + + +import org.junit.Ignore; +import org.junit.Test; +import org.w3c.dom.*; +import org.w3c.domts.DOMTestCase; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + + +/** + * The "removeNamedItemNS(namespaceURI,localName)" method for a + * NamedNodeMap should raise NO_MODIFICATION_ALLOWED_ERR DOMException if + * this map is readonly. + * <p> + * Retrieve a list of "gender" elements. Get access to the THIRD element + * which contains an ENTITY_REFERENCE child node. Try to remove the attribute + * in the node's map with method removeNamedItemNS(namespaceURI,localName). + * This should result in NO_MODIFICATION_ALLOWED_ERR + * DOMException. + * + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])">http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])</a> + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-removeNamedItemNS">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-removeNamedItemNS</a> + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-removeNamedItemNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])">http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-removeNamedItemNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])</a> + */ +public class removeNamedItemNS03 extends DOMTestCase { + @Test + @Ignore + public void testRun() throws Throwable { + String namespaceURI = "http://www.w3.org/2000/xmlns/"; + String localName = "local1"; + Document doc; + NodeList elementList; + Node testAddress; + NodeList nList; + Node child; + NodeList n2List; + Node child2; + NamedNodeMap attributes; + Node removedNode; + doc = load("staffNS", true); + + if (!isExpandEntityReferences()) { + elementList = doc.getElementsByTagName("gender"); + testAddress = elementList.item(1); //YK: was 2 but 2 is ER + nList = testAddress.getChildNodes(); + child = nList.item(0); + } else { + child = doc.createEntityReference("ent4"); + } + //child is now the text val of the gender + //n2List = child.getChildNodes(); + // child2 = n2List.item(0); + child2 = child; + assertNotNull("notnull", child2); + attributes = child2.getAttributes(); + + { + boolean success = false; + try { + removedNode = attributes.removeNamedItemNS(namespaceURI, localName); + } catch (DOMException ex) { + success = (ex.code == DOMException.NO_MODIFICATION_ALLOWED_ERR); + } + assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR", success); + } + + } + + /** + * Gets URI that identifies the test + * + * @return uri identifier of test + */ + public String getTargetURI() { + return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/removeNamedItemNS03"; + } + +} Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/setAttributeNS01.java URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/setAttributeNS01.java?rev=1896456&view=auto ============================================================================== --- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/setAttributeNS01.java (added) +++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/setAttributeNS01.java Mon Dec 27 20:28:38 2021 @@ -0,0 +1,78 @@ +/* +This Java source file was generated by test-to-java.xsl +and is a derived work from the source document. +The source document contained the following notice: + + + +Copyright (c) 2001 World Wide Web Consortium, +(Massachusetts Institute of Technology, Institut National de +Recherche en Informatique et en Automatique, Keio University). All +Rights Reserved. This program is distributed under the W3C's Software +Intellectual Property License. This program is distributed in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. + +See W3C License http://www.w3.org/Consortium/Legal/ for more details. + + +*/ + +package org.w3c.domts.level2.core; + + +import org.junit.Test; +import org.w3c.dom.*; +import org.w3c.domts.DOMTestCase; + +import static org.junit.Assert.assertTrue; + + +/** + * The "setAttributeNS(namespaceURI,qualifiedName,Value)" method raises a + * INVALID_CHARACTER_ERR DOMException if the specified + * prefix contains an illegal character. + * <p> + * Attempt to add a new attribute on the first employee node. + * An exception should be raised since the "qualifiedName" has an invalid + * character. + * + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR'])">http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR'])</a> + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAttrNS">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAttrNS</a> + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-ElSetAttrNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR'])">http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-ElSetAttrNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR'])</a> + */ +public class setAttributeNS01 extends DOMTestCase { + @Test + public void testRun() throws Throwable { + String namespaceURI = "http://www.nist.gov"; + String qualifiedName = "emp:qual?name"; + Document doc; + NodeList elementList; + Node testAddr; + doc = load("staffNS", true); + elementList = doc.getElementsByTagName("employee"); + testAddr = elementList.item(0); + + { + boolean success = false; + try { + ((Element) /*Node */testAddr).setAttributeNS(namespaceURI, qualifiedName, "newValue"); + } catch (DOMException ex) { + success = (ex.code == DOMException.INVALID_CHARACTER_ERR); + } + assertTrue("throw_INVALID_CHARACTER_ERR", success); + } + + } + + /** + * Gets URI that identifies the test + * + * @return uri identifier of test + */ + public String getTargetURI() { + return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/setAttributeNS01"; + } + +} Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/setAttributeNS02.java URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/setAttributeNS02.java?rev=1896456&view=auto ============================================================================== --- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/setAttributeNS02.java (added) +++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/setAttributeNS02.java Mon Dec 27 20:28:38 2021 @@ -0,0 +1,79 @@ +/* +This Java source file was generated by test-to-java.xsl +and is a derived work from the source document. +The source document contained the following notice: + + + +Copyright (c) 2001 World Wide Web Consortium, +(Massachusetts Institute of Technology, Institut National de +Recherche en Informatique et en Automatique, Keio University). All +Rights Reserved. This program is distributed under the W3C's Software +Intellectual Property License. This program is distributed in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. + +See W3C License http://www.w3.org/Consortium/Legal/ for more details. + + +*/ + +package org.w3c.domts.level2.core; + + +import org.junit.Test; +import org.w3c.dom.*; +import org.w3c.domts.DOMTestCase; + +import static org.junit.Assert.assertTrue; + + +/** + * The "setAttributeNS(namespaceURI,qualifiedName,value)" method raises a + * NAMESPACE_ERR DOMException if the specified + * qualifiedName if malformed. + * <p> + * Attempt to add a new attribute on the second employee node. + * An exception should be raised since the "qualifiedName" is malformed. + * + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NAMESPACE_ERR'])">http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NAMESPACE_ERR'])</a> + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAttrNS">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAttrNS</a> + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-ElSetAttrNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR'])">http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-ElSetAttrNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR'])</a> + */ +public class setAttributeNS02 extends DOMTestCase { + @Test + public void testRun() throws Throwable { + String namespaceURI = "http://www.nist.gov"; + String qualifiedName = "emp:"; + Document doc; + NodeList elementList; + Node testAddr; + doc = load("staffNS", true); + elementList = doc.getElementsByTagName("emp:employee"); + testAddr = elementList.item(0); + + { + boolean success = false; + try { + ((Element) /*Node */testAddr).setAttributeNS(namespaceURI, qualifiedName, "newValue"); + } catch (DOMException ex) { + success = (ex.code == DOMException.NAMESPACE_ERR); + } + assertTrue("throw_NAMESPACE_ERR,NAMESPACE_ERR DOMException if the specified\n" + + "\n" + + " qualifiedName if malformed ", success); + } + + } + + /** + * Gets URI that identifies the test + * + * @return uri identifier of test + */ + public String getTargetURI() { + return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/setAttributeNS02"; + } + +} Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/setAttributeNS03.java URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/setAttributeNS03.java?rev=1896456&view=auto ============================================================================== --- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/setAttributeNS03.java (added) +++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/setAttributeNS03.java Mon Dec 27 20:28:38 2021 @@ -0,0 +1,104 @@ +/* +This Java source file was generated by test-to-java.xsl +and is a derived work from the source document. +The source document contained the following notice: + + + +Copyright (c) 2001 World Wide Web Consortium, +(Massachusetts Institute of Technology, Institut National de +Recherche en Informatique et en Automatique, Keio University). All +Rights Reserved. This program is distributed under the W3C's Software +Intellectual Property License. This program is distributed in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. + +See W3C License http://www.w3.org/Consortium/Legal/ for more details. + + +*/ + +package org.w3c.domts.level2.core; + + +import org.junit.Ignore; +import org.junit.Test; +import org.w3c.dom.*; +import org.w3c.domts.DOMTestCase; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + + +/** + * The "setAttributeNS(namespaceURI,qualifiedName,value)" method for an attribute causes the + * DOMException NO_MODIFICATION_ALLOWED_ERR to be raised + * if the node is readonly. + * <p> + * Obtain the children of the THIRD "gender" element. The elements + * content is an entity reference. Try to set an attribute + * in the entity reference by executing the + * "setAttributeNS(namespaceURI,qualifiedName,value)" method. + * This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown. + * + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])">http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])</a> + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAttrNS">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAttrNS</a> + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-ElSetAttrNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])">http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-ElSetAttrNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])</a> + */ +public class setAttributeNS03 extends DOMTestCase { + @Test + @Ignore + public void testRun() throws Throwable { + String namespaceURI = "www.xyz.com"; + String qualifiedName = "emp:local1"; + Document doc; + NodeList genderList; + Node gender; + NodeList genList; + Node gen; + NodeList gList; + Element genElement; + doc = load("staffNS", true); + + if (!isExpandEntityReferences()) { + genderList = doc.getElementsByTagName("gender"); + //ykadiysk: item(2) is an empty gender element: it has no child nodes. + // Changing it to 1 + //gender = genderList.item(1); + gen = genderList.item(1); + //ykadiysk: This makes no sense: a gender elt only has a text child + //the test seemed to be looking for some deep structure underneath + // genList = gender.getChildNodes(); + // gen = genList.item(0); + } else { + gen = doc.createEntityReference("ent4"); + } + + gList = gen.getChildNodes(); + + genElement = (Element) gList.item(0); + assertNotNull("notnull", genElement); + + { + boolean success = false; + try { + genElement.setAttributeNS(namespaceURI, qualifiedName, "newValue"); + } catch (DOMException ex) { + success = (ex.code == DOMException.NO_MODIFICATION_ALLOWED_ERR); + } + assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR", success); + } + + } + + /** + * Gets URI that identifies the test + * + * @return uri identifier of test + */ + public String getTargetURI() { + return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/setAttributeNS03"; + } + +} Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/setAttributeNS04.java URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/setAttributeNS04.java?rev=1896456&view=auto ============================================================================== --- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/setAttributeNS04.java (added) +++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/setAttributeNS04.java Mon Dec 27 20:28:38 2021 @@ -0,0 +1,84 @@ +/* +This Java source file was generated by test-to-java.xsl +and is a derived work from the source document. +The source document contained the following notice: + + + +Copyright (c) 2001 World Wide Web Consortium, +(Massachusetts Institute of Technology, Institut National de +Recherche en Informatique et en Automatique, Keio University). All +Rights Reserved. This program is distributed under the W3C's Software +Intellectual Property License. This program is distributed in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. + +See W3C License http://www.w3.org/Consortium/Legal/ for more details. + + +*/ + +package org.w3c.domts.level2.core; + + +import org.junit.Test; +import org.w3c.dom.*; +import org.w3c.domts.DOMTestCase; + +import static org.junit.Assert.assertEquals; + + +/** + * The "setAttributeNS(namespaceURI,qualifiedName,value)" method adds a new attribute. + * If an attribute with the same local name and namespace URI is already present + * on the element, its prefix is changed to be the prefix part of the "qualifiedName", + * and its vale is changed to be the "value" paramter. + * null value if no previously existing Attr node with the + * same name was replaced. + * <p> + * Add a new attribute to the "emp:address" element. + * Check to see if the new attribute has been successfully added to the document + * by getting the attributes value, namespace URI, local Name and prefix. + * The prefix will be changed to the prefix part of the "qualifiedName" + * and its value changed to the "value" parameter. + * + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#">http://www.w3.org/TR/DOM-Level-2-Core/core#</a> + */ +public class setAttributeNS04 extends DOMTestCase { + @Test + public void testRun() throws Throwable { + Document doc; + NodeList elementList; + Node testAddr; + Attr addrAttr; + String resultAttr; + String resultNamespaceURI; + String resultLocalName; + String resultPrefix; + doc = load("staffNS", true); + elementList = doc.getElementsByTagName("emp:address"); + testAddr = elementList.item(0); + ((Element) /*Node */testAddr).setAttributeNS("http://www.nist.gov", "newprefix:zone", "newValue"); + addrAttr = ((Element) /*Node */testAddr).getAttributeNodeNS("http://www.nist.gov", "zone"); + resultAttr = ((Element) /*Node */testAddr).getAttributeNS("http://www.nist.gov", "zone"); + assertEquals("attrValue", "newValue", resultAttr); + resultNamespaceURI = addrAttr.getNamespaceURI(); + assertEquals("nsuri", "http://www.nist.gov", resultNamespaceURI); + resultLocalName = addrAttr.getLocalName(); + assertEquals("lname", "zone", resultLocalName); + resultPrefix = addrAttr.getPrefix(); + assertEquals("prefix", "newprefix", resultPrefix); + + } + + /** + * Gets URI that identifies the test + * + * @return uri identifier of test + */ + public String getTargetURI() { + return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/setAttributeNS04"; + } + +} Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/setAttributeNS05.java URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/setAttributeNS05.java?rev=1896456&view=auto ============================================================================== --- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/setAttributeNS05.java (added) +++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/setAttributeNS05.java Mon Dec 27 20:28:38 2021 @@ -0,0 +1,76 @@ +/* +This Java source file was generated by test-to-java.xsl +and is a derived work from the source document. +The source document contained the following notice: + + + +Copyright (c) 2001 World Wide Web Consortium, +(Massachusetts Institute of Technology, Institut National de +Recherche en Informatique et en Automatique, Keio University). All +Rights Reserved. This program is distributed under the W3C's Software +Intellectual Property License. This program is distributed in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. + +See W3C License http://www.w3.org/Consortium/Legal/ for more details. + + +*/ + +package org.w3c.domts.level2.core; + + +import org.junit.Test; +import org.w3c.dom.*; +import org.w3c.domts.DOMTestCase; + +import static org.junit.Assert.assertEquals; + + +/** + * The "setAttributeNS(namespaceURI,qualifiedName,value)" method adds a new attribute. + * If an attribute with the same local name and namespace URI is already present + * on the element, its prefix is changed to be the prefix part of the "qualifiedName", + * and its vale is changed to be the "value" paramter. + * null value if no previously existing Attr node with the + * same name was replaced. + * <p> + * Add a new attribute to the "emp:address" element. + * Check to see if the new attribute has been successfully added to the document. + * The new attribute "<newValue>" contains markup and therefore is escaped + * by the implementation. + * + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElGetAttrNS">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElGetAttrNS</a> + */ +public class setAttributeNS05 extends DOMTestCase { + @Test + public void testRun() throws Throwable { + String localName = "newAttr"; + String namespaceURI = "http://www.newattr.com"; + String qualifiedName = "emp:newAttr"; + Document doc; + NodeList elementList; + Node testAddr; + Attr addrAttr; + String resultAttr; + doc = load("staffNS", true); + elementList = doc.getElementsByTagName("emp:address"); + testAddr = elementList.item(0); + ((Element) /*Node */testAddr).setAttributeNS(namespaceURI, qualifiedName, "<newValue>"); + resultAttr = ((Element) /*Node */testAddr).getAttributeNS(namespaceURI, localName); + assertEquals("throw_Equals", "<newValue>", resultAttr); + + } + + /** + * Gets URI that identifies the test + * + * @return uri identifier of test + */ + public String getTargetURI() { + return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/setAttributeNS05"; + } + +} Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/setAttributeNS06.java URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/setAttributeNS06.java?rev=1896456&view=auto ============================================================================== --- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/setAttributeNS06.java (added) +++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/setAttributeNS06.java Mon Dec 27 20:28:38 2021 @@ -0,0 +1,79 @@ +/* +This Java source file was generated by test-to-java.xsl +and is a derived work from the source document. +The source document contained the following notice: + + + +Copyright (c) 2001 World Wide Web Consortium, +(Massachusetts Institute of Technology, Institut National de +Recherche en Informatique et en Automatique, Keio University). All +Rights Reserved. This program is distributed under the W3C's Software +Intellectual Property License. This program is distributed in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. + +See W3C License http://www.w3.org/Consortium/Legal/ for more details. + + +*/ + +package org.w3c.domts.level2.core; + + +import org.junit.Test; +import org.w3c.dom.*; +import org.w3c.domts.DOMTestCase; + +import static org.junit.Assert.assertTrue; + + +/** + * The "setAttributeNS(namespaceURI,localName,value)" method raises a + * NAMESPACE_ERR DOMException if the "qualifiedName" has a + * prefix of "xml" and the namespaceURI is different from + * http://www.w3.org/XML/1998/namespace. + * <p> + * Attempt to add an attribute with a prefix of "xml" as the on the first employee node. + * An exception should be raised since the namespaceURI of this node is not + * http://www.w3.org/XML/1998/namespace. + * + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NAMESPACE_ERR'])">http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NAMESPACE_ERR'])</a> + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAttrNS">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAttrNS</a> + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-ElSetAttrNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR'])">http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-ElSetAttrNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR'])</a> + */ +public class setAttributeNS06 extends DOMTestCase { + @Test + public void testRun() throws Throwable { + String namespaceURI = "http://www.nist.gov"; + String qualifiedName = "xml:qualifiedName"; + Document doc; + NodeList elementList; + Node testAddr; + doc = load("staffNS", true); + elementList = doc.getElementsByTagName("employee"); + testAddr = elementList.item(0); + + { + boolean success = false; + try { + ((Element) /*Node */testAddr).setAttributeNS(namespaceURI, qualifiedName, "newValue"); + } catch (DOMException ex) { + success = (ex.code == DOMException.NAMESPACE_ERR); + } + assertTrue("throw_NAMESPACE_ERR", success); + } + + } + + /** + * Gets URI that identifies the test + * + * @return uri identifier of test + */ + public String getTargetURI() { + return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/setAttributeNS06"; + } + +} Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/setAttributeNS07.java URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/setAttributeNS07.java?rev=1896456&view=auto ============================================================================== --- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/setAttributeNS07.java (added) +++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/setAttributeNS07.java Mon Dec 27 20:28:38 2021 @@ -0,0 +1,80 @@ +/* +This Java source file was generated by test-to-java.xsl +and is a derived work from the source document. +The source document contained the following notice: + + + +Copyright (c) 2001 World Wide Web Consortium, +(Massachusetts Institute of Technology, Institut National de +Recherche en Informatique et en Automatique, Keio University). All +Rights Reserved. This program is distributed under the W3C's Software +Intellectual Property License. This program is distributed in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. + +See W3C License http://www.w3.org/Consortium/Legal/ for more details. + + +*/ + +package org.w3c.domts.level2.core; + + +import org.junit.Test; +import org.w3c.dom.*; +import org.w3c.domts.DOMTestCase; + +import static org.junit.Assert.assertTrue; + + +/** + * The "setAttributeNS(namespaceURI,localName,value)" method raises a + * NAMESPACE_ERR DOMException if the "qualifiedName" has a + * value of "xmlns" and the namespaceURI is different from + * http://www.w3.org/2000/xmlns. + * <p> + * Attempt to add an attribute with a "qualifiedName" of "xmlns" as the + * on the first employee node. + * An exception should be raised since the namespaceURI of this node is not + * http://www.w3.org/2000/xmlns. + * + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NAMESPACE_ERR'])">http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NAMESPACE_ERR'])</a> + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAttrNS">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAttrNS</a> + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-ElSetAttrNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR'])">http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-ElSetAttrNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR'])</a> + */ +public class setAttributeNS07 extends DOMTestCase { + @Test + public void testRun() throws Throwable { + String namespaceURI = "http://www.nist.gov"; + String qualifiedName = "xmlns"; + Document doc; + NodeList elementList; + Node testAddr; + doc = load("staffNS", true); + elementList = doc.getElementsByTagName("employee"); + testAddr = elementList.item(0); + + { + boolean success = false; + try { + ((Element) /*Node */testAddr).setAttributeNS(namespaceURI, qualifiedName, "newValue"); + } catch (DOMException ex) { + success = (ex.code == DOMException.NAMESPACE_ERR); + } + assertTrue("throw_NAMESPACE_ERR", success); + } + + } + + /** + * Gets URI that identifies the test + * + * @return uri identifier of test + */ + public String getTargetURI() { + return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/setAttributeNS07"; + } + +} Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/setAttributeNS09.java URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/setAttributeNS09.java?rev=1896456&view=auto ============================================================================== --- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/setAttributeNS09.java (added) +++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/setAttributeNS09.java Mon Dec 27 20:28:38 2021 @@ -0,0 +1,85 @@ +/* +This Java source file was generated by test-to-java.xsl +and is a derived work from the source document. +The source document contained the following notice: + + + +Copyright (c) 2001 World Wide Web Consortium, +(Massachusetts Institute of Technology, Institut National de +Recherche en Informatique et en Automatique, Keio University). All +Rights Reserved. This program is distributed under the W3C's Software +Intellectual Property License. This program is distributed in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. + +See W3C License http://www.w3.org/Consortium/Legal/ for more details. + + +*/ + +package org.w3c.domts.level2.core; + + +import org.junit.Test; +import org.w3c.dom.*; +import org.w3c.domts.DOMTestCase; + +import static org.junit.Assert.assertEquals; + + +/** + * The "setAttributeNS(namespaceURI,qualifiedName,value)" method adds a new attribute. + * If an attribute with the same local name and namespace URI is already present + * on the element, its prefix is changed to be the prefix part of the "qualifiedName", + * and its vale is changed to be the "value" paramter. + * null value if no previously existing Attr node with the + * same name was replaced. + * <p> + * Add a new attribute to the "emp:address" element. + * Check to see if the new attribute has been successfully added to the document + * by getting the attributes value, namespace URI, local Name and prefix. + * + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAttrNS">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAttrNS</a> + */ +public class setAttributeNS09 extends DOMTestCase { + @Test + public void testRun() throws Throwable { + String localName = "newAttr"; + String namespaceURI = "http://www.newattr.com"; + String qualifiedName = "emp:newAttr"; + Document doc; + NodeList elementList; + Node testAddr; + Attr addrAttr; + String resultAttr; + String resultNamespaceURI; + String resultLocalName; + String resultPrefix; + doc = load("staffNS", true); + elementList = doc.getElementsByTagName("emp:address"); + testAddr = elementList.item(0); + ((Element) /*Node */testAddr).setAttributeNS(namespaceURI, qualifiedName, "newValue"); + addrAttr = ((Element) /*Node */testAddr).getAttributeNodeNS(namespaceURI, localName); + resultAttr = ((Element) /*Node */testAddr).getAttributeNS(namespaceURI, localName); + assertEquals("attrValue", "newValue", resultAttr); + resultNamespaceURI = addrAttr.getNamespaceURI(); + assertEquals("nsuri", "http://www.newattr.com", resultNamespaceURI); + resultLocalName = addrAttr.getLocalName(); + assertEquals("lname", "newAttr", resultLocalName); + resultPrefix = addrAttr.getPrefix(); + assertEquals("prefix", "emp", resultPrefix); + + } + + /** + * Gets URI that identifies the test + * + * @return uri identifier of test + */ + public String getTargetURI() { + return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/setAttributeNS09"; + } + +} --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
