Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodegetownerdocument01.java URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodegetownerdocument01.java?rev=1896456&view=auto ============================================================================== --- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodegetownerdocument01.java (added) +++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodegetownerdocument01.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-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.DOMImplementation; +import org.w3c.dom.Document; +import org.w3c.dom.DocumentType; +import org.w3c.domts.DOMTestCase; + +import static org.junit.Assert.assertNull; + + +/** + * The method getOwnerDocument returns the Document object associated with this node + * Create a new DocumentType node. Since this node is not used with any Document yet + * verify if the ownerDocument is null. + * + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#node-ownerDoc">http://www.w3.org/TR/DOM-Level-2-Core/core#node-ownerDoc</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> + */ + + +/** + * restore when doctype + */ +public class nodegetownerdocument01 extends DOMTestCase { + @Test + @Ignore + public void testRun() throws Throwable { + Document doc; + Document ownerDoc; + DOMImplementation domImpl; + DocumentType docType; + String nullID = null; + + doc = load("staff", false); + domImpl = doc.getImplementation(); + docType = domImpl.createDocumentType("mydoc", nullID, nullID); + ownerDoc = docType.getOwnerDocument(); + assertNull("nodegetownerdocument01", ownerDoc); + + } + + /** + * 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/nodegetownerdocument01"; + } + +}
Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodegetownerdocument02.java URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodegetownerdocument02.java?rev=1896456&view=auto ============================================================================== --- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodegetownerdocument02.java (added) +++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodegetownerdocument02.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.DOMImplementation; +import org.w3c.dom.Document; +import org.w3c.dom.DocumentType; +import org.w3c.dom.Element; +import org.w3c.domts.DOMTestCase; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; + + +/** + * The method getOwnerDocument returns the Document object associated with this node + * Create a new Document node. Since this node is not used with any Document yet + * verify if the ownerDocument is null. Create a new element Node on the new Document + * object. Check the ownerDocument of the new element node. + * + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#node-ownerDoc">http://www.w3.org/TR/DOM-Level-2-Core/core#node-ownerDoc</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> + */ +//TODO: fix when Doctypes +public class nodegetownerdocument02 extends DOMTestCase { + @Test + public void testRun() throws Throwable { + Document doc; + Document newDoc; + Element newElem; + Document ownerDocDoc; + Document ownerDocElem; + DOMImplementation domImpl; + DocumentType docType; + String nullNS = null; + + doc = load("staff", false); + domImpl = doc.getImplementation(); + docType = null;// domImpl.createDocumentType("mydoc", nullNS, nullNS); + newDoc = domImpl.createDocument("http://www.w3.org/DOM/Test", "mydoc", docType); + ownerDocDoc = newDoc.getOwnerDocument(); + assertNull("nodegetownerdocument02_1", ownerDocDoc); + newElem = newDoc.createElementNS("http://www.w3.org/DOM/Test", "myelem"); + ownerDocElem = newElem.getOwnerDocument(); + assertNotNull("nodegetownerdocument02_2", ownerDocElem); + + } + + /** + * 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/nodegetownerdocument02"; + } + +} Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodegetprefix03.java URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodegetprefix03.java?rev=1896456&view=auto ============================================================================== --- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodegetprefix03.java (added) +++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodegetprefix03.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.Document; +import org.w3c.dom.Element; +import org.w3c.domts.DOMTestCase; + +import static org.junit.Assert.assertEquals; + + +/** + * The method getPrefix returns the namespace prefix of this node, or null if it is unspecified. + * Ceate two new element nodes and atribute nodes, with and without namespace prefixes. + * Retreive the prefix part of their qualified names using getPrefix and verify + * if it is correct. + * + * @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 nodegetprefix03 extends DOMTestCase { + @Test + public void testRun() throws Throwable { + Document doc; + Element element; + Element qelement; + Attr attr; + Attr qattr; + String elemNoPrefix; + String elemPrefix; + String attrNoPrefix; + String attrPrefix; + doc = load("staff", false); + element = doc.createElementNS("http://www.w3.org/DOM/Test/elem", "elem"); + qelement = doc.createElementNS("http://www.w3.org/DOM/Test/elem", "qual:qelem"); + attr = doc.createAttributeNS("http://www.w3.org/DOM/Test/attr", "attr"); + qattr = doc.createAttributeNS("http://www.w3.org/DOM/Test/attr", "qual:qattr"); + elemNoPrefix = element.getPrefix(); + elemPrefix = qelement.getPrefix(); + attrNoPrefix = attr.getPrefix(); + attrPrefix = qattr.getPrefix(); + assertEquals("nodegetprefix03_1", "", elemNoPrefix); + assertEquals("nodegetprefix03_2", "qual", elemPrefix); + assertEquals("nodegetprefix03_3", "", attrNoPrefix); + assertEquals("nodegetprefix03_4", "qual", attrPrefix); + + } + + /** + * 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/nodegetprefix03"; + } + +} Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodehasattributes01.java URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodehasattributes01.java?rev=1896456&view=auto ============================================================================== --- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodehasattributes01.java (added) +++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodehasattributes01.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.Document; +import org.w3c.dom.Element; +import org.w3c.dom.NodeList; +import org.w3c.domts.DOMTestCase; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + + +/** + * The method hasAttributes returns whether this node (if it is an element) has any attributes. + * Retreive an element node without attributes. Verify if hasAttributes returns false. + * Retreive another element node with attributes. Verify if hasAttributes 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 nodehasattributes01 extends DOMTestCase { + @Test + public void testRun() throws Throwable { + Document doc; + Element element; + NodeList elementList; + boolean hasAttributes; + doc = load("staff", false); + elementList = doc.getElementsByTagName("employee"); + element = (Element) elementList.item(0); + hasAttributes = element.hasAttributes(); + assertFalse("nodehasattributes01_1", hasAttributes); + elementList = doc.getElementsByTagName("address"); + element = (Element) elementList.item(0); + hasAttributes = element.hasAttributes(); + assertTrue("nodehasattributes01_2", hasAttributes); + + } + + /** + * 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/nodehasattributes01"; + } + +} Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodehasattributes02.java URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodehasattributes02.java?rev=1896456&view=auto ============================================================================== --- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodehasattributes02.java (added) +++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodehasattributes02.java Mon Dec 27 20:28:38 2021 @@ -0,0 +1,65 @@ +/* +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.assertFalse; + + +/** + * The method hasAttributes returns whether this node (if it is an element) has any attributes. + * <p> + * Retrieve the docType node. Since this is not an element node check if hasAttributes returns + * null. + * + * @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 nodehasattributes02 extends DOMTestCase { + @Test + @Ignore + public void testRun() throws Throwable { + Document doc; + DocumentType docType; + boolean hasAttributes; + doc = load("staffNS", false); + docType = doc.getDoctype(); + hasAttributes = docType.hasAttributes(); + assertFalse("nodehasattributes02", hasAttributes); + + } + + /** + * 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/nodehasattributes02"; + } + +} Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodehasattributes03.java URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodehasattributes03.java?rev=1896456&view=auto ============================================================================== --- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodehasattributes03.java (added) +++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodehasattributes03.java Mon Dec 27 20:28:38 2021 @@ -0,0 +1,64 @@ +/* +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 hasAttributes returns whether this node (if it is an element) has any attributes. + * Retreive an element node with a default attributes. Verify if hasAttributes 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 nodehasattributes03 extends DOMTestCase { + @Test + public void testRun() throws Throwable { + Document doc; + Element element; + NodeList elementList; + boolean hasAttributes; + doc = load("staffNS", false); + elementList = doc.getElementsByTagName("emp:employee"); + element = (Element) elementList.item(0); + hasAttributes = element.hasAttributes(); + assertTrue("nodehasattributes03", hasAttributes); + + } + + /** + * 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/nodehasattributes03"; + } + +} Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodehasattributes04.java URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodehasattributes04.java?rev=1896456&view=auto ============================================================================== --- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodehasattributes04.java (added) +++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodehasattributes04.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 method hasAttributes returns whether this node (if it is an element) has any attributes. + * Create a new Document, Element and Attr node. Add the Attr to the Element and append the + * Element to the Document. Retreive the newly created element node from the document and check + * if it has attributes using hasAttributes. + * + * @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 nodehasattributes04 extends DOMTestCase { + @Test + public void testRun() throws Throwable { + Document doc; + Document newDoc; + DocumentType docType = null; + + DOMImplementation domImpl; + Element element; + Element elementTest; + Element elementDoc; + Attr attribute; + Node setNode; + Node appendedChild; + NodeList elementList; + boolean hasAttributes; + doc = load("staffNS", false); + domImpl = doc.getImplementation(); + newDoc = domImpl.createDocument("http://www.w3.org/DOM/Test", "test", docType); + element = newDoc.createElementNS("http://www.w3.org/DOM/Test", "dom:elem"); + attribute = newDoc.createAttribute("attr"); + setNode = element.setAttributeNode(attribute); + elementDoc = newDoc.getDocumentElement(); + appendedChild = elementDoc.appendChild(element); + elementList = newDoc.getElementsByTagNameNS("http://www.w3.org/DOM/Test", "elem"); + elementTest = (Element) elementList.item(0); + hasAttributes = elementTest.hasAttributes(); + assertTrue("nodehasattributes04", hasAttributes); + + } + + /** + * 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/nodehasattributes04"; + } + +} Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodeissupported01.java URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodeissupported01.java?rev=1896456&view=auto ============================================================================== --- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodeissupported01.java (added) +++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodeissupported01.java Mon Dec 27 20:28:38 2021 @@ -0,0 +1,91 @@ +/* +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.Document; +import org.w3c.dom.Element; +import org.w3c.domts.DOMTestCase; + +import static org.junit.Assert.assertTrue; + + +/** + * The method "isSupported(feature,version)" Tests whether the DOM implementation + * implements a specific feature and that feature is supported by this node. + * Call the isSupported method on the document element node with a combination of features + * versions and versions as below. Valid feature names are case insensitive and versions + * "2.0", "1.0" and if the version is not specified, supporting any version of the feature + * should return true. Check if the value returned value was true. + * + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-Node-supports">http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-Node-supports</a> + */ +public class nodeissupported01 extends DOMTestCase { + @Test + public void testRun() throws Throwable { + Document doc; + Element element; + String version = ""; + String version1 = "1.0"; + String version2 = "2.0"; + String featureCore; + String featureXML; + boolean success; + java.util.List featuresXML = new java.util.ArrayList(); + featuresXML.add("XML"); + featuresXML.add("xmL"); + + java.util.List featuresCore = new java.util.ArrayList(); + featuresCore.add("Core"); + featuresCore.add("CORE"); + + doc = load("staffNS", false); + element = doc.getDocumentElement(); + for (int indexd513e63 = 0; indexd513e63 < featuresXML.size(); indexd513e63++) { + featureXML = (String) featuresXML.get(indexd513e63); + success = element.isSupported(featureXML, version); + assertTrue("nodeissupported01_XML1", success); + success = element.isSupported(featureXML, version1); + assertTrue("nodeissupported01_XML2", success); + } + for (int indexd513e74 = 0; indexd513e74 < featuresCore.size(); indexd513e74++) { + featureCore = (String) featuresCore.get(indexd513e74); + success = element.isSupported(featureCore, version); + assertTrue("nodeissupported01_Core1", success); + success = element.isSupported(featureCore, version1); + success = element.isSupported(featureCore, version2); + assertTrue("nodeissupported01_Core3", 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/nodeissupported01"; + } + +} Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodeissupported02.java URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodeissupported02.java?rev=1896456&view=auto ============================================================================== --- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodeissupported02.java (added) +++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodeissupported02.java Mon Dec 27 20:28:38 2021 @@ -0,0 +1,91 @@ +/* +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.domts.DOMTestCase; + +import static org.junit.Assert.assertTrue; + + +/** + * The method "isSupported(feature,version)" Tests whether the DOM implementation + * implements a specific feature and that feature is supported by this node. + * Call the isSupported method on a new attribute node with a combination of features + * versions and versions as below. Valid feature names are case insensitive and versions + * "2.0", "1.0" and if the version is not specified, supporting any version of the feature + * should return true. Check if the value returned value was true. + * + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-Node-supports">http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-Node-supports</a> + */ +public class nodeissupported02 extends DOMTestCase { + @Test + public void testRun() throws Throwable { + Document doc; + Attr attribute; + String version = ""; + String version1 = "1.0"; + String version2 = "2.0"; + String featureCore; + String featureXML; + boolean success; + java.util.List featuresXML = new java.util.ArrayList(); + featuresXML.add("XML"); + featuresXML.add("xmL"); + + java.util.List featuresCore = new java.util.ArrayList(); + featuresCore.add("Core"); + featuresCore.add("CORE"); + + doc = load("staffNS", false); + attribute = doc.createAttribute("TestAttr"); + for (int indexd514e63 = 0; indexd514e63 < featuresXML.size(); indexd514e63++) { + featureXML = (String) featuresXML.get(indexd514e63); + success = attribute.isSupported(featureXML, version); + assertTrue("nodeissupported02_XML1", success); + success = attribute.isSupported(featureXML, version1); + assertTrue("nodeissupported02_XML2", success); + } + for (int indexd514e74 = 0; indexd514e74 < featuresCore.size(); indexd514e74++) { + featureCore = (String) featuresCore.get(indexd514e74); + success = attribute.isSupported(featureCore, version); + assertTrue("nodeissupported02_Core1", success); + success = attribute.isSupported(featureCore, version1); + success = attribute.isSupported(featureCore, version2); + assertTrue("nodeissupported02_Core3", 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/nodeissupported02"; + } + +} Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodeissupported03.java URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodeissupported03.java?rev=1896456&view=auto ============================================================================== --- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodeissupported03.java (added) +++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodeissupported03.java Mon Dec 27 20:28:38 2021 @@ -0,0 +1,66 @@ +/* +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.assertFalse; + + +/** + * The method "isSupported(feature,version)" Tests whether the DOM implementation + * implements a specific feature and that feature is supported by this node. + * <p> + * Call the isSupported method specifying empty strings for feature and version on a docType + * Node. Check if the value returned value was false. + * + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-Node-supports">http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-Node-supports</a> + */ +public class nodeissupported03 extends DOMTestCase { + @Test + @Ignore + public void testRun() throws Throwable { + Document doc; + DocumentType docType; + boolean success; + doc = load("staffNS", false); + docType = doc.getDoctype(); + success = docType.isSupported("", ""); + assertFalse("nodeissupported03", 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/nodeissupported03"; + } + +} Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodeissupported04.java URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodeissupported04.java?rev=1896456&view=auto ============================================================================== --- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodeissupported04.java (added) +++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodeissupported04.java Mon Dec 27 20:28:38 2021 @@ -0,0 +1,66 @@ +/* +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.EntityReference; +import org.w3c.domts.DOMTestCase; + +import static org.junit.Assert.assertFalse; + + +/** + * The method "isSupported(feature,version)" Tests whether the DOM implementation + * implements a specific feature and that feature is supported by this node. + * <p> + * Call the isSupported method specifying empty strings for feature and version on a + * new EntityReference node. Check if the value returned value was false. + * + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-Node-supports">http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-Node-supports</a> + */ +public class nodeissupported04 extends DOMTestCase { + @Test + @Ignore + public void testRun() throws Throwable { + Document doc; + EntityReference entRef; + boolean success; + doc = load("staffNS", false); + entRef = doc.createEntityReference("ent1"); + success = entRef.isSupported("XML CORE", ""); + assertFalse("nodeissupported04", 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/nodeissupported04"; + } + +} Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodeissupported05.java URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodeissupported05.java?rev=1896456&view=auto ============================================================================== --- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodeissupported05.java (added) +++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodeissupported05.java Mon Dec 27 20:28:38 2021 @@ -0,0 +1,64 @@ +/* +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.ProcessingInstruction; +import org.w3c.domts.DOMTestCase; + +import static org.junit.Assert.assertFalse; + + +/** + * The method "isSupported(feature,version)" Tests whether the DOM implementation + * implements a specific feature and that feature is supported by this node. + * <p> + * Call the isSupported method specifying bad values for feature and version on a new + * Processing Instruction node. Check if the value returned from this method value was false. + * + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-Node-supports">http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-Node-supports</a> + */ +public class nodeissupported05 extends DOMTestCase { + @Test + public void testRun() throws Throwable { + Document doc; + ProcessingInstruction pi; + boolean success; + doc = load("staffNS", false); + pi = doc.createProcessingInstruction("PITarget", "PIData"); + success = pi.isSupported("-", "+"); + assertFalse("nodeissupported05", 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/nodeissupported05"; + } + +} Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodenormalize01.java URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodenormalize01.java?rev=1896456&view=auto ============================================================================== --- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodenormalize01.java (added) +++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodenormalize01.java Mon Dec 27 20:28:38 2021 @@ -0,0 +1,166 @@ +/* +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; + + +/** + * The method "normalize" puts all Text nodes in the full depth of the sub-tree underneath + * this Node, including attribute nodes, into a "normal" form where only structure + * (e.g., elements, comments, processing instructions, CDATA sections, and entity references) + * separates Text nodes, i.e., there are neither adjacent Text nodes nor empty Text nodes. + * Create a dom tree consisting of elements, comments, processing instructions, CDATA sections, + * and entity references nodes seperated by text nodes. Check the length of the node list of each + * before and after normalize has been called. + * + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-normalize">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-normalize</a> + */ +public class nodenormalize01 extends DOMTestCase { + @Test + @Ignore("entity reference") + public void testRun() throws Throwable { + Document doc; + Document newDoc; + DOMImplementation domImpl; + DocumentType docType; + DocumentType docTypeNull = null; + + Element documentElement; + Element element1; + Element element2; + Element element3; + Element element4; + Element element5; + Element element6; + Element element7; + Text text1; + Text text2; + Text text3; + ProcessingInstruction pi; + CDATASection cData; + Comment comment; + EntityReference entRef; + NodeList elementList; + Node appendedChild; + doc = load("staffNS", true); + domImpl = doc.getImplementation(); + newDoc = domImpl.createDocument("http://www.w3.org/DOM/Test", "dom:root", docTypeNull); + element1 = newDoc.createElement("element1"); + element2 = newDoc.createElement("element2"); + element3 = newDoc.createElement("element3"); + element4 = newDoc.createElement("element4"); + element5 = newDoc.createElement("element5"); + element6 = newDoc.createElement("element6"); + element7 = newDoc.createElement("element7"); + text1 = newDoc.createTextNode("text1"); + text2 = newDoc.createTextNode("text2"); + text3 = newDoc.createTextNode("text3"); + cData = newDoc.createCDATASection("Cdata"); + comment = newDoc.createComment("comment"); + pi = newDoc.createProcessingInstruction("PITarget", "PIData"); + entRef = newDoc.createEntityReference("EntRef"); + documentElement = newDoc.getDocumentElement(); + appendedChild = documentElement.appendChild(element1); + appendedChild = element2.appendChild(text1); + appendedChild = element2.appendChild(text2); + appendedChild = element2.appendChild(text3); + appendedChild = element1.appendChild(element2); + text1 = (Text) text1.cloneNode(false); + text2 = (Text) text2.cloneNode(false); + appendedChild = element3.appendChild(entRef); + appendedChild = element3.appendChild(text1); + appendedChild = element3.appendChild(text2); + appendedChild = element1.appendChild(element3); + text1 = (Text) text1.cloneNode(false); + text2 = (Text) text2.cloneNode(false); + appendedChild = element4.appendChild(cData); + appendedChild = element4.appendChild(text1); + appendedChild = element4.appendChild(text2); + appendedChild = element1.appendChild(element4); + text2 = (Text) text2.cloneNode(false); + text3 = (Text) text3.cloneNode(false); + appendedChild = element5.appendChild(comment); + appendedChild = element5.appendChild(text2); + appendedChild = element5.appendChild(text3); + appendedChild = element1.appendChild(element5); + text2 = (Text) text2.cloneNode(false); + text3 = (Text) text3.cloneNode(false); + appendedChild = element6.appendChild(pi); + appendedChild = element6.appendChild(text2); + appendedChild = element6.appendChild(text3); + appendedChild = element1.appendChild(element6); + entRef = (EntityReference) entRef.cloneNode(false); + text1 = (Text) text1.cloneNode(false); + text2 = (Text) text2.cloneNode(false); + text3 = (Text) text3.cloneNode(false); + appendedChild = element7.appendChild(entRef); + appendedChild = element7.appendChild(text1); + appendedChild = element7.appendChild(text2); + appendedChild = element7.appendChild(text3); + appendedChild = element1.appendChild(element7); + elementList = element1.getChildNodes(); + assertSize("nodeNormalize01_1Bef", 6, elementList); + elementList = element2.getChildNodes(); + assertSize("nodeNormalize01_2Bef", 3, elementList); + elementList = element3.getChildNodes(); + assertSize("nodeNormalize01_3Bef", 3, elementList); + elementList = element4.getChildNodes(); + assertSize("nodeNormalize01_4Bef", 3, elementList); + elementList = element5.getChildNodes(); + assertSize("nodeNormalize01_5Bef", 3, elementList); + elementList = element6.getChildNodes(); + assertSize("nodeNormalize01_6Bef", 3, elementList); + elementList = element7.getChildNodes(); + assertSize("nodeNormalize01_7Bef", 4, elementList); + newDoc.normalize(); + elementList = element1.getChildNodes(); + assertSize("nodeNormalize01_1Aft", 6, elementList); + elementList = element2.getChildNodes(); + assertSize("nodeNormalize01_2Aft", 1, elementList); + elementList = element3.getChildNodes(); + assertSize("nodeNormalize01_3Aft", 2, elementList); + elementList = element4.getChildNodes(); + assertSize("nodeNormalize01_4Aft", 2, elementList); + elementList = element5.getChildNodes(); + assertSize("nodeNormalize01_5Aft", 2, elementList); + elementList = element6.getChildNodes(); + assertSize("nodeNormalize01_6Aft", 2, elementList); + elementList = element7.getChildNodes(); + assertSize("nodeNormalize01_7Aft", 2, elementList); + + } + + /** + * 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/nodenormalize01"; + } + +} Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodesetprefix01.java URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodesetprefix01.java?rev=1896456&view=auto ============================================================================== --- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodesetprefix01.java (added) +++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodesetprefix01.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 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.DocumentFragment; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.domts.DOMTestCase; + +import static org.junit.Assert.assertEquals; + + +/** + * The method setPrefix sets the namespace prefix of this node. Note that setting this attribute, + * when permitted, changes the nodeName attribute, which holds the qualified name, as well as the + * tagName and name attributes of the Element and Attr interfaces, when applicable. + * Create a new element node with a namespace prefix. Add it to a new DocumentFragment Node without + * a prefix. Call setPrefix on the elemen node. Check if the prefix was set correctly on the element. + * + * @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 nodesetprefix01 extends DOMTestCase { + @Test + public void testRun() throws Throwable { + Document doc; + DocumentFragment docFragment; + Element element; + String elementTagName; + String elementNodeName; + Node appendedChild; + doc = load("staff", true); + docFragment = doc.createDocumentFragment(); + element = doc.createElementNS("http://www.w3.org/DOM/Test", "emp:address"); + appendedChild = docFragment.appendChild(element); + element.setPrefix("dmstc"); + elementTagName = element.getTagName(); + elementNodeName = element.getNodeName(); + assertEquals("nodesetprefix01_tagname", "dmstc:address", elementTagName); + assertEquals("nodesetprefix01_nodeName", "dmstc:address", elementNodeName); + + } + + /** + * 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/nodesetprefix01"; + } + +} Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodesetprefix02.java URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodesetprefix02.java?rev=1896456&view=auto ============================================================================== --- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodesetprefix02.java (added) +++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodesetprefix02.java Mon Dec 27 20:28:38 2021 @@ -0,0 +1,77 @@ +/* +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 method setPrefix sets the namespace prefix of this node. Note that setting this attribute, + * when permitted, changes the nodeName attribute, which holds the qualified name, as well as the + * tagName and name attributes of the Element and Attr interfaces, when applicable. + * Create a new attribute node and add it to an element node with an existing attribute having + * the same localName as this attribute but different namespaceURI. Change the prefix of the + * newly created attribute using setPrefix. Check if the new attribute nodeName has changed + * and the existing attribute is the same. + * + * @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 nodesetprefix02 extends DOMTestCase { + @Test + public void testRun() throws Throwable { + Document doc; + Element element; + Attr attribute; + Attr newAttribute; + Node setNode; + NodeList elementList; + String attrName; + String newAttrName; + doc = load("staffNS", true); + elementList = doc.getElementsByTagName("address"); + element = (Element) elementList.item(1); + newAttribute = doc.createAttributeNS("http://www.w3.org/DOM/Test", "test:address"); + setNode = element.setAttributeNodeNS(newAttribute); + newAttribute.setPrefix("dom"); + attribute = element.getAttributeNodeNS("http://www.usa.com", "domestic"); + attrName = attribute.getNodeName(); + newAttrName = newAttribute.getNodeName(); + assertEquals("nodesetprefix02_attrName", "dmstc:domestic", attrName); + assertEquals("nodesetprefix02_newAttrName", "dom:address", newAttrName); + + } + + /** + * 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/nodesetprefix02"; + } + +} Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodesetprefix03.java URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodesetprefix03.java?rev=1896456&view=auto ============================================================================== --- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodesetprefix03.java (added) +++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodesetprefix03.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.DOMException; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.domts.DOMTestCase; + +import static org.junit.Assert.assertTrue; + + +/** + * The method setPrefix raises a NAMESPACE_ERR if the namespaceURI of this node is null. + * Create a new element node without a namespace prefix. Call setPrefix on the newly created elemenent node. + * Check if a NAMESPACE_ERR is thrown. + * + * @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 nodesetprefix03 extends DOMTestCase { + @Test + public void testRun() throws Throwable { + Document doc; + Element element; + doc = load("staffNS", true); + element = doc.createElement("address"); + + { + boolean success = false; + try { + element.setPrefix("test"); + } catch (DOMException ex) { + success = (ex.code == DOMException.NAMESPACE_ERR); + } + assertTrue("nodesetprefix03", 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/nodesetprefix03"; + } + +} Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodesetprefix04.java URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodesetprefix04.java?rev=1896456&view=auto ============================================================================== --- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodesetprefix04.java (added) +++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodesetprefix04.java Mon Dec 27 20:28:38 2021 @@ -0,0 +1,77 @@ +/* +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.assertTrue; + + +/** + * The method setPrefix raises a NAMESPACE_ERR if the namespaceURI of this node is null. + * Retreive the a default Attribute node which does not have a namespace prefix. Call the setPrefix + * method on it. Check if a NAMESPACE_ERR is thrown. + * + * @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/Bugs/Public/show_bug.cgi?id=259">http://www.w3.org/Bugs/Public/show_bug.cgi?id=259</a> + */ +public class nodesetprefix04 extends DOMTestCase { + @Test + @Ignore + public void testRun() throws Throwable { + Document doc; + Element element; + Attr attribute; + NodeList elementList; + String nullNS = null; + + doc = load("staffNS", true); + elementList = doc.getElementsByTagName("emp:employee"); + element = (Element) elementList.item(0); + attribute = element.getAttributeNodeNS(nullNS, "defaultAttr"); + + { + boolean success = false; + try { + attribute.setPrefix("test"); + } catch (DOMException ex) { + success = (ex.code == DOMException.NAMESPACE_ERR); + } + assertTrue("nodesetprefix04", 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/nodesetprefix04"; + } + +} Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodesetprefix05.java URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodesetprefix05.java?rev=1896456&view=auto ============================================================================== --- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodesetprefix05.java (added) +++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodesetprefix05.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.Element; +import org.w3c.domts.DOMTestCase; + +import static org.junit.Assert.assertTrue; + + +/** + * The method setPrefix raises a NAMESPACE_ERR if the specified prefix is malformed. + * Create a new namespace aware element node and call the setPrefix method on it with several malformed + * prefix values. Check if a NAMESPACE_ERR is thrown. + * + * @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 nodesetprefix05 extends DOMTestCase { + @Test + public void testRun() throws Throwable { + Document doc; + Element element; + String prefixValue; + java.util.List prefixValues = new java.util.ArrayList(); + prefixValues.add("_:"); + prefixValues.add(":0"); + prefixValues.add(":"); + prefixValues.add("_::"); + prefixValues.add("a:0:c"); + + doc = load("staffNS", true); + element = doc.createElementNS("http://www.w3.org/DOM/Test/L2", "dom:elem"); + for (int indexd523e55 = 0; indexd523e55 < prefixValues.size(); indexd523e55++) { + prefixValue = (String) prefixValues.get(indexd523e55); + + { + boolean success = false; + try { + element.setPrefix(prefixValue); + } catch (DOMException ex) { + success = (ex.code == DOMException.NAMESPACE_ERR); + } + assertTrue("nodesetprefix05", 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/nodesetprefix05"; + } + +} Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodesetprefix06.java URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodesetprefix06.java?rev=1896456&view=auto ============================================================================== --- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodesetprefix06.java (added) +++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodesetprefix06.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.DOMException; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.domts.DOMTestCase; + +import static org.junit.Assert.assertTrue; + + +/** + * The method setPrefix raises a NAMESPACE_ERR if the specified prefix is "xml" and the namespaceURI + * of this node is different from "http://www.w3.org/XML/1998/namespace". + * Invoke the setPrefix method on this Element object with namespaceURI that is different from + * http://www..w3.org/xml/1998/namespace and a prefix whose values is xml. + * Check if the NAMESPACE_ERR was thrown. + * + * @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 nodesetprefix06 extends DOMTestCase { + @Test + public void testRun() throws Throwable { + Document doc; + Element element; + doc = load("staffNS", true); + element = doc.createElementNS("http://www.w3.org/DOM/Test/L2", "dom:elem"); + + { + boolean success = false; + try { + element.setPrefix("xml"); + } catch (DOMException ex) { + success = (ex.code == DOMException.NAMESPACE_ERR); + } + assertTrue("elementsetattributens06", 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/nodesetprefix06"; + } + +} Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodesetprefix07.java URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodesetprefix07.java?rev=1896456&view=auto ============================================================================== --- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodesetprefix07.java (added) +++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodesetprefix07.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.DOMException; +import org.w3c.dom.Document; +import org.w3c.domts.DOMTestCase; + +import static org.junit.Assert.assertTrue; + + +/** + * The method setPrefix raises a NAMESPACE_ERR if this node is an attribute and the specified + * prefix is "xmlns" and the namespaceURI of this node is different from + * "http://www.w3.org/2000/xmlns/". + * Create a new attribute node whose namespaceURI is different form "http://www.w3.org/2000/xmlns/" + * and node prefix is "xmlns". + * Check if the NAMESPACE_ERR was thrown. + * + * @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 nodesetprefix07 extends DOMTestCase { + @Test + public void testRun() throws Throwable { + Document doc; + Attr attribute; + doc = load("staffNS", true); + attribute = doc.createAttributeNS("http://www.w3.org/DOM/Test/L2", "abc:elem"); + + { + boolean success = false; + try { + attribute.setPrefix("xmlns"); + } catch (DOMException ex) { + success = (ex.code == DOMException.NAMESPACE_ERR); + } + assertTrue("nodesetprefix07", 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/nodesetprefix07"; + } + +} Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodesetprefix08.java URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodesetprefix08.java?rev=1896456&view=auto ============================================================================== --- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodesetprefix08.java (added) +++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodesetprefix08.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.*; +import org.w3c.domts.DOMTestCase; + +import static org.junit.Assert.assertTrue; + + +/** + * The method setPrefix raises a NAMESPACE_ERR if this node is an attribute and the qualifiedName + * of this node is "xmlns + * Retreive an attribute node whose qualifiedName is xmlns. Try setting a prefix on this node. + * Check if the NAMESPACE_ERR was thrown. + * + * @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 nodesetprefix08 extends DOMTestCase { + @Test + public void testRun() throws Throwable { + Document doc; + Element element; + NodeList elementList; + Attr attribute; + doc = load("staffNS", true); + elementList = doc.getElementsByTagName("employee"); + element = (Element) elementList.item(0); + attribute = element.getAttributeNode("xmlns"); + + { + boolean success = false; + try { + attribute.setPrefix("xml"); + } catch (DOMException ex) { + success = (ex.code == DOMException.NAMESPACE_ERR); + } + assertTrue("nodesetprefix08", 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/nodesetprefix08"; + } + +} Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodesetprefix09.java URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodesetprefix09.java?rev=1896456&view=auto ============================================================================== --- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodesetprefix09.java (added) +++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/nodesetprefix09.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.DOMException; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.domts.DOMTestCase; + +import static org.junit.Assert.assertTrue; + + +/** + * The method setPrefix raises a INVALID_CHARACTER_ERR if the specified prefix contains an illegal character. + * Create a new namespace aware element node and call the setPrefix method on it with a prefix having + * an invalid character. Check if a NAMESPACE_ERR is thrown. + * + * @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 nodesetprefix09 extends DOMTestCase { + @Test + public void testRun() throws Throwable { + Document doc; + String value = "#$%&'()@"; + Element element; + doc = load("staffNS", true); + element = doc.createElementNS("http://www.w3.org/DOM/Test/L2", "dom:elem"); + + { + boolean success = false; + try { + element.setPrefix(value); + } catch (DOMException ex) { + success = (ex.code == DOMException.INVALID_CHARACTER_ERR); + } + assertTrue("nodesetprefix09", 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/nodesetprefix09"; + } + +} Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/normalize01.java URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/normalize01.java?rev=1896456&view=auto ============================================================================== --- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/normalize01.java (added) +++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/normalize01.java Mon Dec 27 20:28:38 2021 @@ -0,0 +1,83 @@ +/* +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.CharacterData; +import org.w3c.dom.*; +import org.w3c.domts.DOMTestCase; + +import static org.junit.Assert.assertEquals; + + +/** + * The "normalize()" method puts all the nodes in the full + * depth of the sub-tree underneath this element into a + * "normal" form. + * <p> + * Retrieve the third employee and access its second child. + * This child contains a block of text that is spread + * across multiple lines. The content of the "name" child + * should be parsed and treated as a single Text node. + * <p> + * This appears to be a duplicate of elementnormalize.xml in DOM L1 Test Suite + * + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-normalize">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-normalize</a> + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-72AB8359">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-72AB8359</a> + */ + + +public class normalize01 extends DOMTestCase { + + + @Test + public void testRun() throws Throwable { + Document doc; + Element root; + NodeList elementList; + Node firstChild; + NodeList textList; + CharacterData textNode; + String data; + doc = load("staff", false); + root = doc.getDocumentElement(); + root.normalize(); + elementList = root.getElementsByTagName("name"); + firstChild = elementList.item(2); + textList = firstChild.getChildNodes(); + textNode = (CharacterData) textList.item(0); + data = textNode.getData(); + assertEquals("data", "Roger\n Jones", data); + + } + + /** + * 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/normalize01"; + } + +} Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/ownerDocument01.java URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/ownerDocument01.java?rev=1896456&view=auto ============================================================================== --- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/ownerDocument01.java (added) +++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/ownerDocument01.java Mon Dec 27 20:28:38 2021 @@ -0,0 +1,62 @@ +/* +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.DocumentType; +import org.w3c.domts.DOMTestCase; + +import static org.junit.Assert.assertNull; + + +/** + * The "getOwnerDocument()" method returns null if the target + * node itself is a DocumentType which is not used with any document yet. + * <p> + * Invoke the "getOwnerDocument()" method on the master + * document. The DocumentType returned should be null. + * + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#node-ownerDoc">http://www.w3.org/TR/DOM-Level-2-Core/core#node-ownerDoc</a> + */ +public class ownerDocument01 extends DOMTestCase { + @Test + public void testRun() throws Throwable { + Document doc; + DocumentType ownerDocument; + doc = load("staff", false); + ownerDocument = (DocumentType) doc.getOwnerDocument(); + assertNull("throw_Null", ownerDocument); + + } + + /** + * 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/ownerDocument01"; + } + +} Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/ownerElement01.java URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/ownerElement01.java?rev=1896456&view=auto ============================================================================== --- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/ownerElement01.java (added) +++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/ownerElement01.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.*; +import org.w3c.domts.DOMTestCase; + +import static org.junit.Assert.assertEquals; + + +/** + * The "getOwnerElement()" will return the Element node this attribute + * is attached to or null if this attribute is not in use. + * Get the "domestic" attribute from the first "address" node. + * Apply the "getOwnerElement()" method to get the Element associated + * with the attribute. The value returned should be "address". + * + * @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 ownerElement01 extends DOMTestCase { + @Test + public void testRun() throws Throwable { + Document doc; + NodeList addressList; + Node testNode; + NamedNodeMap attributes; + Attr domesticAttr; + Element elementNode; + String name; + doc = load("staff", false); + addressList = doc.getElementsByTagName("address"); + testNode = addressList.item(0); + attributes = testNode.getAttributes(); + domesticAttr = (Attr) attributes.getNamedItem("domestic"); + elementNode = domesticAttr.getOwnerElement(); + name = elementNode.getNodeName(); + assertEquals("throw_Equals", "address", name); + + } + + /** + * 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/ownerElement01"; + } + +} Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/ownerElement02.java URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/ownerElement02.java?rev=1896456&view=auto ============================================================================== --- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/ownerElement02.java (added) +++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/ownerElement02.java Mon Dec 27 20:28:38 2021 @@ -0,0 +1,66 @@ +/* +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.assertNull; + + +/** + * The "getOwnerElement()" will return the Element node this attribute + * is attached to or null if this attribute is not in use. + * Create a new attribute. + * Apply the "getOwnerElement()" method to get the Element associated + * with the attribute. The value returned should be "null" since this + * attribute is not in use. + * + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#Attr-ownerElement">http://www.w3.org/TR/DOM-Level-2-Core/core#Attr-ownerElement</a> + */ +public class ownerElement02 extends DOMTestCase { + @Test + public void testRun() throws Throwable { + Document doc; + Attr newAttr; + Element elementNode; + doc = load("staff", false); + newAttr = doc.createAttribute("newAttribute"); + elementNode = newAttr.getOwnerElement(); + assertNull("throw_Null", elementNode); + + } + + /** + * 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/ownerElement02"; + } + +} Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/prefix01.java URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/prefix01.java?rev=1896456&view=auto ============================================================================== --- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/prefix01.java (added) +++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/prefix01.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.domts.DOMTestCase; + +import static org.junit.Assert.assertNull; + + +/** + * The "getPrefix()" method for a Node + * returns the namespace prefix of the node, + * and for nodes of any type other than ELEMENT_NODE and ATTRIBUTE_NODE + * and nodes created with a DOM Level 1 method, this is null. + * <p> + * Create an new Element with the createElement() method. + * Invoke the "getPrefix()" method on the newly created element + * node 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 prefix01 extends DOMTestCase { + @Test + public void testRun() throws Throwable { + Document doc; + Node createdNode; + String prefix; + doc = load("staffNS", false); + createdNode = doc.createElement("test:employee"); + prefix = createdNode.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/prefix01"; + } + +} --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
