changeset 721:c3a1f0059b98

8051559: Convert JAXP function tests: org.w3c.dom to jtreg (testng) tests Reviewed-by: lancea, joehw Contributed-by: frank.yuan@oracle.com
author joehw
date Wed, 15 Apr 2015 21:54:29 -0700
parents 7825883c575a
children e6268235b2db
files test/javax/xml/jaxp/functional/org/w3c/dom/ptests/AbstractCharacterDataTest.java test/javax/xml/jaxp/functional/org/w3c/dom/ptests/AttrTest.java test/javax/xml/jaxp/functional/org/w3c/dom/ptests/CommentTest.java test/javax/xml/jaxp/functional/org/w3c/dom/ptests/DocumentTest.java test/javax/xml/jaxp/functional/org/w3c/dom/ptests/DocumentTypeTest.java test/javax/xml/jaxp/functional/org/w3c/dom/ptests/DomImplementationTest.java test/javax/xml/jaxp/functional/org/w3c/dom/ptests/ElementTest.java test/javax/xml/jaxp/functional/org/w3c/dom/ptests/EntityChildTest.java test/javax/xml/jaxp/functional/org/w3c/dom/ptests/NamedNodeMapTest.java test/javax/xml/jaxp/functional/org/w3c/dom/ptests/NodeListTest.java test/javax/xml/jaxp/functional/org/w3c/dom/ptests/NodeTest.java test/javax/xml/jaxp/functional/org/w3c/dom/ptests/NotationTest.java test/javax/xml/jaxp/functional/org/w3c/dom/ptests/PITest.java test/javax/xml/jaxp/functional/org/w3c/dom/ptests/TextTest.java test/javax/xml/jaxp/functional/org/w3c/dom/ptests/TypeInfoTest.java test/javax/xml/jaxp/functional/org/w3c/dom/xmlfiles/Attr01.xml test/javax/xml/jaxp/functional/org/w3c/dom/xmlfiles/Attr2.xml test/javax/xml/jaxp/functional/org/w3c/dom/xmlfiles/Attr3.xml test/javax/xml/jaxp/functional/org/w3c/dom/xmlfiles/Comment01.xml test/javax/xml/jaxp/functional/org/w3c/dom/xmlfiles/DocumentBuilderImpl02.dtd test/javax/xml/jaxp/functional/org/w3c/dom/xmlfiles/DocumentTest01.xml test/javax/xml/jaxp/functional/org/w3c/dom/xmlfiles/DocumentType01.xml test/javax/xml/jaxp/functional/org/w3c/dom/xmlfiles/DocumentType03.xml test/javax/xml/jaxp/functional/org/w3c/dom/xmlfiles/DocumentType05.dtd test/javax/xml/jaxp/functional/org/w3c/dom/xmlfiles/DocumentType05.xml test/javax/xml/jaxp/functional/org/w3c/dom/xmlfiles/ElementSample01.xml test/javax/xml/jaxp/functional/org/w3c/dom/xmlfiles/ElementSample02.xml test/javax/xml/jaxp/functional/org/w3c/dom/xmlfiles/ElementSample03.xml test/javax/xml/jaxp/functional/org/w3c/dom/xmlfiles/ElementSample04.xml test/javax/xml/jaxp/functional/org/w3c/dom/xmlfiles/NamedNodeMap01.xml test/javax/xml/jaxp/functional/org/w3c/dom/xmlfiles/NamedNodeMap03.xml test/javax/xml/jaxp/functional/org/w3c/dom/xmlfiles/Node01.xml test/javax/xml/jaxp/functional/org/w3c/dom/xmlfiles/Node02.xml test/javax/xml/jaxp/functional/org/w3c/dom/xmlfiles/Node04.xml test/javax/xml/jaxp/functional/org/w3c/dom/xmlfiles/Node05.xml test/javax/xml/jaxp/functional/org/w3c/dom/xmlfiles/Notation01.xml test/javax/xml/jaxp/functional/org/w3c/dom/xmlfiles/PITest01.xml test/javax/xml/jaxp/functional/org/w3c/dom/xmlfiles/Text01.xml test/javax/xml/jaxp/functional/org/w3c/dom/xmlfiles/ee.xml test/javax/xml/jaxp/functional/org/w3c/dom/xmlfiles/entitychild.xml test/javax/xml/jaxp/functional/org/w3c/dom/xmlfiles/nodelist.xml test/javax/xml/jaxp/functional/org/w3c/dom/xmlfiles/out/InsertBeforeGF.out test/javax/xml/jaxp/functional/org/w3c/dom/xmlfiles/out/ReplaceChild3GF.out test/javax/xml/jaxp/libs/org/w3c/dom/ptests/DOMTestUtil.java
diffstat 44 files changed, 2296 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/AbstractCharacterDataTest.java	Wed Apr 15 21:54:29 2015 -0700
@@ -0,0 +1,231 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code 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 the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.w3c.dom.ptests;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.fail;
+import static org.w3c.dom.DOMException.INDEX_SIZE_ERR;
+import static org.w3c.dom.ptests.DOMTestUtil.DOMEXCEPTION_EXPECTED;
+
+import java.io.IOException;
+
+import javax.xml.parsers.ParserConfigurationException;
+
+import jaxp.library.JAXPFileBaseTest;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+import org.w3c.dom.CharacterData;
+import org.w3c.dom.DOMException;
+import org.xml.sax.SAXException;
+
+/*
+ * @summary common test for the CharacterData Interface
+ */
+public abstract class AbstractCharacterDataTest extends JAXPFileBaseTest {
+    @DataProvider(name = "data-for-length")
+    public Object[][] getDataForTestLength() {
+        return new Object[][] {
+                { "", 0 },
+                { "test", 4 } };
+    }
+
+    /*
+     * Verify getLength method works as the spec, for an empty string, should
+     * return zero
+     */
+    @Test(dataProvider = "data-for-length")
+    public void testGetLength(String text, int length) throws Exception {
+        CharacterData cd = createCharacterData(text);
+        assertEquals(cd.getLength(), length);
+
+    }
+
+    /*
+     * Test appendData method and verify by getData method.
+     */
+    @Test
+    public void testAppendData() throws Exception {
+        CharacterData cd = createCharacterData("DOM");
+        cd.appendData("2");
+        assertEquals(cd.getData(), "DOM2");
+
+    }
+
+    @DataProvider(name = "data-for-delete")
+    public Object[][] getDataForTestDelete() {
+        return new Object[][] {
+                { "DOM", 2, 1, "DO" },
+                { "DOM", 0, 2, "M" },
+                { "DOM", 2, 3, "DO" } };
+    }
+
+    /*
+     * Verify deleteData method works as the spec.
+     */
+    @Test(dataProvider = "data-for-delete")
+    public void testDeleteData(String text, int offset, int count, String result) throws Exception {
+        CharacterData cd = createCharacterData(text);
+        cd.deleteData(offset, count);
+        assertEquals(cd.getData(), result);
+    }
+
+    @DataProvider(name = "data-for-replace")
+    public Object[][] getDataForTestReplace() {
+        return new Object[][] {
+                { "DOM", 0, 3, "SAX", "SAX" },
+                { "DOM", 1, 1, "AA", "DAAM" },
+                { "DOM", 1, 2, "A", "DA" },
+                { "DOM", 2, 2, "SAX", "DOSAX" } };
+    }
+
+    /*
+     * Verify replaceData method works as the spec.
+     */
+    @Test(dataProvider = "data-for-replace")
+    public void testReplaceData(String text, int offset, int count, String arg, String result) throws Exception {
+        CharacterData cd = createCharacterData(text);
+        cd.replaceData(offset, count, arg);
+        assertEquals(cd.getData(), result);
+    }
+
+    @DataProvider(name = "data-for-replace-neg")
+    public Object[][] getDataForTestReplaceNeg() {
+        return new Object[][] {
+                { "DOM", -1, 3, "SAX" }, //offset if neg
+                { "DOM", 0, -1, "SAX" }, //count is neg
+                { "DOM", 4, 1, "SAX" } };//offset is greater than length
+    }
+
+    /*
+     * Test for replaceData method: verifies that DOMException with
+     * INDEX_SIZE_ERR is thrown if offset or count is out of the bound.
+     */
+    @Test(dataProvider = "data-for-replace-neg")
+    public void testReplaceDataNeg(String text, int offset, int count, String arg) throws Exception {
+        CharacterData cd = createCharacterData(text);
+        try {
+            cd.replaceData(offset, count, arg);
+            fail(DOMEXCEPTION_EXPECTED);
+        } catch (DOMException e) {
+            assertEquals(e.code, INDEX_SIZE_ERR);
+        }
+    }
+
+    @DataProvider(name = "data-for-insert")
+    public Object[][] getDataForTestInsert() {
+        return new Object[][] {
+                { "DOM", 0, "SAX", "SAXDOM" },
+                { "DOM", 3, "SAX", "DOMSAX" } };
+    }
+
+    /*
+     * Verify insertData method works as the spec.
+     */
+    @Test(dataProvider = "data-for-insert")
+    public void testInsertData(String text, int offset, String arg, String result) throws Exception {
+        CharacterData cd = createCharacterData(text);
+        cd.insertData(offset, arg);
+        assertEquals(cd.getData(), result);
+    }
+
+    @DataProvider(name = "data-for-insert-neg")
+    public Object[][] getDataForTestInsertNeg() {
+        return new Object[][] {
+                { "DOM", -1 }, //offset is neg
+                { "DOM", 4 } };//offset is greater than length
+    }
+
+    /*
+     * Test for insertData method: verifies that DOMException with
+     * INDEX_SIZE_ERR is thrown if offset is out of the bound.
+     */
+    @Test(dataProvider = "data-for-insert-neg")
+    public void testInsertDataNeg(String text, int offset) throws Exception {
+        CharacterData cd = createCharacterData(text);
+        try {
+            cd.insertData(offset, "TEST");
+            fail(DOMEXCEPTION_EXPECTED);
+        } catch (DOMException e) {
+            assertEquals(e.code, INDEX_SIZE_ERR);
+        }
+    }
+
+    /*
+     * Test setData method and verify by getData method.
+     */
+    @Test
+    public void testSetData() throws Exception {
+        CharacterData cd = createCharacterData("DOM");
+        cd.setData("SAX");
+        assertEquals(cd.getData(), "SAX");
+    }
+
+    @DataProvider(name = "data-for-substring")
+    public Object[][] getDataForTestSubstring() {
+        return new Object[][] {
+                { "DOM Level 2", 0, 3, "DOM" },
+                { "DOM", 0, 3, "DOM" },
+                { "DOM", 2, 5, "M" } };
+    }
+
+    /*
+     * Verify substringData method works as the spec.
+     */
+    @Test(dataProvider = "data-for-substring")
+    public void testSubstringData(String text, int offset, int count, String result) throws Exception {
+        CharacterData cd = createCharacterData(text);
+        String retStr = cd.substringData(offset, count);
+        assertEquals(retStr, result);
+    }
+
+    @DataProvider(name = "data-for-substring-neg")
+    public Object[][] getDataForTestSubstringNeg() {
+        return new Object[][] {
+                { "DOM Level 2", -1, 3 }, //offset is neg
+                { "DOM", 0, -1 }, //count is neg
+                { "DOM", 3, 1 } }; //offset exceeds length
+    }
+
+    /*
+     * Test for substringData method: verifies that DOMException with
+     * INDEX_SIZE_ERR is thrown if offset or count is out of the bound.
+     */
+    @Test(dataProvider = "data-for-substring-neg")
+    public void testSubstringDataNeg(String text, int offset, int count) throws Exception {
+        CharacterData cd = createCharacterData(text);
+        try {
+            cd.substringData(offset, count);
+            fail(DOMEXCEPTION_EXPECTED);
+        } catch (DOMException e) {
+            assertEquals(e.code, INDEX_SIZE_ERR);
+        }
+
+    }
+
+    /*
+     * Return a concrete CharacterData instance.
+     */
+    abstract protected CharacterData createCharacterData(String text) throws IOException, SAXException, ParserConfigurationException;
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/AttrTest.java	Wed Apr 15 21:54:29 2015 -0700
@@ -0,0 +1,148 @@
+/*
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code 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 the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.w3c.dom.ptests;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNull;
+import static org.testng.Assert.assertTrue;
+import static org.w3c.dom.ptests.DOMTestUtil.createDOM;
+import jaxp.library.JAXPFileBaseTest;
+
+import org.testng.annotations.Test;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+
+
+/*
+ * @summary Test for the Attr Interface
+ */
+public class AttrTest extends JAXPFileBaseTest {
+    /*
+     * Verify getName method against both existing Attr and new Attr.
+     */
+    @Test
+    public void testGetName() throws Exception {
+        Document document = createDOM("Attr01.xml");
+        //test a new created Attr
+        Attr attr = document.createAttribute("newAttribute");
+        assertEquals(attr.getName(), "newAttribute");
+
+        //test a Attr loaded from xml file
+        Element elemNode = (Element) document.getElementsByTagName("book").item(1);
+        Attr attr2 = (Attr) elemNode.getAttributes().item(0);
+        assertEquals(attr2.getName(), "category1");
+    }
+
+    /*
+     * Verify getOwnerElement method against both existing Attr and new Attr.
+     */
+    @Test
+    public void testGetOwnerElement() throws Exception {
+        Document document = createDOM("Attr01.xml");
+
+        //test Attr loaded from xml file
+        Element elemNode = (Element) document.getElementsByTagName("book").item(1);
+        NamedNodeMap nnMap = elemNode.getAttributes();
+        for (int i = 0; i < nnMap.getLength(); i++) {
+            Attr attr = (Attr) nnMap.item(i);
+            assertEquals(attr.getOwnerElement().getNodeName(), "book");
+        }
+
+        //test an Attr without owner node
+        Attr attr = document.createAttribute("newAttribute");
+        assertNull(attr.getOwnerElement());
+
+    }
+
+    /*
+     * Verify getSpecified method works as the spec.
+     */
+    @Test
+    public void testGetSpecified1() throws Exception {
+        Document document = createDOM("Attr01.xml");
+
+        Element elemNode = (Element) document.getElementsByTagName("book").item(1);
+        Attr attr = elemNode.getAttributeNode("category1");
+        assertTrue(attr.getSpecified());
+
+    }
+
+    /*
+     * In this xml file, the dtd has the value for the attrribute, but the xml
+     * element does not specify the value for the attrribute, as per the spec it
+     * should return false.
+     */
+    @Test
+    public void testGetSpecified2() throws Exception {
+
+        Document document = createDOM("Attr2.xml");
+        Element elemNode = (Element) document.getElementsByTagName("Name").item(0);
+        Attr attr = elemNode.getAttributeNode("type");
+
+        assertFalse(attr.getSpecified());
+    }
+
+    /*
+     * Creating a new attribute, the owner element is null since the attribute
+     * has just been created, getSpecified should return true.
+     */
+    @Test
+    public void testNewCreatedAttribute() throws Exception {
+        Document document = createDOM("Attr01.xml");
+        Attr attr = document.createAttribute("newAttribute");
+        assertTrue(attr.getSpecified());
+        assertNull(attr.getOwnerElement());
+
+    }
+
+    /*
+     * The xml file includes the dtd having the IMPLIED value for the attrribute
+     * and the xml element does not specify the value. As per the spec it should
+     * not be seen as a part of the structure model hence getAttributeNode
+     * rerurn null if the attribute is even found.
+     */
+    @Test
+    public void testIMPLIEDAttribute() throws Exception {
+        Document document = createDOM("Attr3.xml");
+        Element elemNode = (Element) document.getElementsByTagName("Name").item(0);
+        Attr attr = elemNode.getAttributeNode("type");
+        assertNull(attr);
+    }
+
+    /*
+     * Test setValue method and verify by getValue method.
+     */
+    @Test
+    public void testSetValue() throws Exception {
+        Document document = createDOM("Attr01.xml");
+        Attr attr = document.createAttribute("newAttribute");
+        attr.setValue("newVal");
+        assertEquals(attr.getValue(), "newVal");
+
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/CommentTest.java	Wed Apr 15 21:54:29 2015 -0700
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code 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 the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.w3c.dom.ptests;
+
+import static org.w3c.dom.ptests.DOMTestUtil.createNewDocument;
+
+import java.io.IOException;
+
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.w3c.dom.CharacterData;
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
+
+/*
+ * @summary Test for Comment implementation returned by Document.createComment(String)
+ */
+public class CommentTest extends AbstractCharacterDataTest {
+    @Override
+    protected CharacterData createCharacterData(String text) throws IOException, SAXException, ParserConfigurationException {
+        Document document = createNewDocument();
+        return document.createComment(text);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/DocumentTest.java	Wed Apr 15 21:54:29 2015 -0700
@@ -0,0 +1,172 @@
+/*
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code 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 the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.w3c.dom.ptests;
+
+import static javax.xml.XMLConstants.XMLNS_ATTRIBUTE_NS_URI;
+import static javax.xml.XMLConstants.XML_NS_URI;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.fail;
+import static org.w3c.dom.DOMException.NAMESPACE_ERR;
+import static org.w3c.dom.ptests.DOMTestUtil.DOMEXCEPTION_EXPECTED;
+import static org.w3c.dom.ptests.DOMTestUtil.createDOMWithNS;
+import static org.w3c.dom.ptests.DOMTestUtil.createNewDocument;
+import jaxp.library.JAXPFileBaseTest;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+import org.w3c.dom.Attr;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+/*
+ * @summary Test createAttributeNS, getElementsByTagNameNS and createElementNS method of Document
+ */
+public class DocumentTest extends JAXPFileBaseTest {
+
+    @DataProvider(name = "invalid-nsuri")
+    public Object[][] getInvalidNamespaceURI() {
+        return new Object[][] {
+                { " ", "xml:novel" }, //blank
+                { "hello", "xml:novel" }, //unqualified
+                { null, "xml:novel" }, //null
+                { "", "xmlns:novel" } };//empty
+    }
+
+    /*
+     * Test for createAttributeNS method: verifies that DOMException is thrown
+     * if reserved prefixes are used with an arbitrary namespace name.
+     */
+    @Test(dataProvider = "invalid-nsuri", expectedExceptions = DOMException.class)
+    public void testCreateAttributeNSNeg(String namespaceURI, String name) throws Exception {
+        Document document = createDOMWithNS("DocumentTest01.xml");
+        document.createAttributeNS(namespaceURI, name);
+    }
+
+    @DataProvider(name = "valid-nsuri")
+    public Object[][] getValidNamespaceURI() {
+        return new Object[][] {
+                { XML_NS_URI, "xml:novel" },
+                { XMLNS_ATTRIBUTE_NS_URI, "xmlns:novel" },
+                { "urn:BooksAreUs.org:BookInfo", "attributeNew"},
+                { "urn:BooksAreUs.org:BookInfonew", "attributeNew"} };
+    }
+
+    /*
+     * Verify the Attr from createAttributeNS.
+     */
+    @Test(dataProvider = "valid-nsuri")
+    public void testCreateAttributeNS(String namespaceURI, String name) throws Exception {
+        Document document = createDOMWithNS("DocumentTest01.xml");
+        Attr attr = document.createAttributeNS(namespaceURI, name);
+        assertEquals(attr.getNamespaceURI(), namespaceURI);
+        assertEquals(attr.getName(), name);
+    }
+
+    @DataProvider(name = "elementName")
+    public Object[][] getElementName() {
+        return new Object[][] {
+                { "author", 1 },
+                { "b:author", 0 } };
+    }
+
+    /*
+     * Verify the NodeList from getElementsByTagNameNS.
+     */
+    @Test(dataProvider = "elementName")
+    public void testGetElementsByTagNameNS(String localName, int number) throws Exception {
+        Document document = createDOMWithNS("DocumentTest01.xml");
+        NodeList nodeList = document.getElementsByTagNameNS("urn:BooksAreUs.org:BookInfo", localName);
+        assertEquals(nodeList.getLength(), number);
+    }
+
+    /*
+     * Test for createElementNS method: verifies that DOMException is thrown
+     * if reserved prefixes are used with an arbitrary namespace name.
+     */
+    @Test(dataProvider = "invalid-nsuri")
+    public void testCreateElementNSNeg(String namespaceURI, String name) throws Exception {
+        Document document = createDOMWithNS("DocumentTest01.xml");
+        try {
+            document.createElementNS(namespaceURI, name);
+            fail(DOMEXCEPTION_EXPECTED);
+        } catch (DOMException e) {
+            assertEquals(e.code, NAMESPACE_ERR);
+        }
+    }
+
+    /*
+     * Test createElementNS method works as the spec.
+     */
+    @Test
+    public void testCreateElementNS() throws Exception {
+        final String nsURI = "http://www.books.com";
+        final String name = "b:novel";
+        final String localName = "novel";
+        Document document = createDOMWithNS("DocumentTest01.xml");
+        Element element = document.createElementNS(nsURI, name);
+        assertEquals(element.getNamespaceURI(), nsURI);
+        assertEquals(element.getNodeName(), name);
+        assertEquals(element.getLocalName(), localName);
+    }
+
+    /*
+     * Test createAttributeNS and then append it with setAttributeNode.
+     */
+    @Test
+    public void testAddNewAttributeNode() throws Exception {
+        Document document = createDOMWithNS("DocumentTest01.xml");
+
+        NodeList nodeList = document.getElementsByTagNameNS("http://www.w3.org/TR/REC-html40", "body");
+        NodeList childList = nodeList.item(0).getChildNodes();
+        Element child = (Element) childList.item(1);
+        Attr a = document.createAttributeNS("urn:BooksAreUs.org:BookInfo", "attributeNew");
+        child.setAttributeNode(a);
+        assertNotNull(child.getAttributeNodeNS("urn:BooksAreUs.org:BookInfo", "attributeNew"));
+    }
+
+    /*
+     * Test createElementNS and then append it with appendChild.
+     */
+    @Test
+    public void testAddNewElement() throws Exception {
+        Document document = createDOMWithNS("DocumentTest01.xml");
+
+        NodeList nodeList = document.getElementsByTagNameNS("http://www.w3.org/TR/REC-html40", "body");
+        NodeList childList = nodeList.item(0).getChildNodes();
+        Element child = (Element) childList.item(1);
+        Element elem = document.createElementNS("urn:BooksAreUs.org:BookInfonew", "newElement");
+        assertNotNull(child.appendChild(elem));
+    }
+
+    /*
+     * Test createElement with unqualified xml name.
+     */
+    @Test(expectedExceptions = DOMException.class)
+    public void testCreateElementNeg() throws Exception {
+        Document doc = createNewDocument();
+        doc.createElement("!nc$%^*(!");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/DocumentTypeTest.java	Wed Apr 15 21:54:29 2015 -0700
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code 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 the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.w3c.dom.ptests;
+
+import static org.testng.Assert.assertEquals;
+import static org.w3c.dom.ptests.DOMTestUtil.createDOM;
+import jaxp.library.JAXPFileBaseTest;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.DocumentType;
+import org.w3c.dom.NamedNodeMap;
+
+/*
+ * @summary Test DocumentType
+ */
+public class DocumentTypeTest extends JAXPFileBaseTest {
+
+    /*
+     * Test testGetEntities method, and verify the entity items.
+     */
+    @Test
+    public void testGetEntities() throws Exception {
+        DocumentType documentType = createDOM("DocumentType01.xml").getDoctype();
+        NamedNodeMap namedNodeMap = documentType.getEntities();
+        // should return both external and internal. Parameter entities are not
+        // contained. Duplicates are discarded.
+        assertEquals(namedNodeMap.getLength(), 3);
+        assertEquals(namedNodeMap.item(0).getNodeName(), "author");
+        assertEquals(namedNodeMap.item(1).getNodeName(), "test");
+        assertEquals(namedNodeMap.item(2).getNodeName(), "writer");
+    }
+
+    /*
+     * Test getNotations method, and verify the notation items.
+     */
+    @Test
+    public void testGetNotations() throws Exception {
+        DocumentType documentType = createDOM("DocumentType03.xml").getDoctype();
+        NamedNodeMap nm = documentType.getNotations();
+        assertEquals(nm.getLength(), 2); // should return 2 because the notation
+                                         // name is repeated and
+                                         // it considers only the first
+                                         // occurence
+        assertEquals(nm.item(0).getNodeName(), "gs");
+        assertEquals(nm.item(1).getNodeName(), "name");
+    }
+
+    /*
+     * Test getName method.
+     */
+    @Test
+    public void testGetName() throws Exception {
+        DocumentType documentType = createDOM("DocumentType03.xml").getDoctype();
+        assertEquals(documentType.getName(), "note");
+    }
+
+    /*
+     * Test getSystemId and getPublicId method.
+     */
+    @Test
+    public void testGetSystemId() throws Exception {
+        DocumentType documentType = createDOM("DocumentType05.xml").getDoctype();
+        assertEquals(documentType.getSystemId(), "DocumentBuilderImpl02.dtd");
+        Assert.assertNull(documentType.getPublicId());
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/DomImplementationTest.java	Wed Apr 15 21:54:29 2015 -0700
@@ -0,0 +1,127 @@
+/*
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code 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 the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.w3c.dom.ptests;
+
+import static org.testng.Assert.assertEquals;
+import static org.w3c.dom.ptests.DOMTestUtil.createNewDocument;
+
+import javax.xml.parsers.ParserConfigurationException;
+
+import jaxp.library.JAXPBaseTest;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+import org.w3c.dom.DOMImplementation;
+import org.w3c.dom.Document;
+import org.w3c.dom.DocumentType;
+
+/*
+ * @summary Test DomImplementation API
+ */
+public class DomImplementationTest extends JAXPBaseTest {
+    /*
+     * Test createDocument method with a namespace uri, qualified name and null
+     * for the doctype
+     */
+    @Test
+    public void testCreateDocument() throws ParserConfigurationException {
+        final String nsURI = "http://www.document.com";
+        final String name = "document:localName";
+        DOMImplementation domImpl = getDOMImplementation();
+        Document document = domImpl.createDocument(nsURI, name, null);
+        assertEquals(document.getDocumentElement().getNamespaceURI(), nsURI);
+        assertEquals(document.getDocumentElement().getNodeName(), name);
+    }
+
+    /*
+     * Test createDocumentType method with name, public id and system id.
+     */
+    @Test
+    public void testCreateDocumentType01() throws ParserConfigurationException {
+        final String name = "document:localName";
+        final String publicId = "pubid";
+        final String systemId = "sysid";
+
+        DOMImplementation domImpl = getDOMImplementation();
+        DocumentType documentType = domImpl.createDocumentType(name, publicId, systemId);
+        verifyDocumentType(documentType, name, publicId, systemId);
+    }
+
+
+    /*
+     * Test createDocument method using a DocumentType, verify the document will
+     * take that Doctype.
+     */
+    @Test
+    public void testCreateDocumentType02() throws ParserConfigurationException {
+        final String name = "document:localName";
+        final String publicId = "-//W3C//DTD HTML 4.0 Transitional//EN";
+        final String systemId = "http://www.w3.org/TR/REC-html40/loose.dtd";
+        DOMImplementation domImpl = getDOMImplementation();
+
+        DocumentType documentType = domImpl.createDocumentType(name, publicId, systemId);
+        Document document = domImpl.createDocument("http://www.document.com", "document:localName", documentType);
+        verifyDocumentType(document.getDoctype(), name, publicId, systemId);
+    }
+
+    @DataProvider(name = "feature-supported")
+    public Object[][] getFeatureSupportedList() throws ParserConfigurationException {
+        DOMImplementation impl = getDOMImplementation();
+        return new Object[][] {
+                { impl, "XML", "2.0", true },
+                { impl, "HTML", "2.0", false },
+                { impl, "Views", "2.0", false },
+                { impl, "StyleSheets", "2.0", false },
+                { impl, "CSS", "2.0", false },
+                { impl, "CSS2", "2.0", false },
+                { impl, "Events", "2.0", true },
+                { impl, "UIEvents", "2.0", false },
+                { impl, "MouseEvents", "2.0", false },
+                { impl, "HTMLEvents", "2.0", false },
+                { impl, "Traversal", "2.0", true },
+                { impl, "Range", "2.0", true },
+                { impl, "Core", "2.0", true },
+                { impl, "XML", "", true } };
+    }
+
+
+    /*
+     * Verify DOMImplementation for feature supporting.
+     */
+    @Test(dataProvider = "feature-supported")
+    public void testHasFeature(DOMImplementation impl, String feature, String version, boolean isSupported) {
+        assertEquals(impl.hasFeature(feature,version), isSupported);
+    }
+
+
+    private DOMImplementation getDOMImplementation() throws ParserConfigurationException {
+        return createNewDocument().getImplementation();
+    }
+
+
+    private void verifyDocumentType(DocumentType documentType, String name, String publicId, String systemId) {
+        assertEquals(documentType.getPublicId(), publicId);
+        assertEquals(documentType.getSystemId(), systemId);
+        assertEquals(documentType.getName(), name);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/ElementTest.java	Wed Apr 15 21:54:29 2015 -0700
@@ -0,0 +1,253 @@
+/*
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code 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 the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.w3c.dom.ptests;
+
+import static javax.xml.XMLConstants.XML_NS_URI;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNull;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
+import static org.w3c.dom.DOMException.INUSE_ATTRIBUTE_ERR;
+import static org.w3c.dom.ptests.DOMTestUtil.DOMEXCEPTION_EXPECTED;
+import static org.w3c.dom.ptests.DOMTestUtil.createDOM;
+import static org.w3c.dom.ptests.DOMTestUtil.createDOMWithNS;
+import static org.w3c.dom.ptests.DOMTestUtil.createNewDocument;
+
+import java.io.StringReader;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import jaxp.library.JAXPFileBaseTest;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+import org.w3c.dom.Attr;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.InputSource;
+
+/*
+ * @summary Test for the methods of Element Interface
+ */
+public class ElementTest extends JAXPFileBaseTest {
+    @Test
+    public void testGetAttributeNS() throws Exception {
+        Document document = createDOMWithNS("ElementSample01.xml");
+        Element elemNode = (Element) document.getElementsByTagName("book").item(0);
+        String s = elemNode.getAttributeNS("urn:BooksAreUs.org:BookInfo", "category");
+        assertEquals(s, "research");
+    }
+
+    @Test
+    public void testGetAttributeNodeNS() throws Exception {
+        Document document = createDOMWithNS("ElementSample01.xml");
+        Element elemNode = (Element) document.getElementsByTagName("book").item(0);
+        Attr attr = elemNode.getAttributeNodeNS("urn:BooksAreUs.org:BookInfo", "category");
+        assertEquals(attr.getValue(), "research");
+
+    }
+
+    /*
+     * Test getAttributeNode to get a Attr and then remove it successfully by
+     * removeAttributeNode.
+     */
+    @Test
+    public void testRemoveAttributeNode() throws Exception {
+        Document document = createDOMWithNS("ElementSample01.xml");
+        Element elemNode = (Element) document.getElementsByTagName("book").item(1);
+        Attr attr = elemNode.getAttributeNode("category1");
+        assertEquals(attr.getValue(), "research");
+
+        assertEquals(elemNode.getTagName(), "book");
+        elemNode.removeAttributeNode(attr);
+        assertEquals(elemNode.getAttribute("category1"), "");
+    }
+
+    /*
+     * Test removing an Attribute Node with removeAttributeNS(String
+     * namespaceURI, String localName).
+     */
+    @Test
+    public void testRemoveAttributeNS() throws Exception {
+        final String nsURI = "urn:BooksAreUs.org:BookInfo";
+        final String localName = "category";
+        Document document = createDOMWithNS("ElementSample01.xml");
+        Element elemNode = (Element) document.getElementsByTagName("book").item(0);
+        elemNode.removeAttributeNS(nsURI, localName);
+
+        assertNull(elemNode.getAttributeNodeNS(nsURI, localName));
+    }
+
+    /*
+     * Test getFirstChild and getLastChild.
+     */
+    @Test
+    public void testGetChild() throws Exception {
+        Document document = createDOMWithNS("ElementSample01.xml");
+        Element elemNode = (Element) document.getElementsByTagName("b:aaa").item(0);
+        elemNode.normalize();
+        Node firstChild = elemNode.getFirstChild();
+        Node lastChild = elemNode.getLastChild();
+        assertEquals(firstChild.getNodeValue(), "fjfjf");
+        assertEquals(lastChild.getNodeValue(), "fjfjf");
+    }
+
+    /*
+     * Test setAttributeNode with an Attr from createAttribute.
+     */
+    @Test
+    public void testSetAttributeNode() throws Exception {
+        final String attrName = "myAttr";
+        final String attrValue = "attrValue";
+        Document document = createDOM("ElementSample02.xml");
+        Element elemNode = document.createElement("pricetag2");
+        Attr myAttr = document.createAttribute(attrName);
+        myAttr.setValue(attrValue);
+
+        assertNull(elemNode.setAttributeNode(myAttr));
+        assertEquals(elemNode.getAttribute(attrName), attrValue);
+    }
+
+    @DataProvider(name = "attribute")
+    public Object[][] getAttributeData() {
+        return new Object[][] {
+                { "thisisname", "thisisitsvalue" },
+                { "style", "font-Family" } };
+    }
+
+    @Test(dataProvider = "attribute")
+    public void testSetAttribute(String name, String value) throws Exception {
+        Document document = createDOM("ElementSample02.xml");
+        Element elemNode = document.createElement("pricetag2");
+        elemNode.setAttribute(name, value);
+        assertEquals(elemNode.getAttribute(name), value);
+    }
+
+    /*
+     * Negative test for setAttribute, null is not a valid name.
+     */
+    @Test(expectedExceptions = DOMException.class)
+    public void testSetAttributeNeg() throws Exception {
+        Document document = createDOM("ElementSample02.xml");
+        Element elemNode = document.createElement("pricetag2");
+        elemNode.setAttribute(null, null);
+    }
+
+    /*
+     * Test setAttributeNode, newAttr can't be an attribute of another Element
+     * object, must explicitly clone Attr nodes to re-use them in other
+     * elements.
+     */
+    @Test
+    public void testDuplicateAttributeNode() throws Exception {
+        final String name = "testAttrName";
+        final String value = "testAttrValue";
+        Document document = createNewDocument();
+        Attr attr = document.createAttribute(name);
+        attr.setValue(value);
+
+        Element element1 = document.createElement("AFirstElement");
+        element1.setAttributeNode(attr);
+        Element element2 = document.createElement("ASecondElement");
+        Attr attr2 = (Attr) attr.cloneNode(true);
+        element2.setAttributeNode(attr2);
+        assertEquals(element1.getAttribute(name), element2.getAttribute(name));
+
+        Element element3 = document.createElement("AThirdElement");
+        try {
+            element3.setAttributeNode(attr);
+            fail(DOMEXCEPTION_EXPECTED);
+        } catch (DOMException doe) {
+            assertEquals(doe.code, INUSE_ATTRIBUTE_ERR);
+        }
+    }
+
+    /*
+     * If not setting the namsepace aware method of DocumentBuilderFactory to
+     * true, can't retrieve element by namespace and local name.
+     */
+    @Test
+    public void testNamespaceAware() throws Exception {
+        Document document = createDOM("ElementSample02.xml");
+
+        NodeList nl = document.getElementsByTagNameNS("urn:BooksAreUs.org:BookInfo", "author");
+        assertNull(nl.item(0));
+
+        nl = document.getDocumentElement().getElementsByTagNameNS("urn:BooksAreUs.org:BookInfo", "author");
+        assertNull(nl.item(0));
+    }
+
+    @DataProvider(name = "nsattribute")
+    public Object[][] getNSAttributeData() {
+        return new Object[][] {
+                { "h:html", "html", "attrValue" },
+                { "b:style", "style",  "attrValue" } };
+    }
+
+    /*
+     * setAttributeNodeNS and verify it with getAttributeNS.
+     */
+    @Test(dataProvider = "nsattribute")
+    public void testSetAttributeNodeNS(String qualifiedName, String localName, String value) throws Exception {
+        Document document = createDOM("ElementSample03.xml");
+        Element elemNode = document.createElement("pricetag2");
+        Attr myAttr = document.createAttributeNS(XML_NS_URI, qualifiedName);
+        myAttr.setValue(value);
+        assertNull(elemNode.setAttributeNodeNS(myAttr));
+        assertEquals(elemNode.getAttributeNS(XML_NS_URI, localName), value);
+    }
+
+    @Test
+    public void testHasAttributeNS() throws Exception {
+        Document document = createDOMWithNS("ElementSample04.xml");
+        NodeList nodeList = document.getElementsByTagName("body");
+        NodeList childList = nodeList.item(0).getChildNodes();
+        Element child = (Element) childList.item(7);
+        assertTrue(child.hasAttributeNS("urn:BooksAreUs.org:BookInfo", "style"));
+    }
+
+    @Test
+    public void testToString() throws Exception {
+        final String xml =
+                "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>"
+                + "<!DOCTYPE datacenterlist>"
+                + "<datacenterlist>"
+                + "  <datacenterinfo"
+                + "    id=\"0\""
+                + "    naddrs=\"1\""
+                + "    nnodes=\"1\""
+                + "    ismaster=\"0\">\n"
+                + "    <gateway ipaddr=\"192.168.100.27:26000\"/>"
+                + "  </datacenterinfo>"
+                + "</datacenterlist>";
+
+        Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new InputSource(new StringReader(xml)));
+        Element root = doc.getDocumentElement();
+
+        assertEquals(root.toString(), "[datacenterlist: null]");
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/EntityChildTest.java	Wed Apr 15 21:54:29 2015 -0700
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code 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 the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.w3c.dom.ptests;
+
+import static org.testng.Assert.assertEquals;
+import static org.w3c.dom.ptests.DOMTestUtil.XML_DIR;
+
+import java.io.File;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import jaxp.library.JAXPFileBaseTest;
+
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+/*
+ * @summary Test DOM Parser: parsing an xml file that contains external entities.
+ */
+public class EntityChildTest extends JAXPFileBaseTest {
+
+    @Test
+    public void test() throws Exception {
+
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setValidating(true);
+        DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+        Document document = docBuilder.parse(new File(XML_DIR + "entitychild.xml"));
+
+        Element root = document.getDocumentElement();
+        NodeList n = root.getElementsByTagName("table");
+        NodeList nl = n.item(0).getChildNodes();
+        assertEquals(n.getLength(), 1);
+        assertEquals(nl.getLength(), 3);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/NamedNodeMapTest.java	Wed Apr 15 21:54:29 2015 -0700
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code 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 the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.w3c.dom.ptests;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNull;
+import static org.w3c.dom.ptests.DOMTestUtil.createDOMWithNS;
+import jaxp.library.JAXPFileBaseTest;
+
+import org.testng.annotations.Test;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/*
+ * @summary Test for the methods of NamedNodeMap Interface
+ */
+public class NamedNodeMapTest extends JAXPFileBaseTest {
+    /*
+     * Test setNamedItemNS method with a node having the same namespaceURI and
+     * qualified name as an existing one, and then test with a non-existing node.
+     */
+    @Test
+    public void testSetNamedItemNS() throws Exception {
+        final String nsURI = "urn:BooksAreUs.org:BookInfo";
+        Document document = createDOMWithNS("NamedNodeMap01.xml");
+        NodeList nodeList = document.getElementsByTagName("body");
+        nodeList = nodeList.item(0).getChildNodes();
+        Node n = nodeList.item(3);
+
+        NamedNodeMap namedNodeMap = n.getAttributes();
+
+        // creating an Attribute using createAttributeNS
+        // method having the same namespaceURI
+        // and the same qualified name as the existing one in the xml file
+        Attr attr = document.createAttributeNS(nsURI, "b:style");
+        // setting to a new Value
+        attr.setValue("newValue");
+        Node replacedAttr = namedNodeMap.setNamedItemNS(attr); // return the replaced attr
+        assertEquals(replacedAttr.getNodeValue(), "font-family");
+        Node updatedAttr = namedNodeMap.getNamedItemNS(nsURI, "style");
+        assertEquals(updatedAttr.getNodeValue(), "newValue");
+
+
+        // creating a non existing attribute node
+        attr = document.createAttributeNS(nsURI, "b:newNode");
+        attr.setValue("newValue");
+
+        assertNull(namedNodeMap.setNamedItemNS(attr)); // return null
+
+        // checking if the node could be accessed
+        // using the getNamedItemNS method
+        Node newAttr = namedNodeMap.getNamedItemNS(nsURI, "newNode");
+        assertEquals(newAttr.getNodeValue(), "newValue");
+    }
+
+    /*
+     * Verify getNamedItemNS works as the spec
+     */
+    @Test
+    public void testGetNamedItemNS() throws Exception {
+        Document document = createDOMWithNS("NamedNodeMap03.xml");
+        NodeList nodeList = document.getElementsByTagName("body");
+        nodeList = nodeList.item(0).getChildNodes();
+        Node n = nodeList.item(7);
+        NamedNodeMap namedNodeMap = n.getAttributes();
+        Node node = namedNodeMap.getNamedItemNS("urn:BooksAreUs.org:BookInfo", "aaa");
+        assertEquals(node.getNodeValue(), "value");
+
+    }
+
+    /*
+     * Test setNamedItem method with a node having the same name as an existing
+     * one, and then test with a non-existing node.
+     */
+    @Test
+    public void testSetNamedItem() throws Exception {
+        Document document = createDOMWithNS("NamedNodeMap03.xml");
+        NodeList nodeList = document.getElementsByTagName("body");
+        nodeList = nodeList.item(0).getChildNodes();
+        Node n = nodeList.item(1);
+
+        NamedNodeMap namedNodeMap = n.getAttributes();
+        Attr attr = document.createAttribute("name");
+        Node replacedAttr = namedNodeMap.setNamedItem(attr);
+        assertEquals(replacedAttr.getNodeValue(), "attributeValue");
+        Node updatedAttrNode = namedNodeMap.getNamedItem("name");
+        assertEquals(updatedAttrNode.getNodeValue(), "");
+
+        Attr newAttr = document.createAttribute("nonExistingName");
+        assertNull(namedNodeMap.setNamedItem(newAttr));
+        Node newAttrNode = namedNodeMap.getNamedItem("nonExistingName");
+        assertEquals(newAttrNode.getNodeValue(), "");
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/NodeListTest.java	Wed Apr 15 21:54:29 2015 -0700
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code 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 the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.w3c.dom.ptests;
+
+import static org.testng.Assert.assertEquals;
+import static org.w3c.dom.ptests.DOMTestUtil.createDOM;
+import jaxp.library.JAXPFileBaseTest;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+/*
+ * @summary Verifies a bug found in jaxp1.0.1 and 1.1FCS. After going out of
+ * bound, the last element of a NodeList returns null. The bug has been fixed
+ * in jaxp 1.1.1 build.
+ */
+public class NodeListTest extends JAXPFileBaseTest {
+
+    @DataProvider(name = "xml")
+    public Object[][] getTestData() {
+        return new Object[][] { { "nodelist.xml", "document" }, { "Node01.xml", "body" } };
+    }
+
+    @Test(dataProvider = "xml")
+    public void lastItemTest(String xmlFileName, String nodeName) throws Exception {
+        Document document = createDOM(xmlFileName);
+
+        NodeList nl = document.getElementsByTagName(nodeName);
+        int n = nl.getLength();
+
+        Element elem1 = (Element) nl.item(n - 1);
+        nl.item(n);
+        Element elem3 = (Element) nl.item(n - 1);
+        assertEquals(elem3, elem1);
+
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/NodeTest.java	Wed Apr 15 21:54:29 2015 -0700
@@ -0,0 +1,207 @@
+/*
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code 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 the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.w3c.dom.ptests;
+
+import static jaxp.library.JAXPTestUtilities.compareWithGold;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNotEquals;
+import static org.testng.Assert.assertTrue;
+import static org.w3c.dom.ptests.DOMTestUtil.GOLDEN_DIR;
+import static org.w3c.dom.ptests.DOMTestUtil.createDOM;
+import static org.w3c.dom.ptests.DOMTestUtil.createDOMWithNS;
+import static org.w3c.dom.ptests.DOMTestUtil.createNewDocument;
+
+import java.io.File;
+
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.TransformerFactoryConfigurationError;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import jaxp.library.JAXPFileBaseTest;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.Document;
+import org.w3c.dom.DocumentFragment;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/*
+ * @summary Test Node interface
+ */
+public class NodeTest extends JAXPFileBaseTest {
+    @DataProvider(name = "feature-supported")
+    public Object[][] getFeatureSupportedList() throws Exception {
+        Document document = createDOMWithNS("Node01.xml");
+        Node node = document.getElementsByTagName("body").item(0);
+        return new Object[][] {
+                { node, "XML", "2.0", true },
+                { node, "HTML", "2.0", false },
+                { node, "Views", "2.0", false },
+                { node, "StyleSheets", "2.0", false },
+                { node, "CSS", "2.0", false },
+                { node, "CSS2", "2.0", false },
+                { node, "Events", "2.0", true },
+                { node, "UIEvents", "2.0", false },
+                { node, "MouseEvents", "2.0", false },
+                { node, "HTMLEvents", "2.0", false },
+                { node, "Traversal", "2.0", true },
+                { node, "Range", "2.0", true } };
+    }
+
+    /*
+     * Verify Node for feature supporting.
+     */
+    @Test(dataProvider = "feature-supported")
+    public void testHasFeature(Node node, String feature, String version, boolean supported) {
+        assertEquals(node.isSupported(feature, version), supported);
+    }
+
+    /*
+     * Test normalize method will merge adjacent Text nodes.
+     */
+    @Test
+    public void testNormalize() throws Exception {
+        Document document = createDOM("Node05.xml");
+
+        Element root = document.getDocumentElement();
+
+        Node node =  document.getElementsByTagName("title").item(0);
+        node.appendChild(document.createTextNode("test"));
+        root.normalize();
+        assertEquals(node.getChildNodes().item(0).getNodeValue(), "Typographytest");
+    }
+
+    /*
+     * Test cloneNode deeply, and the clone node can be appended on the same document.
+     */
+    @Test
+    public void testCloneNode() throws Exception {
+        Document document = createDOMWithNS("Node02.xml");
+
+        NodeList nodeList = document.getElementsByTagName("body");
+        Node node = nodeList.item(0);
+        Node cloneNode = node.cloneNode(true);
+
+        assertTrue(node.isEqualNode(cloneNode));
+        assertNotEquals(node, cloneNode);
+
+        nodeList = document.getElementsByTagName("html");
+        Node node2 = nodeList.item(0);
+        node2.appendChild(cloneNode);
+    }
+
+    /*
+     * Test importing node from one document to another.
+     */
+    @Test
+    public void testImportNode() throws Exception {
+        Document document = createDOMWithNS("Node02.xml");
+        Document otherDocument = createDOMWithNS("ElementSample01.xml");
+
+        NodeList otherNodeList = otherDocument.getElementsByTagName("body");
+        Node importedNode = otherNodeList.item(0);
+        Node clone = importedNode.cloneNode(true);
+
+        Node retNode = document.importNode(importedNode, true);
+        assertTrue(clone.isEqualNode(importedNode)); //verify importedNode is not changed
+        assertNotEquals(retNode, importedNode);
+        assertTrue(importedNode.isEqualNode(retNode));
+
+        retNode = document.importNode(importedNode, false);
+        assertTrue(clone.isEqualNode(importedNode)); //verify importedNode is not changed
+        assertEquals(retNode.getNodeName(), importedNode.getNodeName());
+        assertFalse(importedNode.isEqualNode(retNode));
+    }
+
+    /*
+     * Test inserting a document fragment before a particular node.
+     */
+    @Test
+    public void testInsertBefore() throws Exception {
+        Document document = createDOM("Node04.xml");
+
+        Element parentElement = (Element) document.getElementsByTagName("to").item(0);
+        Element element = (Element) document.getElementsByTagName("sender").item(0);
+        parentElement.insertBefore(createTestDocumentFragment(document), element);
+
+        String outputfile = "InsertBefore.out";
+        String goldfile = GOLDEN_DIR + "InsertBeforeGF.out";
+        outputXml(document, outputfile);
+        assertTrue(compareWithGold(goldfile, outputfile));
+    }
+
+
+    /*
+     * Test replacing a particular node with a document fragment.
+     */
+    @Test
+    public void testReplaceChild() throws Exception {
+        Document document = createDOM("Node04.xml");
+
+        Element parentElement = (Element) document.getElementsByTagName("to").item(0);
+        Element element = (Element) document.getElementsByTagName("sender").item(0);
+        parentElement.replaceChild(createTestDocumentFragment(document), element);
+
+        String outputfile = "ReplaceChild3.out";
+        String goldfile = GOLDEN_DIR + "ReplaceChild3GF.out";
+        outputXml(document, outputfile);
+        assertTrue(compareWithGold(goldfile, outputfile));
+    }
+
+    /*
+     * This test case checks for the replaceChild replacing a particular node
+     * with a node which was created from a different document than the one
+     * which is trying to use this method. It should throw a DOMException.
+     */
+    @Test(expectedExceptions = DOMException.class)
+    public void testReplaceChildNeg() throws Exception {
+        Document document = createDOM("Node04.xml");
+        Document doc2 = createNewDocument();
+
+        Element parentElement = (Element) document.getElementsByTagName("to").item(0);
+        Element element = (Element) document.getElementsByTagName("sender").item(0);
+        parentElement.replaceChild(createTestDocumentFragment(doc2), element);
+    }
+
+    private DocumentFragment createTestDocumentFragment(Document document) {
+        DocumentFragment docFragment = document.createDocumentFragment();
+        Element elem = document.createElement("dfElement");
+        elem.appendChild(document.createTextNode("Text in it"));
+        docFragment.appendChild(elem);
+        return docFragment;
+    }
+
+    private void outputXml(Document document, String outputFileName) throws TransformerFactoryConfigurationError, TransformerException {
+        DOMSource domSource = new DOMSource(document);
+        Transformer transformer = TransformerFactory.newInstance().newTransformer();
+        StreamResult streamResult = new StreamResult(new File(outputFileName));
+        transformer.transform(domSource, streamResult);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/NotationTest.java	Wed Apr 15 21:54:29 2015 -0700
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code 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 the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.w3c.dom.ptests;
+
+import static org.testng.Assert.assertEquals;
+import static org.w3c.dom.ptests.DOMTestUtil.createDOM;
+
+import java.io.IOException;
+
+import javax.xml.parsers.ParserConfigurationException;
+
+import jaxp.library.JAXPFileBaseTest;
+
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Notation;
+import org.xml.sax.SAXException;
+
+/*
+ * @summary Test for Notation interface
+ */
+public class NotationTest extends JAXPFileBaseTest {
+    /*
+     * Test getSystemId method.
+     */
+    @Test
+    public void testGetSystemId() throws Exception {
+        assertEquals(findNotation("gs").getSystemId(), "http://who.knows.where/");
+    }
+
+    /*
+     * Test getPublicId method.
+     */
+    @Test
+    public void testGetPublicId() throws Exception {
+        assertEquals(findNotation("pubname").getPublicId(), "pubId");
+    }
+
+    //find notation in Notation01.xml
+    private Notation findNotation(String name) throws SAXException, IOException, ParserConfigurationException {
+        Document document = createDOM("Notation01.xml");
+        NamedNodeMap nm = document.getDoctype().getNotations();
+        for (int i = 0; i < nm.getLength(); i++) {
+            if (nm.item(i).getNodeName().equals(name)) {
+                return (Notation) nm.item(i);
+            }
+        }
+        throw new RuntimeException("Notation: '" + name + "' not found.");
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/PITest.java	Wed Apr 15 21:54:29 2015 -0700
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code 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 the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.w3c.dom.ptests;
+
+import static org.testng.Assert.assertEquals;
+import static org.w3c.dom.ptests.DOMTestUtil.createDOMWithNS;
+import jaxp.library.JAXPFileBaseTest;
+
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.w3c.dom.ProcessingInstruction;
+
+/*
+ * @summary Test for the methods of Processing Instruction
+ */
+public class PITest extends JAXPFileBaseTest {
+    /*
+     * Test getData, setData and getTarget methods
+     */
+    @Test
+    public void test() throws Exception {
+        Document document = createDOMWithNS("PITest01.xml");
+        ProcessingInstruction pi = document.createProcessingInstruction("PI", "processing");
+        assertEquals(pi.getData(), "processing");
+        assertEquals(pi.getTarget(), "PI");
+
+        pi.setData("newProcessing");
+        assertEquals(pi.getData(), "newProcessing");
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/TextTest.java	Wed Apr 15 21:54:29 2015 -0700
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code 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 the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.w3c.dom.ptests;
+
+import static org.testng.Assert.assertEquals;
+import static org.w3c.dom.ptests.DOMTestUtil.createDOMWithNS;
+import static org.w3c.dom.ptests.DOMTestUtil.createNewDocument;
+
+import java.io.IOException;
+
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.testng.annotations.Test;
+import org.w3c.dom.CharacterData;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.Text;
+import org.xml.sax.SAXException;
+
+/*
+ * @summary Test for Text implementation returned by Document.createTextNode(String)
+ */
+public class TextTest extends AbstractCharacterDataTest {
+    /*
+     * Verify splitText method works as the spec.
+     */
+    @Test
+    public void testSplitText() throws Exception {
+        Document document = createDOMWithNS("Text01.xml");
+
+        NodeList nodeList = document.getElementsByTagName("p");
+        Node node = nodeList.item(0);
+        Text textNode = document.createTextNode("This is a text node");
+        node.appendChild(textNode);
+        int rawChildNum = node.getChildNodes().getLength();
+
+        textNode.splitText(0);
+        int increased = node.getChildNodes().getLength() - rawChildNum;
+        assertEquals(increased, 1);
+
+    }
+
+    @Override
+    protected CharacterData createCharacterData(String text) throws IOException, SAXException, ParserConfigurationException {
+        Document document = createNewDocument();
+        return document.createTextNode(text);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/TypeInfoTest.java	Wed Apr 15 21:54:29 2015 -0700
@@ -0,0 +1,138 @@
+/*
+ * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code 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 the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.w3c.dom.ptests;
+
+import static javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI;
+import static org.testng.Assert.assertEquals;
+
+import java.io.StringReader;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import jaxp.library.JAXPBaseTest;
+
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.TypeInfo;
+import org.xml.sax.InputSource;
+
+/*
+ * @summary Test getTypeName and getTypeNamespace methods of TypeInfo interface
+ */
+public class TypeInfoTest extends JAXPBaseTest {
+    /*
+     * Get the TypeInfo of the root element, and verify it.
+     */
+    @Test
+    public void test() throws Exception {
+        TypeInfo typeInfo = getTypeOfRoot(SCHEMA_INSTANCE, "<?xml version='1.0'?>\n" + "<test1 xmlns=\"testNS\"><code/></test1>\n");
+
+        assertEquals(typeInfo.getTypeName(), "Test");
+        assertEquals(typeInfo.getTypeNamespace(), "testNS");
+
+    }
+
+    private TypeInfo getTypeOfRoot(String schemaText, String docText) throws Exception {
+        Element root = getRoot(schemaText, docText);
+        return root.getSchemaTypeInfo();
+    }
+
+    private Element getRoot(String schemaText, String docText) throws Exception {
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+
+        InputSource inSchema = new InputSource(new StringReader(schemaText));
+        inSchema.setSystemId("schema.xsd");
+        dbf.setNamespaceAware(true);
+        dbf.setValidating(true);
+        dbf.setAttribute(SCHEMA_LANGUAGE, W3C_XML_SCHEMA_NS_URI);
+        dbf.setAttribute(SCHEMA_SOURCE, inSchema);
+
+        DocumentBuilder parser = dbf.newDocumentBuilder();
+
+        InputSource inSource = new InputSource(new StringReader(docText));
+        inSource.setSystemId("doc.xml");
+        Document document = parser.parse(inSource);
+
+        return document.getDocumentElement();
+    }
+
+    private static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+
+    private static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
+
+    /*
+     * Schema instance
+     */
+    private static final String SCHEMA_INSTANCE =
+            "<?xml version=\"1.0\"?>\n"
+            + "<xsd:schema xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"\n"
+            + "            xmlns:testNS=\"testNS\"\n"
+            + "            targetNamespace=\"testNS\" elementFormDefault=\"qualified\">\n"
+            + "    <xsd:element name=\"test1\" type=\"testNS:Test\"/>\n"
+            + "    \n"
+            + "    <xsd:complexType name=\"Test\">\n"
+            + "        <xsd:sequence>\n"
+            + "            <xsd:element name=\"description\" minOccurs=\"0\"/>\n"
+            + "            <xsd:element name=\"code\"/>\n"
+            + "        </xsd:sequence>\n"
+            + "    </xsd:complexType>\n"
+            + "\n"
+            + "    <xsd:element name=\"test2\">\n"
+            + "        <xsd:complexType>\n"
+            + "            <xsd:sequence>\n"
+            + "                <xsd:element name=\"description\" minOccurs=\"0\"/>\n"
+            + "                <xsd:element name=\"code\"/>\n"
+            + "            </xsd:sequence>\n"
+            + "        </xsd:complexType>\n"
+            + "    </xsd:element>\n"
+            + "\n"
+            + "    <xsd:element name=\"test3\" type=\"xsd:string\"/>\n"
+            + "\n"
+            + "    <xsd:element name=\"test4\" type=\"testNS:Test1\"/>\n"
+            + "\n"
+            + "    <xsd:simpleType name=\"Test1\">\n"
+            + "        <xsd:restriction base=\"xsd:string\"/>\n"
+            + "    </xsd:simpleType>\n"
+            + "\n"
+            + "    <xsd:element name=\"test5\">\n"
+            + "        <xsd:simpleType>\n"
+            + "            <xsd:restriction base=\"xsd:string\"/>\n"
+            + "        </xsd:simpleType>\n"
+            + "    </xsd:element>\n"
+            + "\n"
+            + "    <xsd:element name=\"test6\">\n"
+            + "        <xsd:complexType>\n"
+            + "            <xsd:complexContent>\n"
+            + "                <xsd:extension base=\"testNS:Test\">\n"
+            + "                    <xsd:attribute name=\"attr\" type=\"xsd:string\"/>\n"
+            + "                </xsd:extension>\n"
+            + "            </xsd:complexContent>\n"
+            + "        </xsd:complexType>\n"
+            + "    </xsd:element>\n"
+            + "\n"
+            + "</xsd:schema>\n";
+
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/w3c/dom/xmlfiles/Attr01.xml	Wed Apr 15 21:54:29 2015 -0700
@@ -0,0 +1,18 @@
+<?xml version="1.0"?>
+<html xmlns="http://www.w3.org/TR/REC-html40"
+      xmlns:b="urn:BooksAreUs.org:BookInfo">
+  <head>
+    <title>Typography</title>
+  </head>
+
+  <body>
+    <p> Welcome to the world of typography! Here is a book that you may find useful.</p>
+    <b:title style="font-family: sans-serif;">Digital Typography</b:title> 
+    <b:author>Donald Knuth</b:author>
+    <b:aaa>fjfjf</b:aaa>
+  </body>
+  <book b:category="research">Numerical Analysis of Partial Differential Equations</book>
+ <book category1="research">Numerical Analysis of Partial Differential Equations</book>
+
+
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/w3c/dom/xmlfiles/Attr2.xml	Wed Apr 15 21:54:29 2015 -0700
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE Book
+[
+        <!ELEMENT Name (#PCDATA)>
+        <!ATTLIST Name type CDATA "fiction">
+       
+]>
+
+<Book>
+  <Name>World's best book </Name>
+</Book>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/w3c/dom/xmlfiles/Attr3.xml	Wed Apr 15 21:54:29 2015 -0700
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE Book
+[
+        <!ELEMENT Name (#PCDATA)>
+        <!ATTLIST Name type CDATA #IMPLIED>
+]>
+
+<Book>
+  <Name>World's best book </Name>
+</Book>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/w3c/dom/xmlfiles/Comment01.xml	Wed Apr 15 21:54:29 2015 -0700
@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+<html xmlns="http://www.w3.org/TR/REC-html40"
+      xmlns:b="urn:BooksAreUs.org:BookInfo">
+  <head>
+    <title>Typography</title>
+  </head>
+
+  <body>
+    <p></p>
+    <b:title style="font-family: sans-serif;">Digital Typography</b:title> 
+    <b:author>Donald Knuth</b:author>
+    <book b:aaa ="value">fjfjf</book>
+  </body>
+
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/w3c/dom/xmlfiles/DocumentBuilderImpl02.dtd	Wed Apr 15 21:54:29 2015 -0700
@@ -0,0 +1,12 @@
+<!ELEMENT document ANY>
+<!ELEMENT title (#PCDATA)>
+<!ELEMENT publisher (#PCDATA)>
+<!ELEMENT book (#PCDATA)>
+<!ELEMENT bookurn (#PCDATA)>
+<!ATTLIST book price CDATA "$100">
+<!ATTLIST book author CDATA "Herold">
+<!ATTLIST book number ID #REQUIRED>
+<!ATTLIST bookurn xmlns CDATA "10">
+<!ATTLIST bookurn xmlns:isbn CDATA "10">
+<!ENTITY w "William">
+<!ENTITY s "Shakespeare">
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/w3c/dom/xmlfiles/DocumentTest01.xml	Wed Apr 15 21:54:29 2015 -0700
@@ -0,0 +1,12 @@
+<?xml version="1.0"?>
+ <html xmlns:h="http://www.w3.org/TR/REC-html40"
+       xmlns:b="urn:BooksAreUs.org:BookInfo">
+   <h:head>
+     <h:title>Typography</h:title>
+   </h:head>
+   <h:body>
+     <h:p>Welcome to the world of typography! Here is a book that you may find useful.</h:p>
+     <b:title h:style="font-family: sans-serif;">Digital Typography</b:title> 
+     <b:author>Donald Knuth</b:author>
+ </h:body>
+ </html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/w3c/dom/xmlfiles/DocumentType01.xml	Wed Apr 15 21:54:29 2015 -0700
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<!DOCTYPE note [                           
+<!ELEMENT note    (to,from,heading,body)>
+<!ELEMENT to      (#PCDATA)>
+<!ENTITY writer "Albert Einstein">
+<!ENTITY author "Albert Einstein">
+<!ENTITY test SYSTEM "test.txt">
+<!ENTITY % test2 "test2">
+<!ENTITY author "author">
+]>                         
+<note>
+<to>&writer;</to>
+
+</note> 
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/w3c/dom/xmlfiles/DocumentType03.xml	Wed Apr 15 21:54:29 2015 -0700
@@ -0,0 +1,19 @@
+<?xml version="1.0"?>
+<!DOCTYPE note [                           
+<!ELEMENT note    (to,from,heading,body)>
+<!ELEMENT to      (#PCDATA)>
+<!NOTATION gs SYSTEM "GhostScript">
+
+
+ <!NOTATION name PUBLIC "pubId">
+
+
+ <!NOTATION name PUBLIC "pubId" "sysId">
+
+
+ <!NOTATION name SYSTEM "sysId">
+]>                         
+<note>
+<to>lll</to>
+
+</note> 
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/w3c/dom/xmlfiles/DocumentType05.dtd	Wed Apr 15 21:54:29 2015 -0700
@@ -0,0 +1,12 @@
+<!ELEMENT document ANY>
+<!ELEMENT title (#PCDATA)>
+<!ELEMENT publisher (#PCDATA)>
+<!ELEMENT book (#PCDATA)>
+<!ELEMENT bookurn (#PCDATA)>
+<!ATTLIST book price CDATA "$100">
+<!ATTLIST book author CDATA "Herold">
+<!ATTLIST book number ID #REQUIRED>
+<!ATTLIST bookurn xmlns CDATA "10">
+<!ATTLIST bookurn xmlns:isbn CDATA "10">
+<!ENTITY w "William">
+<!ENTITY s "Shakespeare">
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/w3c/dom/xmlfiles/DocumentType05.xml	Wed Apr 15 21:54:29 2015 -0700
@@ -0,0 +1,28 @@
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE document SYSTEM "DocumentBuilderImpl02.dtd">
+<document>
+
+        Publishers of the Music of New York Women Composers
+
+        <title>The Publishers </title>
+
+        <publisher>
+        Alfred Publishing
+        &w;
+        15535 Morrison
+        South Oaks CA 91403
+        </publisher>
+
+        <book price="$100" author = "Herold" number = "no_11">
+                eXtensible Markup Language
+        </book>
+
+        <bookurn xmlns='urn:loc.gov:books'
+                   xmlns:isbn='urn:ISBN:0-395-36341-6'/>
+       
+
+        Publishers are not noted in report by time.
+
+</document>
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/w3c/dom/xmlfiles/ElementSample01.xml	Wed Apr 15 21:54:29 2015 -0700
@@ -0,0 +1,18 @@
+<?xml version="1.0"?>
+<html xmlns="http://www.w3.org/TR/REC-html40"
+      xmlns:b="urn:BooksAreUs.org:BookInfo">
+  <head>
+    <title>Typography</title>
+  </head>
+
+  <body>
+    <p> Welcome to the world of typography! Here is a book that you may find useful.</p>
+    <b:title style="font-family: sans-serif;">Digital Typography</b:title> 
+    <b:author>Donald Knuth</b:author>
+    <b:aaa>fjfjf</b:aaa>
+  </body>
+  <book b:category="research">Numerical Analysis of Partial Differential Equations</book>
+ <book category1="research">Numerical Analysis of Partial Differential Equations</book>
+
+
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/w3c/dom/xmlfiles/ElementSample02.xml	Wed Apr 15 21:54:29 2015 -0700
@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+<html xmlns="http://www.w3.org/TR/REC-html40"
+      xmlns:b="urn:BooksAreUs.org:BookInfo">
+  <head>
+    <title>Typography</title>
+  </head>
+
+  <body>
+    <p style = "font-family"> Welcome to the world of typography! Here is a book that you may find useful.</p>
+    <b:title style="font-family: sans-serif;">Digital Typography</b:title> 
+    <b:author>Donald Knuth</b:author>
+    <b:aaa>fjfjf</b:aaa>
+  </body>
+
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/w3c/dom/xmlfiles/ElementSample03.xml	Wed Apr 15 21:54:29 2015 -0700
@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+<html xmlns="http://www.w3.org/TR/REC-html40"
+      xmlns:b="urn:BooksAreUs.org:BookInfo">
+  <head>
+    <title>Typography</title>
+  </head>
+
+  <body>
+    <p> Welcome to the world of typography! Here is a book that you may find useful.</p>
+    <b:title b:style="font-family: sans-serif;">Digital Typography</b:title> 
+    <b:author>Donald Knuth</b:author>
+    <b:aaa>fjfjf</b:aaa>
+  </body>
+
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/w3c/dom/xmlfiles/ElementSample04.xml	Wed Apr 15 21:54:29 2015 -0700
@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+<html xmlns="http://www.w3.org/TR/REC-html40"
+      xmlns:b="urn:BooksAreUs.org:BookInfo">
+  <head>
+    <title>Typography</title>
+  </head>
+
+  <body>
+    <p name = "attributeValue"> Welcome to the world of typography! Here is a book that you may find useful.</p>
+    <b:title b:style="font-family: sans-serif;">Digital Typography</b:title> 
+    <b:author>Donald Knuth</b:author>
+    <b:aaa b:style="font-family">this is it</b:aaa>
+  </body>
+
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/w3c/dom/xmlfiles/NamedNodeMap01.xml	Wed Apr 15 21:54:29 2015 -0700
@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+<html xmlns="http://www.w3.org/TR/REC-html40"
+      xmlns:b="urn:BooksAreUs.org:BookInfo">
+  <head>
+    <title>Typography</title>
+  </head>
+
+  <body>
+    <p name = "attributeValue"> Welcome to the world of typography! Here is a book that you may find useful.</p>
+    <world b:style="font-family">Digital Typography</world> 
+    <b:author>Donald Knuth</b:author>
+    <book b:aaa ="value">fjfjf</book>
+  </body>
+
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/w3c/dom/xmlfiles/NamedNodeMap03.xml	Wed Apr 15 21:54:29 2015 -0700
@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+<html xmlns="http://www.w3.org/TR/REC-html40"
+      xmlns:b="urn:BooksAreUs.org:BookInfo">
+  <head>
+    <title>Typography</title>
+  </head>
+
+  <body>
+    <p name = "attributeValue"> Welcome to the world of typography! Here is a book that you may find useful.</p>
+    <b:title style="font-family: sans-serif;">Digital Typography</b:title> 
+    <b:author>Donald Knuth</b:author>
+    <book b:aaa ="value">fjfjf</book>
+  </body>
+
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/w3c/dom/xmlfiles/Node01.xml	Wed Apr 15 21:54:29 2015 -0700
@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+<html xmlns="http://www.w3.org/TR/REC-html40"
+      xmlns:b="urn:BooksAreUs.org:BookInfo">
+  <head>
+    <title>Typography</title>
+  </head>
+
+  <body>
+    <p name = "attributeValue"> Welcome to the world of typography! Here is a book that you may find useful.</p>
+    <world b:style="font-family">Digital Typography</world> 
+    <b:author>Donald Knuth</b:author>
+    <book b:aaa ="value">fjfjf</book>
+  </body>
+
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/w3c/dom/xmlfiles/Node02.xml	Wed Apr 15 21:54:29 2015 -0700
@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+<html xmlns="http://www.w3.org/TR/REC-html40"
+      xmlns:b="urn:BooksAreUs.org:BookInfo">
+  <head>
+    <title>Typography</title>
+  </head>
+
+  <body>
+    <p name = "attributeValue"> Welcome to the world of typography! Here is a book that you may find useful.</p>
+    <b:title style="font-family: sans-serif;">Digital Typography</b:title> 
+    <b:author>Donald Knuth</b:author>
+    <book b:aaa ="value">fjfjf</book>
+  </body>
+
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/w3c/dom/xmlfiles/Node04.xml	Wed Apr 15 21:54:29 2015 -0700
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<note>
+<to>
+<sender>John</sender>
+</to>
+<with>message   </with>
+<body> weekend!</body>
+</note> 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/w3c/dom/xmlfiles/Node05.xml	Wed Apr 15 21:54:29 2015 -0700
@@ -0,0 +1,6 @@
+<?xml version="1.0"?>
+<html>
+  <head>
+    <title>Typography</title>
+</head>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/w3c/dom/xmlfiles/Notation01.xml	Wed Apr 15 21:54:29 2015 -0700
@@ -0,0 +1,19 @@
+<?xml version="1.0"?>
+<!DOCTYPE note [                           
+<!ELEMENT note    (to,from,heading,body)>
+<!ELEMENT to      (#PCDATA)>
+<!NOTATION gs SYSTEM "http://who.knows.where/">
+
+
+ <!NOTATION pubname PUBLIC "pubId">
+
+
+ <!NOTATION comname PUBLIC "pubId" "sysId">
+
+
+ <!NOTATION name SYSTEM "http://who.knows.where/">
+]>                         
+<note>
+<to>lll</to>
+
+</note> 
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/w3c/dom/xmlfiles/PITest01.xml	Wed Apr 15 21:54:29 2015 -0700
@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+<html xmlns="http://www.w3.org/TR/REC-html40"
+      xmlns:b="urn:BooksAreUs.org:BookInfo">
+  <head>
+    <title>Typography</title>
+  </head>
+
+  <body>
+    <p name = "attributeValue"> Welcome to the world of typography! Here is a book that you may find useful.</p>
+    <world b:style="font-family">Digital Typography</world> 
+    <b:author>Donald Knuth</b:author>
+    <book b:aaa ="value">fjfjf</book>
+  </body>
+
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/w3c/dom/xmlfiles/Text01.xml	Wed Apr 15 21:54:29 2015 -0700
@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+<html xmlns="http://www.w3.org/TR/REC-html40"
+      xmlns:b="urn:BooksAreUs.org:BookInfo">
+  <head>
+    <title>Typography</title>
+  </head>
+
+  <body>
+    <p></p>
+    <b:title style="font-family: sans-serif;">Digital Typography</b:title> 
+    <b:author>Donald Knuth</b:author>
+    <book b:aaa ="value">fjfjf</book>
+  </body>
+
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/w3c/dom/xmlfiles/ee.xml	Wed Apr 15 21:54:29 2015 -0700
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<table name="table">
+<column name="Column" expr="col">
+&mkm;
+</column>
+</table>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/w3c/dom/xmlfiles/entitychild.xml	Wed Apr 15 21:54:29 2015 -0700
@@ -0,0 +1,15 @@
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE main [
+<!ELEMENT main (table)*>
+<!ELEMENT table (column)*>
+<!ATTLIST table name NMTOKEN #REQUIRED>
+<!ELEMENT column ANY>
+<!ATTLIST column name NMTOKEN #REQUIRED>
+<!ATTLIST column expr CDATA #REQUIRED>
+<!ENTITY mkm "mkrishnamohan">
+<!ENTITY ee SYSTEM "ee.xml">
+]>
+
+<main>
+&ee;
+</main>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/w3c/dom/xmlfiles/nodelist.xml	Wed Apr 15 21:54:29 2015 -0700
@@ -0,0 +1,2 @@
+<?xml version="1.0" standalone="no"?>
+<document>onenode</document>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/w3c/dom/xmlfiles/out/InsertBeforeGF.out	Wed Apr 15 21:54:29 2015 -0700
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?><note>
+<to>
+<dfElement>Text in it</dfElement><sender>John</sender>
+</to>
+<with>message   </with>
+<body> weekend!</body>
+</note>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/w3c/dom/xmlfiles/out/ReplaceChild3GF.out	Wed Apr 15 21:54:29 2015 -0700
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?><note>
+<to>
+<dfElement>Text in it</dfElement>
+</to>
+<with>message   </with>
+<body> weekend!</body>
+</note>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/libs/org/w3c/dom/ptests/DOMTestUtil.java	Wed Apr 15 21:54:29 2015 -0700
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code 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 the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.w3c.dom.ptests;
+
+import static jaxp.library.JAXPTestUtilities.FILE_SEP;
+import static jaxp.library.JAXPTestUtilities.getPathByClassName;
+
+import java.io.File;
+import java.io.IOException;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
+
+/*
+ * This class defines the path constant and common method
+ */
+public class DOMTestUtil {
+    /*
+     * XML source file directory.
+     */
+    public static final String XML_DIR = getPathByClassName(DOMTestUtil.class, ".." + FILE_SEP + "xmlfiles");
+
+    /*
+     * Golden validation files directory.
+     */
+    public static final String GOLDEN_DIR = getPathByClassName(DOMTestUtil.class, ".." + FILE_SEP + "xmlfiles" + FILE_SEP + "out");
+
+    /*
+     * Error Message for DOMException being expected.
+     */
+    public static final String DOMEXCEPTION_EXPECTED = "Should throw DOMException";
+
+    /*
+     * Create DOM Document from an xml file.
+     */
+    public static Document createDOM(String xmlFileName) throws SAXException, IOException, ParserConfigurationException {
+        return DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new File(XML_DIR + xmlFileName));
+    }
+
+    /*
+     * Create DOM Document from an xml file with setNamespaceAware(true).
+     */
+    public static Document createDOMWithNS(String xmlFileName) throws IOException, SAXException, ParserConfigurationException {
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setNamespaceAware(true);
+        return dbf.newDocumentBuilder().parse(new File(XML_DIR + xmlFileName));
+    }
+
+    /*
+     * Create a new DOM Document.
+     */
+    public static Document createNewDocument() throws ParserConfigurationException {
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        DocumentBuilder db = dbf.newDocumentBuilder();
+        return db.newDocument();
+    }
+}