You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ki...@apache.org on 2021/12/27 20:28:41 UTC
svn commit: r1896456 [7/14] - in /xmlbeans/branches/gradle-build: ./ gradle/ gradle/wrapper/ samples/ samples/AbstractTypes/ samples/Any/ samples/DateTime/ samples/MixedContent/ samples/OrderMatters/ samples/SampleTemplate/ samples/SchemaEnum/ samples/...
Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementhasattribute03.java
URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementhasattribute03.java?rev=1896456&view=auto
==============================================================================
--- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementhasattribute03.java (added)
+++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementhasattribute03.java Mon Dec 27 20:28:38 2021
@@ -0,0 +1,72 @@
+/*
+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.Test;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.domts.DOMTestCase;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+
+/**
+ * The method hasAttribute returns true when an attribute with a given name is specified
+ * on this element or has a default value, false otherwise.
+ * Create an element Node and an attribute Node. Invoke hasAttribute method
+ * to verify that there is no attribute. Append the attribute node to the element node.
+ * Invoke the hasAttribute method on the element and verify if it returns true.
+ *
+ * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeHasAttrs">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeHasAttrs</a>
+ */
+public class elementhasattribute03 extends DOMTestCase {
+ @Test
+ public void testRun() throws Throwable {
+ Document doc;
+ Element element;
+ boolean state;
+ Attr attribute;
+ Attr newAttribute;
+ doc = load("staff", false);
+ element = doc.createElement("address");
+ attribute = doc.createAttribute("domestic");
+ state = element.hasAttribute("domestic");
+ assertFalse("elementhasattribute03_False", state);
+ newAttribute = element.setAttributeNode(attribute);
+ state = element.hasAttribute("domestic");
+ assertTrue("elementhasattribute03_True", state);
+
+ }
+
+ /**
+ * 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/elementhasattribute03";
+ }
+
+}
Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementhasattribute04.java
URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementhasattribute04.java?rev=1896456&view=auto
==============================================================================
--- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementhasattribute04.java (added)
+++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementhasattribute04.java Mon Dec 27 20:28:38 2021
@@ -0,0 +1,68 @@
+/*
+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.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.domts.DOMTestCase;
+
+import static org.junit.Assert.assertTrue;
+
+
+/**
+ * The method hasAttribute returns true when an attribute with a given name is specified
+ * on this element or has a default value, false otherwise.
+ * Create an element Node and an attribute Node and add the attribute node to the element.
+ * Invoke the hasAttribute method on the element and verify if the method returns true.
+ *
+ * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeHasAttrs">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeHasAttrs</a>
+ */
+public class elementhasattribute04 extends DOMTestCase {
+ @Test
+ public void testRun() throws Throwable {
+ Document doc;
+ Element element;
+ boolean state;
+ Attr attribute;
+ Attr newAttribute;
+ doc = load("staff", false);
+ element = doc.createElement("address");
+ attribute = doc.createAttribute("domestic");
+ newAttribute = element.setAttributeNode(attribute);
+ state = element.hasAttribute("domestic");
+ assertTrue("elementhasattribute04", state);
+
+ }
+
+ /**
+ * 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/elementhasattribute04";
+ }
+
+}
Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementhasattributens01.java
URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementhasattributens01.java?rev=1896456&view=auto
==============================================================================
--- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementhasattributens01.java (added)
+++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementhasattributens01.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.Element;
+import org.w3c.dom.NodeList;
+import org.w3c.domts.DOMTestCase;
+
+import static org.junit.Assert.assertTrue;
+
+
+/**
+ * The method hasAttributeNS returns true when an attribute with a given local name
+ * and namespace
+ * URI is specified on this element or has a default value, false otherwise.
+ * Retreive the first employee element node. Invoke the hasAttributeNS method to check if it
+ * has the xmlns attribute that belongs to the namespace http://www.w3.org/2000/xmlns/.
+ *
+ * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElHasAttrNS">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElHasAttrNS</a>
+ */
+public class elementhasattributens01 extends DOMTestCase {
+ @Test
+ public void testRun() throws Throwable {
+ Document doc;
+ Element element;
+ boolean state;
+ NodeList elementList;
+ doc = load("staffNS", false);
+ elementList = doc.getElementsByTagNameNS("*", "employee");
+ element = (Element) elementList.item(0);
+ state = element.hasAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns");
+ assertTrue("elementhasattributens01", state);
+
+ }
+
+ /**
+ * 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/elementhasattributens01";
+ }
+
+}
Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementhasattributens02.java
URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementhasattributens02.java?rev=1896456&view=auto
==============================================================================
--- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementhasattributens02.java (added)
+++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementhasattributens02.java Mon Dec 27 20:28:38 2021
@@ -0,0 +1,71 @@
+/*
+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.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.domts.DOMTestCase;
+
+import static org.junit.Assert.assertTrue;
+
+
+/**
+ * The method hasAttributeNS returns true when an attribute with a given local
+ * name and namespace URI is specified on this element or has a default value,
+ * false otherwise.
+ * Create a new element and attribute node that belong to the same namespace.
+ * Add the attribute node to the element node. Check if the newly created element
+ * node has an attribute by invoking the hasAttributeNS method with appropriate
+ * values for the namespaceURI and localName parameters.
+ *
+ * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElHasAttrNS">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElHasAttrNS</a>
+ */
+public class elementhasattributens02 extends DOMTestCase {
+ @Test
+ public void testRun() throws Throwable {
+ Document doc;
+ Element element;
+ boolean state;
+ Attr attribute;
+ Attr newAttribute;
+ doc = load("staff", false);
+ element = doc.createElementNS("http://www.w3.org/DOM", "address");
+ attribute = doc.createAttributeNS("http://www.w3.org/DOM", "domestic");
+ newAttribute = element.setAttributeNode(attribute);
+ state = element.hasAttributeNS("http://www.w3.org/DOM", "domestic");
+ assertTrue("elementhasattributens02", state);
+
+ }
+
+ /**
+ * 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/elementhasattributens02";
+ }
+
+}
Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementhasattributens03.java
URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementhasattributens03.java?rev=1896456&view=auto
==============================================================================
--- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementhasattributens03.java (added)
+++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementhasattributens03.java Mon Dec 27 20:28:38 2021
@@ -0,0 +1,74 @@
+/*
+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.Test;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.domts.DOMTestCase;
+
+import static org.junit.Assert.assertTrue;
+
+
+/**
+ * The method hasAttributeNS returns true when an attribute with a given local name
+ * and namespace URI is specified on this element or has a default value,
+ * false otherwise.
+ * Create a new element and an attribute node that has an empty namespace.
+ * Add the attribute node to the element node. Check if the newly created element
+ * node has an attribute by invoking the hasAttributeNS method with appropriate
+ * values for the namespaceURI and localName parameters.
+ *
+ * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElHasAttrNS">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElHasAttrNS</a>
+ * @see <a href="http://www.w3.org/Bugs/Public/show_bug.cgi?id=259">http://www.w3.org/Bugs/Public/show_bug.cgi?id=259</a>
+ */
+public class elementhasattributens03 extends DOMTestCase {
+ @Test
+ public void testRun() throws Throwable {
+ Document doc;
+ Element element;
+ boolean state;
+ Attr attribute;
+ Attr newAttribute;
+ String nullNS = null;
+
+ doc = load("staff", false);
+ element = doc.createElementNS("http://www.w3.org/DOM", "address");
+ attribute = doc.createAttributeNS(nullNS, "domestic");
+ newAttribute = element.setAttributeNode(attribute);
+ state = element.hasAttributeNS(nullNS, "domestic");
+ assertTrue("elementhasattributens03", state);
+
+ }
+
+ /**
+ * 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/elementhasattributens03";
+ }
+
+}
Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementremoveattributens01.java
URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementremoveattributens01.java?rev=1896456&view=auto
==============================================================================
--- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementremoveattributens01.java (added)
+++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementremoveattributens01.java Mon Dec 27 20:28:38 2021
@@ -0,0 +1,70 @@
+/*
+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.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.domts.DOMTestCase;
+
+import static org.junit.Assert.assertFalse;
+
+
+/**
+ * The method removeAttributeNS removes an attribute by local name and namespace URI.
+ * Create a new element and add a new attribute node to it.
+ * Remove the attribute node using the removeAttributeNodeNS method.
+ * Check if the attribute was remove by invoking the hasAttributeNS
+ * method on the element and check if it returns false.
+ *
+ * @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>
+ */
+public class elementremoveattributens01 extends DOMTestCase {
+ @Test
+ public void testRun() throws Throwable {
+ Document doc;
+ Element element;
+ boolean state;
+ Attr attribute;
+ Attr newAttribute;
+ doc = load("staff", false);
+ element = doc.createElementNS("http://www.w3.org/DOM", "elem");
+ attribute = doc.createAttributeNS("http://www.w3.org/DOM/Test/createAttributeNS", "attr");
+ newAttribute = element.setAttributeNodeNS(attribute);
+ element.removeAttributeNS("http://www.w3.org/DOM/Test/createAttributeNS", "attr");
+ state = element.hasAttributeNS("http://www.w3.org/DOM/Test/createAttributeNS", "attr");
+ assertFalse("elementremoveattributens01", state);
+
+ }
+
+ /**
+ * 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/elementremoveattributens01";
+ }
+
+}
Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementsetattributenodens01.java
URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementsetattributenodens01.java?rev=1896456&view=auto
==============================================================================
--- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementsetattributenodens01.java (added)
+++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementsetattributenodens01.java Mon Dec 27 20:28:38 2021
@@ -0,0 +1,88 @@
+/*
+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.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.domts.DOMTestCase;
+
+import static org.junit.Assert.assertEquals;
+
+
+/**
+ * Testing Element.setAttributeNodeNS: If an attribute with that local name
+ * and that namespace URI is already present in the element, it is replaced
+ * by the new one.
+ * Create a new element and two new attribute nodes (in the same namespace
+ * and same localNames).
+ * Add the two new attribute nodes to the element node using the
+ * setAttributeNodeNS method. Check that only one attribute is added, check
+ * the value of this attribute.
+ *
+ * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAtNodeNS">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAtNodeNS</a>
+ */
+public class elementsetattributenodens01 extends DOMTestCase {
+ @Test
+ public void testRun() throws Throwable {
+ Document doc;
+ Element element;
+ Attr attribute1;
+ Attr attribute2;
+ Attr attrNode;
+ String attrName;
+ String attrNS;
+ String attrValue;
+ NamedNodeMap attributes;
+ Attr newAttribute;
+ int length;
+ doc = load("staff", true);
+ element = doc.createElementNS("http://www.w3.org/DOM/Test/Level2", "new:element");
+ attribute1 = doc.createAttributeNS("http://www.w3.org/DOM/Test/att1", "p1:att");
+ attribute2 = doc.createAttributeNS("http://www.w3.org/DOM/Test/att1", "p2:att");
+ attribute2.setValue("value2");
+ newAttribute = element.setAttributeNodeNS(attribute1);
+ newAttribute = element.setAttributeNodeNS(attribute2);
+ attrNode = element.getAttributeNodeNS("http://www.w3.org/DOM/Test/att1", "att");
+ attrName = attrNode.getNodeName();
+ attrNS = attrNode.getNamespaceURI();
+ assertEquals("elementsetattributenodens01_attrName", "p2:att", attrName);
+ assertEquals("elementsetattributenodens01_attrNS", "http://www.w3.org/DOM/Test/att1", attrNS);
+ attributes = element.getAttributes();
+ length = attributes.getLength();
+ assertEquals("length", 1, length);
+
+ }
+
+ /**
+ * 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/elementsetattributenodens01";
+ }
+
+}
Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementsetattributenodens02.java
URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementsetattributenodens02.java?rev=1896456&view=auto
==============================================================================
--- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementsetattributenodens02.java (added)
+++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementsetattributenodens02.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-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.Test;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.w3c.domts.DOMTestCase;
+
+import static org.junit.Assert.assertEquals;
+
+
+/**
+ * Test the setAttributeNodeNS method.
+ * Retreive the street attribute from the second address element node.
+ * Clone it and add it to the first address node. The INUSE_ATTRIBUTE_ERR exception
+ * should not be thrown. Check the name and value of the newly added node.
+ *
+ * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAtNodeNS">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAtNodeNS</a>
+ * @see <a href="http://www.w3.org/Bugs/Public/show_bug.cgi?id=259">http://www.w3.org/Bugs/Public/show_bug.cgi?id=259</a>
+ */
+public class elementsetattributenodens02 extends DOMTestCase {
+ @Test
+ public void testRun() throws Throwable {
+ Document doc;
+ Element element;
+ Element element2;
+ Attr attribute;
+ Attr attributeCloned;
+ Attr newAttr;
+ NodeList elementList;
+ String attrName;
+ String attrValue;
+ String nullNS = null;
+
+ doc = load("staffNS", true);
+ elementList = doc.getElementsByTagNameNS("http://www.nist.gov", "address");
+ element = (Element) elementList.item(1);
+ attribute = element.getAttributeNodeNS(nullNS, "street");
+ attributeCloned = (Attr) attribute.cloneNode(true);
+ element2 = (Element) elementList.item(2);
+ newAttr = element2.setAttributeNodeNS(attributeCloned);
+ attrName = newAttr.getNodeName();
+ attrValue = newAttr.getNodeValue();
+ assertEquals("elementsetattributenodens02_attrName", "street", attrName);
+ assertEquals("elementsetattributenodens02_attrValue", "Yes", attrValue);
+
+ }
+
+ /**
+ * 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/elementsetattributenodens02";
+ }
+
+}
Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementsetattributenodens03.java
URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementsetattributenodens03.java?rev=1896456&view=auto
==============================================================================
--- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementsetattributenodens03.java (added)
+++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementsetattributenodens03.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-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.Test;
+import org.w3c.dom.*;
+import org.w3c.domts.DOMTestCase;
+
+import static org.junit.Assert.assertTrue;
+
+
+/**
+ * The method setAttributeNodeNS adds a new attribute and raises the
+ * INUSE_ATTRIBUTE_ERR exception if the newAttr is already an attribute of
+ * another Element object.
+ * Retreive an attribute node of an existing element node. Attempt to add it to an another
+ * element node. Check if the INUSE_ATTRIBUTE_ERR exception is thrown.
+ *
+ * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAtNodeNS">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAtNodeNS</a>
+ */
+public class elementsetattributenodens03 extends DOMTestCase {
+ @Test
+ public void testRun() throws Throwable {
+ Document doc;
+ Element element1;
+ Element element2;
+ Attr attribute;
+ Attr newAttribute;
+ NodeList elementList;
+ String nullNS = null;
+
+ doc = load("staffNS", true);
+ elementList = doc.getElementsByTagNameNS("http://www.nist.gov", "address");
+ element1 = (Element) elementList.item(1);
+ attribute = element1.getAttributeNodeNS(nullNS, "street");
+ element2 = (Element) elementList.item(2);
+
+ {
+ boolean success = false;
+ try {
+ newAttribute = element2.setAttributeNodeNS(attribute);
+ } catch (DOMException ex) {
+ success = (ex.code == DOMException.INUSE_ATTRIBUTE_ERR);
+ }
+ assertTrue("elementsetattributenodens03", 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/elementsetattributenodens03";
+ }
+
+}
Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementsetattributenodens04.java
URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementsetattributenodens04.java?rev=1896456&view=auto
==============================================================================
--- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementsetattributenodens04.java (added)
+++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementsetattributenodens04.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.Attr;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.domts.DOMTestCase;
+
+import static org.junit.Assert.assertTrue;
+
+
+/**
+ * The method setAttributeNodeNS Adds a new attribute and raises an INUSE_ATTRIBUTE_ERR
+ * if newAttr is already an attribute of another Element object.
+ * Create two new element nodes and a new attribute node. Attempt to add the same attribute
+ * node to the same two element nodes.
+ * Check if an INUSE_ATTRIBUTE_ERR is thrown.
+ *
+ * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAtNodeNS">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAtNodeNS</a>
+ */
+public class elementsetattributenodens04 extends DOMTestCase {
+ @Test
+ public void testRun() throws Throwable {
+ Document doc;
+ Element element1;
+ Element element2;
+ Attr attribute;
+ Attr newAttribute;
+ doc = load("staffNS", true);
+ element1 = doc.createElementNS("http://www.w3.org/DOM/Test", "elem1");
+ element2 = doc.createElementNS("http://www.w3.org/DOM/Test", "elem2");
+ attribute = doc.createAttributeNS("http://www.w3.org/DOM/Test", "attr");
+ newAttribute = element1.setAttributeNodeNS(attribute);
+
+ {
+ boolean success = false;
+ try {
+ newAttribute = element2.setAttributeNodeNS(attribute);
+ } catch (DOMException ex) {
+ success = (ex.code == DOMException.INUSE_ATTRIBUTE_ERR);
+ }
+ assertTrue("elementsetattributenodens04", 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/elementsetattributenodens04";
+ }
+
+}
Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementsetattributenodens05.java
URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementsetattributenodens05.java?rev=1896456&view=auto
==============================================================================
--- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementsetattributenodens05.java (added)
+++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementsetattributenodens05.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.Attr;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.domts.DOMTestCase;
+
+import static org.junit.Assert.assertTrue;
+
+
+/**
+ * The method setAttributeNodeNS Adds a new attribute and raises
+ * an WRONG_DOCUMENT_ERR if newAttr was created from a different document
+ * than the one that created the element.
+ * Create new element and attribute nodes in different documents.
+ * Attempt to add the attribute node to the element node.
+ * Check if an WRONG_DOCUMENT_ERR is thrown.
+ *
+ * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAtNodeNS">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAtNodeNS</a>
+ */
+public class elementsetattributenodens05 extends DOMTestCase {
+ @Test
+ public void testRun() throws Throwable {
+ Document doc;
+ Document docAlt;
+ Element element;
+ Attr attribute;
+ Attr newAttribute;
+ doc = load("staffNS", true);
+ docAlt = load("staffNS", true);
+ element = doc.createElementNS("http://www.w3.org/DOM/Test", "elem1");
+ attribute = docAlt.createAttributeNS("http://www.w3.org/DOM/Test", "attr");
+
+ {
+ boolean success = false;
+ try {
+ newAttribute = element.setAttributeNodeNS(attribute);
+ } catch (DOMException ex) {
+ success = (ex.code == DOMException.WRONG_DOCUMENT_ERR);
+ }
+ assertTrue("elementsetattributenodens05", 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/elementsetattributenodens05";
+ }
+
+}
Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementsetattributenodens06.java
URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementsetattributenodens06.java?rev=1896456&view=auto
==============================================================================
--- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementsetattributenodens06.java (added)
+++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementsetattributenodens06.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.Ignore;
+import org.junit.Test;
+import org.w3c.dom.*;
+import org.w3c.domts.DOMTestCase;
+
+import static org.junit.Assert.assertTrue;
+
+
+/**
+ * The method setAttributeNodeNS Adds a new attribute and raises an WRONG_DOCUMENT_ERR if this node
+ * is readonly.
+ * Attempt to add an attribute node to an element node which is part of the replacement text of
+ * a read-only EntityReference node.
+ * Check if a NO_MODIFICATION_ALLOWED_ERR is thrown.
+ *
+ * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAtNodeNS">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAtNodeNS</a>
+ */
+public class elementsetattributenodens06 extends DOMTestCase {
+ @Test
+ @Ignore
+ public void testRun() throws Throwable {
+ Document doc;
+ Element element;
+ Attr attribute;
+ Attr attribute2;
+ EntityReference entRef;
+ NodeList elementList;
+ Node newAttribute;
+ Node newChild;
+ doc = load("staffNS", true);
+ element = doc.createElementNS("http://www.w3.org/DOM/Test", "elem1");
+ attribute = doc.createAttributeNS("http://www.w3.org/DOM/Test", "attr");
+ entRef = doc.createEntityReference("ent4");
+ newChild = attribute.appendChild(entRef);
+ newAttribute = element.setAttributeNodeNS(attribute);
+ elementList = entRef.getChildNodes();
+ element = (Element) elementList.item(0);
+ attribute2 = doc.createAttributeNS("http://www.w3.org/DOM/Test", "attr2");
+
+ {
+ boolean success = false;
+ try {
+ newAttribute = element.setAttributeNodeNS(attribute2);
+ } catch (DOMException ex) {
+ success = (ex.code == DOMException.NO_MODIFICATION_ALLOWED_ERR);
+ }
+ assertTrue("elementsetattributenodens06", 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/elementsetattributenodens06";
+ }
+
+}
Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementsetattributens01.java
URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementsetattributens01.java?rev=1896456&view=auto
==============================================================================
--- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementsetattributens01.java (added)
+++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementsetattributens01.java Mon Dec 27 20:28:38 2021
@@ -0,0 +1,70 @@
+/*
+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.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.domts.DOMTestCase;
+
+import static org.junit.Assert.assertEquals;
+
+
+/**
+ * The method setAttributeNS adds a new attribute.
+ * Create a new element and add a new attribute node to it using the setAttributeNS method.
+ * Check if the attribute was correctly set by invoking the getAttributeNodeNS method
+ * and checking the nodeName and nodeValue of the returned nodes.
+ *
+ * @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 elementsetattributens01 extends DOMTestCase {
+ @Test
+ public void testRun() throws Throwable {
+ Document doc;
+ Element element;
+ Attr attribute;
+ String attrName;
+ String attrValue;
+ doc = load("staff", true);
+ element = doc.createElementNS("http://www.w3.org/DOM", "dom:elem");
+ element.setAttributeNS("http://www.w3.org/DOM/Test/setAttributeNS", "attr", "value");
+ attribute = element.getAttributeNodeNS("http://www.w3.org/DOM/Test/setAttributeNS", "attr");
+ attrName = attribute.getNodeName();
+ attrValue = attribute.getNodeValue();
+ assertEquals("elementsetattributens01_attrName", "attr", attrName);
+ assertEquals("elementsetattributens01_attrValue", "value", attrValue);
+
+ }
+
+ /**
+ * 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/elementsetattributens01";
+ }
+
+}
Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementsetattributens02.java
URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementsetattributens02.java?rev=1896456&view=auto
==============================================================================
--- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementsetattributens02.java (added)
+++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementsetattributens02.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.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.w3c.domts.DOMTestCase;
+
+import static org.junit.Assert.assertEquals;
+
+
+/**
+ * The method setAttributeNS adds a new attribute.
+ * Retrieve an existing element node with attributes and add a new attribute node to it using
+ * the setAttributeNS method. Check if the attribute was correctly set by invoking the
+ * getAttributeNodeNS method and checking the nodeName and nodeValue of the returned nodes.
+ *
+ * @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 elementsetattributens02 extends DOMTestCase {
+ @Test
+ public void testRun() throws Throwable {
+ Document doc;
+ Element element;
+ Attr attribute;
+ NodeList elementList;
+ String attrName;
+ String attrValue;
+ doc = load("staff", true);
+ elementList = doc.getElementsByTagNameNS("*", "address");
+ element = (Element) elementList.item(0);
+ element.setAttributeNS("http://www.w3.org/DOM/Test/setAttributeNS", "this:street", "Silver Street");
+ attribute = element.getAttributeNodeNS("http://www.w3.org/DOM/Test/setAttributeNS", "street");
+ attrName = attribute.getNodeName();
+ attrValue = attribute.getNodeValue();
+ assertEquals("elementsetattributens02_attrName", "this:street", attrName);
+ assertEquals("elementsetattributens02_attrValue", "Silver Street", attrValue);
+
+ }
+
+ /**
+ * 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/elementsetattributens02";
+ }
+
+}
Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementsetattributens03.java
URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementsetattributens03.java?rev=1896456&view=auto
==============================================================================
--- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementsetattributens03.java (added)
+++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementsetattributens03.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-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.Test;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.w3c.domts.DOMTestCase;
+
+import static org.junit.Assert.assertEquals;
+
+
+/**
+ * The method setAttributeNS adds a new attribute.
+ * Retreive an existing element node with a default attribute node and
+ * add two new attribute nodes that have the same local name as the
+ * default attribute but different namespaceURI to it using the setAttributeNS method.
+ * Check if the attribute was correctly set by invoking the getAttributeNodeNS method
+ * and checking the nodeName and nodeValue of the returned nodes.
+ *
+ * @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 elementsetattributens03 extends DOMTestCase {
+ @Test
+ public void testRun() throws Throwable {
+ Document doc;
+ Element element;
+ Attr attribute;
+ NodeList elementList;
+ String attrName;
+ String attrValue;
+ doc = load("staffNS", true);
+ elementList = doc.getElementsByTagName("emp:employee");
+ element = (Element) elementList.item(0);
+ element.setAttributeNS("http://www.w3.org/DOM/Test/1", "defaultAttr", "default1");
+ element.setAttributeNS("http://www.w3.org/DOM/Test/2", "defaultAttr", "default2");
+ attribute = element.getAttributeNodeNS("http://www.w3.org/DOM/Test/1", "defaultAttr");
+ attrName = attribute.getNodeName();
+ attrValue = attribute.getNodeValue();
+ assertEquals("elementsetattributens03_attrName", "defaultAttr", attrName);
+ assertEquals("elementsetattributens03_attrValue", "default1", attrValue);
+
+ }
+
+ /**
+ * 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/elementsetattributens03";
+ }
+
+}
Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementsetattributens04.java
URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementsetattributens04.java?rev=1896456&view=auto
==============================================================================
--- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementsetattributens04.java (added)
+++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementsetattributens04.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 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.Element;
+import org.w3c.domts.DOMTestCase;
+
+import static org.junit.Assert.assertTrue;
+
+
+/**
+ * The method setAttributeNS adds a new attribute and raises a INVALID_CHARACTER_ERR if
+ * the specified qualified name contains an illegal character.
+ * Invoke the setAttributeNS method on this Element object with a valid value for
+ * namespaceURI, and qualifiedNames that contain illegal characters. Check if the an
+ * INVALID_CHARACTER_ERR was thrown.
+ *
+ * @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 elementsetattributens04 extends DOMTestCase {
+ @Test
+ public void testRun() throws Throwable {
+ Document doc;
+ Element element;
+ String qualifiedName;
+ java.util.List qualifiedNames = new java.util.ArrayList();
+ qualifiedNames.add("/");
+ qualifiedNames.add("//");
+ qualifiedNames.add("\\");
+ qualifiedNames.add(";");
+ qualifiedNames.add("&");
+ qualifiedNames.add("*");
+ qualifiedNames.add("]]");
+ qualifiedNames.add(">");
+ qualifiedNames.add("<");
+
+ doc = load("staffNS", true);
+ element = doc.createElementNS("http://www.w3.org/DOM/Test/L2", "dom:elem");
+ for (int indexd386e65 = 0; indexd386e65 < qualifiedNames.size(); indexd386e65++) {
+ qualifiedName = (String) qualifiedNames.get(indexd386e65);
+
+ {
+ boolean success = false;
+ try {
+ element.setAttributeNS("http://www.w3.org/DOM/Test/L2", qualifiedName, "test");
+ } catch (DOMException ex) {
+ success = (ex.code == DOMException.INVALID_CHARACTER_ERR);
+ }
+ assertTrue("elementsetattributens04", 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/elementsetattributens04";
+ }
+
+}
Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementsetattributens05.java
URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementsetattributens05.java?rev=1896456&view=auto
==============================================================================
--- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementsetattributens05.java (added)
+++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementsetattributens05.java Mon Dec 27 20:28:38 2021
@@ -0,0 +1,74 @@
+/*
+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.Test;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.domts.DOMTestCase;
+
+import static org.junit.Assert.assertTrue;
+
+
+/**
+ * The method setAttributeNS adds a new attribute and raises a NAMESPACE_ERR if the
+ * qualifiedName has a prefix and the namespaceURI is null.
+ * Invoke the setAttributeNS method on a new Element object with null namespaceURI and a
+ * qualifiedName that has a namespace prefix. Check if the NAMESPACE_ERR was thrown.
+ *
+ * @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/Bugs/Public/show_bug.cgi?id=259">http://www.w3.org/Bugs/Public/show_bug.cgi?id=259</a>
+ */
+public class elementsetattributens05 extends DOMTestCase {
+ @Test
+ public void testRun() throws Throwable {
+ Document doc;
+ Element element;
+ String nullNS = null;
+
+ doc = load("staffNS", true);
+ element = doc.createElementNS("http://www.w3.org/DOM/Test/L2", "dom:elem");
+
+ {
+ boolean success = false;
+ try {
+ element.setAttributeNS(nullNS, "dom:root", "test");
+ } catch (DOMException ex) {
+ success = (ex.code == DOMException.NAMESPACE_ERR);
+ }
+ assertTrue("elementsetattributens05", 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/elementsetattributens05";
+ }
+
+}
Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementsetattributens08.java
URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementsetattributens08.java?rev=1896456&view=auto
==============================================================================
--- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementsetattributens08.java (added)
+++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementsetattributens08.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.DOMException;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.domts.DOMTestCase;
+
+import static org.junit.Assert.assertTrue;
+
+
+/**
+ * The method setAttributeNS adds a new attribute and raises a NAMESPACE_ERR
+ * if the qualifiedName, or its prefix, is "xmlns" and the namespaceURI is
+ * different from "http://www.w3.org/2000/xmlns/".
+ * Invoke the setAttributeNS method on a new Element object with namespaceURI that is
+ * http://www.w3.org/DOMTest/level2 and a qualifiedName that has the prefix xmlns and once
+ * again with a qualifiedName that is xmlns.
+ * Check if the NAMESPACE_ERR was thrown.
+ *
+ * @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 elementsetattributens08 extends DOMTestCase {
+ @Test
+ public void testRun() throws Throwable {
+ Document doc;
+ Element element;
+ doc = load("staffNS", true);
+ element = doc.createElementNS("http://www.w3.org/DOMTest/level2", "dom:elem");
+
+ {
+ boolean success = false;
+ try {
+ element.setAttributeNS("http://www.w3.org/DOMTest/level2", "xmlns", "test");
+ } catch (DOMException ex) {
+ success = (ex.code == DOMException.NAMESPACE_ERR);
+ }
+ assertTrue("elementsetattributens08_Err1", success);
+ }
+
+ {
+ boolean success = false;
+ try {
+ element.setAttributeNS("http://www.w3.org/DOMTest/level2", "xmlns:root", "test");
+ } catch (DOMException ex) {
+ success = (ex.code == DOMException.NAMESPACE_ERR);
+ }
+ assertTrue("elementsetattributens08_Err2", 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/elementsetattributens08";
+ }
+
+}
Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementsetattributensurinull.java
URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementsetattributensurinull.java?rev=1896456&view=auto
==============================================================================
--- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementsetattributensurinull.java (added)
+++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/elementsetattributensurinull.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
+ * NAMESPACE_ERR DOMException if the specified
+ * qualifiedName has a prefix and the namespaceURI is null.
+ * <p>
+ * Attempt to add a new attribute on the first employee node.
+ * An exception should be raised since the "qualifiedName" has a
+ * prefix and the namespaceURI is null.
+ *
+ * @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 elementsetattributensurinull extends DOMTestCase {
+ @Test
+ public void testRun() throws Throwable {
+ String namespaceURI = null;
+
+ String qualifiedName = "emp:qualifiedName";
+ Document doc;
+ NodeList elementList;
+ Node testAddr;
+ doc = load("staff", 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/elementsetattributensurinull";
+ }
+
+}
Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/getAttributeNS01.java
URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/getAttributeNS01.java?rev=1896456&view=auto
==============================================================================
--- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/getAttributeNS01.java (added)
+++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/getAttributeNS01.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-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.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.w3c.domts.DOMTestCase;
+
+import static org.junit.Assert.assertEquals;
+
+
+/**
+ * The "getAttributeNS(namespaceURI,localName)" method retrieves an
+ * attribute value by local name and NamespaceURI.
+ * Retrieve the first "emp:address" element.
+ * The value returned by the "getAttributeNS()" method should be the
+ * value "DISTRICT" since the attribute has a default value.
+ *
+ * @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>
+ * @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 getAttributeNS01 extends DOMTestCase {
+ @Test
+ @Ignore
+ public void testRun() throws Throwable {
+ String namespaceURI = "http://www.nist.gov";
+ String localName = "district";
+ String qualifiedName = "emp:district";
+ Document doc;
+ NodeList elementList;
+ Element testAddr;
+ String attrValue;
+ doc = load("staffNS", false);
+ elementList = doc.getElementsByTagName("emp:address");
+ testAddr = (Element) elementList.item(0);
+ attrValue = testAddr.getAttributeNS(namespaceURI, localName);
+ assertEquals("attrValue", "DISTRICT", attrValue);
+
+ }
+
+ /**
+ * 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/getAttributeNS01";
+ }
+
+}
Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/getAttributeNS02.java
URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/getAttributeNS02.java?rev=1896456&view=auto
==============================================================================
--- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/getAttributeNS02.java (added)
+++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/getAttributeNS02.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.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.w3c.domts.DOMTestCase;
+
+import static org.junit.Assert.assertEquals;
+
+
+/**
+ * The "getAttributeNS(namespaceURI,localName)" method retrieves an
+ * attribute value by local name and NamespaceURI.
+ * <p>
+ * Retrieve the first "emp:address" element.
+ * Create a new attribute with the "createAttributeNS()" method.
+ * Add the new attribute with the "setAttributeNS()" method.
+ * The value returned by the "getAttributeNS()" method should be the
+ * empty string since the attribute does not have a default value.
+ *
+ * @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 getAttributeNS02 extends DOMTestCase {
+ @Test
+ public void testRun() throws Throwable {
+ String namespaceURI = "http://www.nist.gov";
+ String localName = "district";
+ String qualifiedName = "emp:district";
+ Document doc;
+ Attr newAttribute;
+ NodeList elementList;
+ Element testAddr;
+ Attr districtAttr;
+ String attrValue;
+ doc = load("staffNS", true);
+ newAttribute = doc.createAttributeNS(namespaceURI, qualifiedName);
+ elementList = doc.getElementsByTagName("emp:address");
+ testAddr = (Element) elementList.item(0);
+ districtAttr = testAddr.setAttributeNodeNS(newAttribute);
+ elementList = doc.getElementsByTagName("emp:address");
+ testAddr = (Element) elementList.item(0);
+ attrValue = testAddr.getAttributeNS(namespaceURI, localName);
+ assertEquals("throw_Equals", "", attrValue);
+
+ }
+
+ /**
+ * 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/getAttributeNS02";
+ }
+
+}
Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/getAttributeNS03.java
URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/getAttributeNS03.java?rev=1896456&view=auto
==============================================================================
--- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/getAttributeNS03.java (added)
+++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/getAttributeNS03.java Mon Dec 27 20:28:38 2021
@@ -0,0 +1,71 @@
+/*
+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.Element;
+import org.w3c.dom.NodeList;
+import org.w3c.domts.DOMTestCase;
+
+import static org.junit.Assert.assertEquals;
+
+
+/**
+ * The "getAttributeNS(namespaceURI,localName)" method retrieves an
+ * attribute value by local name and NamespaceURI.
+ * Retrieve the first "emp:address" element.
+ * The value returned by the "getAttributeNS()" method for the emp:domestic attribute
+ * should be the empty string since the attribute does not have a specified value
+ * because it was removed by the "removeAttributeNS()" method.
+ *
+ * @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 getAttributeNS03 extends DOMTestCase {
+ @Test
+ public void testRun() throws Throwable {
+ String namespaceURI = "http://www.nist.gov";
+ String localName = "domestic";
+ Document doc;
+ NodeList elementList;
+ Element testAddr;
+ String attrValue;
+ doc = load("staffNS", true);
+ elementList = doc.getElementsByTagName("emp:address");
+ testAddr = (Element) elementList.item(0);
+ testAddr.removeAttributeNS(namespaceURI, localName);
+ attrValue = testAddr.getAttributeNS(namespaceURI, localName);
+ assertEquals("throw_Equals", "", attrValue);
+
+ }
+
+ /**
+ * 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/getAttributeNS03";
+ }
+
+}
Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/getAttributeNS04.java
URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/getAttributeNS04.java?rev=1896456&view=auto
==============================================================================
--- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/getAttributeNS04.java (added)
+++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/getAttributeNS04.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.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.w3c.domts.DOMTestCase;
+
+import static org.junit.Assert.assertEquals;
+
+
+/**
+ * The "getAttributeNS(namespaceURI,localName)" method retrieves an
+ * attribute value by local name and NamespaceURI.
+ * <p>
+ * Retrieve the first "emp:address" element.
+ * Create a new attribute with the "createAttributeNS()" method.
+ * Add the new attribute and value with the "setAttributeNS()" method.
+ * The value returned by the "getAttributeNS()" method should be
+ * the string "NewValue" since the attribute had a specified value.
+ *
+ * @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 getAttributeNS04 extends DOMTestCase {
+ @Test
+ public void testRun() throws Throwable {
+ String namespaceURI = "http://www.nist.gov";
+ String localName = "blank";
+ String qualifiedName = "emp:blank";
+ Document doc;
+ Attr newAttribute;
+ NodeList elementList;
+ Element testAddr;
+ Attr districtAttr;
+ String attrValue;
+ doc = load("staffNS", true);
+ newAttribute = doc.createAttributeNS(namespaceURI, qualifiedName);
+ elementList = doc.getElementsByTagName("emp:address");
+ testAddr = (Element) elementList.item(0);
+ testAddr.setAttributeNS(namespaceURI, qualifiedName, "NewValue");
+ attrValue = testAddr.getAttributeNS(namespaceURI, localName);
+ assertEquals("throw_Equals", "NewValue", attrValue);
+
+ }
+
+ /**
+ * 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/getAttributeNS04";
+ }
+
+}
Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/getAttributeNS05.java
URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/getAttributeNS05.java?rev=1896456&view=auto
==============================================================================
--- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/getAttributeNS05.java (added)
+++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/getAttributeNS05.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.Test;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.w3c.domts.DOMTestCase;
+
+import static org.junit.Assert.assertEquals;
+
+
+/**
+ * The "getAttributeNS(namespaceURI,localName)" method retrieves an
+ * attribute value by local name and NamespaceURI.
+ * <p>
+ * Retrieve the first emp:address element node
+ * and retrieve the emp:domestic attribute. The method returns an
+ * Attr value as a string, the "value" can be examined to ensure the
+ * proper attribute value was retrieved.
+ *
+ * @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 getAttributeNS05 extends DOMTestCase {
+ @Test
+ public void testRun() throws Throwable {
+ Document doc;
+ NodeList elementList;
+ Element testAddr;
+ String attrValue;
+ doc = load("staffNS", false);
+ elementList = doc.getElementsByTagName("emp:address");
+ testAddr = (Element) elementList.item(0);
+ attrValue = testAddr.getAttributeNS("http://www.nist.gov", "domestic");
+ assertEquals("attrValue", "Yes", attrValue);
+
+ }
+
+ /**
+ * 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/getAttributeNS05";
+ }
+
+}
Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/getAttributeNodeNS01.java
URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/getAttributeNodeNS01.java?rev=1896456&view=auto
==============================================================================
--- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/getAttributeNodeNS01.java (added)
+++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/getAttributeNodeNS01.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.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.w3c.domts.DOMTestCase;
+
+import static org.junit.Assert.assertNull;
+
+
+/**
+ * The "getAttributeNodeNS(namespaceURI,localName)" method retrieves an
+ * attribute node by local name and NamespaceURI.
+ * <p>
+ * Retrieve the first emp:address element node.
+ * The getAttributeNodeNS method returns an
+ * Attr node, the "value" can be examined to ensure the
+ * proper attribute node was retrieved. This attribute
+ * value should be null since there is no such attribute.
+ *
+ * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElGetAtNodeNS">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElGetAtNodeNS</a>
+ */
+public class getAttributeNodeNS01 extends DOMTestCase {
+ @Test
+ public void testRun() throws Throwable {
+ String namespaceURI = "http://www.nist.gov";
+ String localName = "invalidlocalname";
+ Document doc;
+ NodeList elementList;
+ Element testAddr;
+ Attr attribute;
+ doc = load("staffNS", false);
+ elementList = doc.getElementsByTagName("emp:address");
+ testAddr = (Element) elementList.item(0);
+ attribute = testAddr.getAttributeNodeNS(namespaceURI, localName);
+ assertNull("throw_Null", attribute);
+
+ }
+
+ /**
+ * 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/getAttributeNodeNS01";
+ }
+
+}
Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/getAttributeNodeNS02.java
URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/getAttributeNodeNS02.java?rev=1896456&view=auto
==============================================================================
--- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/getAttributeNodeNS02.java (added)
+++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/getAttributeNodeNS02.java Mon Dec 27 20:28:38 2021
@@ -0,0 +1,72 @@
+/*
+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.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.w3c.domts.DOMTestCase;
+
+import static org.junit.Assert.assertEquals;
+
+
+/**
+ * The "getAttributeNodeNS(namespaceURI,localName)" method retrieves an
+ * attribute node by local name and NamespaceURI.
+ * <p>
+ * Retrieve the first emp:address element node.
+ * The getAttributeNodeNS method returns an
+ * Attr node, the "value" can be examined to ensure the
+ * proper attribute node was retrieved.
+ *
+ * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-F68D095">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-F68D095</a>
+ */
+public class getAttributeNodeNS02 extends DOMTestCase {
+ @Test
+ public void testRun() throws Throwable {
+ Document doc;
+ NodeList elementList;
+ Element testAddr;
+ Attr attribute;
+ String attrName;
+ doc = load("staffNS", false);
+ elementList = doc.getElementsByTagName("emp:address");
+ testAddr = (Element) elementList.item(0);
+ attribute = testAddr.getAttributeNodeNS("http://www.nist.gov", "domestic");
+ attrName = attribute.getNodeName();
+ assertEquals("attrName", "emp:domestic", attrName);
+
+ }
+
+ /**
+ * 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/getAttributeNodeNS02";
+ }
+
+}
Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/getElementById01.java
URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/getElementById01.java?rev=1896456&view=auto
==============================================================================
--- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/getElementById01.java (added)
+++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/getElementById01.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-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.Document;
+import org.w3c.dom.Element;
+import org.w3c.domts.DOMTestCase;
+
+import static org.junit.Assert.assertEquals;
+
+
+/**
+ * The "getElementById(elementId)" method for a
+ * Document should return an element whose ID matches elementId.
+ * Invoke method getElementById(elementId) on this document
+ * with elementId equals "CANADA". Method should return an element
+ * whose tag name is "emp:address".
+ *
+ * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-104682815">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-104682815</a>
+ * @see <a href="http://www.w3.org/Bugs/Public/show_bug.cgi?id=383">http://www.w3.org/Bugs/Public/show_bug.cgi?id=383</a>
+ */
+public class getElementById01 extends DOMTestCase {
+ @Test
+ @Ignore
+ public void testRun() throws Throwable {
+ Document doc;
+ Element element;
+ String tagname;
+ doc = load("staffNS", false);
+ element = doc.getElementById("CANADA");
+ tagname = element.getTagName();
+ assertEquals("throw_Equals", "emp:address", tagname);
+
+ }
+
+ /**
+ * 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/getElementById01";
+ }
+
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org