changeset 656:48e4ec70cc1c jdk9-b37

Merge
author lana
date Thu, 23 Oct 2014 13:45:30 -0700
parents fe1280697db5 a9f2e9c339c9
children f697052647e3 a2bbbdef34e7
files
diffstat 108 files changed, 10098 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.xml/share/classes/com/sun/xml/internal/stream/util/BufferAllocator.java	Thu Oct 23 11:19:12 2014 -0700
+++ b/src/java.xml/share/classes/com/sun/xml/internal/stream/util/BufferAllocator.java	Thu Oct 23 13:45:30 2014 -0700
@@ -35,9 +35,9 @@
  * @author Santiago.PericasGeertsen@sun.com
  */
 public class BufferAllocator {
-    public static int SMALL_SIZE_LIMIT = 128;
-    public static int MEDIUM_SIZE_LIMIT = 2048;
-    public static int LARGE_SIZE_LIMIT = 8192;
+    private static final int SMALL_SIZE_LIMIT = 128;
+    private static final int MEDIUM_SIZE_LIMIT = 2048;
+    private static final int LARGE_SIZE_LIMIT = 8192;
 
     char[] smallCharBuffer;
     char[] mediumCharBuffer;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/TEST.ROOT	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,3 @@
+# This file identifies the root of the test-suite hierarchy.
+# It also contains test-suite configuration information.
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/TEST.properties	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,9 @@
+# This file identifies root(s) of the test-ng hierarchy.
+
+TestNG.dirs = .
+
+lib.dirs = /javax/xml/jaxp/libs
+
+# Tests that must run in othervm mode
+othervm.dirs= /javax/xml/jaxp/functional
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/DOMResultTest01.java	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,128 @@
+/*
+ * Copyright (c) 2014, 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 javax.xml.transform.ptests;
+
+import java.io.BufferedWriter;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMResult;
+import static javax.xml.transform.ptests.TransformerTestConst.CLASS_DIR;
+import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR;
+import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.sax.SAXTransformerFactory;
+import javax.xml.transform.sax.TransformerHandler;
+import static jaxp.library.JAXPTestUtilities.compareWithGold;
+import static jaxp.library.JAXPTestUtilities.failCleanup;
+import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import static org.testng.Assert.assertTrue;
+import org.testng.annotations.Test;
+import org.w3c.dom.Attr;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.XMLReaderFactory;
+
+/**
+ * DOM parse on test file to be compared with golden output file. No Exception
+ * is expected.
+ */
+public class DOMResultTest01 {
+    /**
+     * Unit test for simple DOM parsing.
+     */
+    @Test
+    public void testcase01() {
+        String resultFile = CLASS_DIR  + "domresult01.out";
+        String goldFile = GOLDEN_DIR  + "domresult01GF.out";
+        String xsltFile = XML_DIR + "cities.xsl";
+        String xmlFile = XML_DIR + "cities.xml";
+
+        try {
+            XMLReader reader = XMLReaderFactory.createXMLReader();
+            SAXTransformerFactory saxTFactory
+                    = (SAXTransformerFactory) TransformerFactory.newInstance();
+            SAXSource saxSource = new SAXSource(new InputSource(xsltFile));
+            TransformerHandler handler
+                    = saxTFactory.newTransformerHandler(saxSource);
+
+            DOMResult result = new DOMResult();
+
+            handler.setResult(result);
+            reader.setContentHandler(handler);
+            reader.parse(xmlFile);
+
+            Node node = result.getNode();
+            try (BufferedWriter writer = new BufferedWriter(new FileWriter(resultFile))) {
+                writeNodes(node, writer);
+            }
+            assertTrue(compareWithGold(goldFile, resultFile));
+        } catch (SAXException | TransformerConfigurationException
+                | IllegalArgumentException | IOException ex) {
+            failUnexpected(ex);
+        } finally {
+            try {
+                Path resultPath = Paths.get(resultFile);
+                if(Files.exists(resultPath))
+                    Files.delete(resultPath);
+            } catch (IOException ex) {
+                failCleanup(ex, resultFile);
+            }
+        }
+    }
+
+    /**
+     * Prints all node names, attributes to file
+     * @param node a node that need to be recursively access.
+     * @param bWriter file writer.
+     * @throws IOException if writing file failed.
+     */
+    private void writeNodes(Node node, BufferedWriter bWriter) throws IOException {
+        String str = "Node: " + node.getNodeName();
+        bWriter.write( str, 0,str.length());
+        bWriter.newLine();
+
+        NamedNodeMap nnm = node.getAttributes();
+        if (nnm != null && nnm.getLength() > 0)
+            for (int i=0; i<nnm.getLength(); i++) {
+                str = "AttributeName:" + ((Attr) nnm.item(i)).getName() +
+                      ", AttributeValue:" +((Attr) nnm.item(i)).getValue();
+                bWriter.write( str, 0,str.length());
+                bWriter.newLine();
+            }
+
+        NodeList kids = node.getChildNodes();
+        if (kids != null)
+            for (int i=0; i<kids.getLength(); i++)
+                writeNodes(kids.item(i), bWriter);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/ErrorListenerTest.java	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2014, 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 javax.xml.transform.ptests;
+
+import java.io.File;
+import javax.xml.transform.ErrorListener;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
+import javax.xml.transform.stream.StreamSource;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.fail;
+import org.testng.annotations.Test;
+
+/**
+ * Class containing the test cases for ErrorListener interface
+ */
+public class ErrorListenerTest implements ErrorListener {
+    /**
+     * Define ErrorListener's status.
+     */
+    private static enum ListenerStatus{NOT_INVOKED, ERROR, WARNING, FATAL};
+
+    /**
+     * No ErrorListener invoked at the beginning.
+     */
+    private volatile ListenerStatus status = ListenerStatus.NOT_INVOKED;
+
+    /**
+     * Expect a TransformerConfigurationException when transforming a file
+     * invalid.xsl that has some well-formedness error.
+     */
+    @Test
+    public void errorListener01() {
+        ErrorListenerTest listener = new ErrorListenerTest();
+        try {
+            TransformerFactory tfactory = TransformerFactory.newInstance();
+            tfactory.setErrorListener (listener);
+            tfactory.newTransformer(new StreamSource(
+                                        new File(XML_DIR + "invalid.xsl")));
+            fail("We expect an Exception here");
+        } catch (TransformerConfigurationException ex) {
+            assertEquals(listener.status, ListenerStatus.FATAL);
+        }
+    }
+
+    /**
+     * Set status as ERROR when receiving notification of a recoverable error.
+     * @param e The error information encapsulated in a transformer exception.
+     */
+    @Override
+    public void error (TransformerException e) {
+        this.status = ListenerStatus.ERROR;
+    }
+
+    /**
+     * Set status as WARNING when receiving notification of a warning.
+     * @param e The error information encapsulated in a transformer exception.
+     */
+    @Override
+    public void warning (TransformerException e) {
+        this.status = ListenerStatus.WARNING;
+    }
+
+    /**
+     * Set status as FATAL when receiving notification of a non-recoverable error.
+     * @param e The error information encapsulated in a transformer exception.
+     */
+    @Override
+    public void fatalError (TransformerException e) {
+        this.status = ListenerStatus.FATAL;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXSourceTest01.java	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2014, 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 javax.xml.transform.ptests;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.dom.DOMSource;
+import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.stream.StreamSource;
+import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertNull;
+import org.testng.annotations.Test;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+
+/**
+ * Unit test for SAXSource sourceToInputSource API.
+ */
+public class SAXSourceTest01 {
+    /**
+     * Test file name
+     */
+    private final String TEST_FILE = XML_DIR + "cities.xsl";
+
+    /**
+     * Test obtaining a SAX InputSource object from a Source object.
+     */
+    @Test
+    public void source2inputsource01() {
+        try {
+            StreamSource streamSource = new StreamSource (
+                                new FileInputStream (TEST_FILE));
+            assertNotNull(SAXSource.sourceToInputSource(streamSource));
+        } catch (FileNotFoundException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * This test case tries to get InputSource from DOMSource using
+     * sourceToInputSource method. It is not possible and hence null is
+     * expected. This is a negative test case
+     */
+    @Test
+    public void source2inputsource02() {
+        try {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setNamespaceAware(true);
+            dbf.newDocumentBuilder().parse(new File(TEST_FILE));
+            assertNull(SAXSource.sourceToInputSource(new DOMSource(null)));
+        } catch (ParserConfigurationException | SAXException | IOException ex) {
+            failUnexpected(ex);
+        }
+
+    }
+
+    /**
+     * This test case tries to get InputSource from SAXSource using
+     * sourceToInputSource method. This will also check if the systemId
+     * remained the same. This is a positive test case.
+     */
+    @Test
+    public void source2inputsource03() {
+        String SYSTEM_ID = "file:///" + XML_DIR;
+        try {
+            SAXSource saxSource =
+                    new SAXSource(new InputSource(new FileInputStream(TEST_FILE)));
+            saxSource.setSystemId(SYSTEM_ID);
+            assertEquals(SAXSource.sourceToInputSource(saxSource).getSystemId(),
+                    SYSTEM_ID);
+        } catch (FileNotFoundException ex) {
+            failUnexpected(ex);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest001.java	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2014, 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 javax.xml.transform.ptests;
+
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import javax.xml.transform.Result;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerFactory;
+import static javax.xml.transform.ptests.TransformerTestConst.CLASS_DIR;
+import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR;
+import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
+import javax.xml.transform.sax.SAXTransformerFactory;
+import javax.xml.transform.sax.TransformerHandler;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+import static jaxp.library.JAXPTestUtilities.compareWithGold;
+import static jaxp.library.JAXPTestUtilities.failCleanup;
+import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import static org.testng.Assert.assertTrue;
+import org.testng.annotations.Test;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.XMLReaderFactory;
+
+/**
+ * Test newTransformerhandler() method which takes StreamSource as argument can
+ * be set to XMLReader.
+ */
+public class SAXTFactoryTest001 {
+    /**
+     * SAXTFactory.newTransformerhandler() method which takes SAXSource as
+     * argument can be set to XMLReader. SAXSource has input XML file as its
+     * input source. XMLReader has a transformer handler which write out the
+     * result to output file. Test verifies output file is same as golden file.
+     */
+    @Test
+    public void testcase01() {
+        String outputFile = CLASS_DIR + "saxtf001.out";
+        String goldFile = GOLDEN_DIR + "saxtf001GF.out";
+        String xsltFile = XML_DIR + "cities.xsl";
+        String xmlFile = XML_DIR + "cities.xml";
+
+        try (FileOutputStream fos = new FileOutputStream(outputFile)) {
+            XMLReader reader = XMLReaderFactory.createXMLReader();
+            SAXTransformerFactory saxTFactory
+                    = (SAXTransformerFactory) TransformerFactory.newInstance();
+            TransformerHandler handler = saxTFactory.newTransformerHandler(
+                    new StreamSource(xsltFile));
+            Result result = new StreamResult(fos);
+            handler.setResult(result);
+            reader.setContentHandler(handler);
+            reader.parse(xmlFile);
+            assertTrue(compareWithGold(goldFile, outputFile));
+        } catch (SAXException | TransformerConfigurationException | IOException ex) {
+            failUnexpected(ex);
+        } finally {
+            try {
+                Path outputPath = Paths.get(outputFile);
+                if(Files.exists(outputPath))
+                    Files.delete(outputPath);
+            } catch (IOException ex) {
+                failCleanup(ex, outputFile);
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest002.java	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2014, 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 javax.xml.transform.ptests;
+
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import javax.xml.transform.Result;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerFactory;
+import static javax.xml.transform.ptests.TransformerTestConst.CLASS_DIR;
+import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR;
+import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.sax.SAXTransformerFactory;
+import javax.xml.transform.sax.TransformerHandler;
+import javax.xml.transform.stream.StreamResult;
+import static jaxp.library.JAXPTestUtilities.compareWithGold;
+import static jaxp.library.JAXPTestUtilities.failCleanup;
+import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import static org.testng.Assert.assertTrue;
+import org.testng.annotations.Test;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.XMLReaderFactory;
+
+/**
+ * Test newTransformerhandler() method which takes SAXSource as argument can
+ * be set to XMLReader.
+ */
+public class SAXTFactoryTest002 {
+    /**
+     * SAXTFactory.newTransformerhandler() method which takes SAXSource as
+     * argument can be set to XMLReader. SAXSource has input XML file as its
+     * input source. XMLReader has a content handler which write out the result
+     * to output file. Test verifies output file is same as golden file.
+     */
+    @Test
+    public void testcase01() {
+        String outputFile = CLASS_DIR + "saxtf002.out";
+        String goldFile = GOLDEN_DIR + "saxtf002GF.out";
+        String xsltFile = XML_DIR + "cities.xsl";
+        String xmlFile = XML_DIR + "cities.xml";
+
+        try (FileOutputStream fos = new FileOutputStream(outputFile);
+                FileInputStream fis = new FileInputStream(xsltFile)) {
+            XMLReader reader = XMLReaderFactory.createXMLReader();
+            SAXTransformerFactory saxTFactory
+                    = (SAXTransformerFactory) TransformerFactory.newInstance();
+            SAXSource ss = new SAXSource();
+            ss.setInputSource(new InputSource(fis));
+
+            TransformerHandler handler = saxTFactory.newTransformerHandler(ss);
+            Result result = new StreamResult(fos);
+            handler.setResult(result);
+            reader.setContentHandler(handler);
+            reader.parse(xmlFile);
+            assertTrue(compareWithGold(goldFile, outputFile));
+        } catch (SAXException | IOException | TransformerConfigurationException ex) {
+            failUnexpected(ex);
+        } finally {
+            try {
+                Path outputPath = Paths.get(outputFile);
+                if(Files.exists(outputPath))
+                    Files.delete(outputPath);
+            } catch (IOException ex) {
+                failCleanup(ex, outputFile);
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest003.java	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2014, 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 javax.xml.transform.ptests;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.Result;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import static javax.xml.transform.ptests.TransformerTestConst.CLASS_DIR;
+import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR;
+import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
+import javax.xml.transform.sax.SAXTransformerFactory;
+import javax.xml.transform.sax.TransformerHandler;
+import javax.xml.transform.stream.StreamResult;
+import static jaxp.library.JAXPTestUtilities.compareWithGold;
+import static jaxp.library.JAXPTestUtilities.failCleanup;
+import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import static org.testng.Assert.assertTrue;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.XMLReaderFactory;
+
+/**
+ * Test newTransformerhandler() method which takes DOMSource as argument can
+ * be set to XMLReader.
+ */
+public class SAXTFactoryTest003 {
+    /**
+     * Unit test for newTransformerhandler(Source). DcoumentBuilderFactory is
+     * namespace awareness, DocumentBuilder parse xslt file as DOMSource.
+     */
+    @Test
+    public void testcase01() {
+        String outputFile = CLASS_DIR + "saxtf003.out";
+        String goldFile = GOLDEN_DIR + "saxtf003GF.out";
+        String xsltFile = XML_DIR + "cities.xsl";
+        String xmlFile = XML_DIR + "cities.xml";
+
+        try (FileOutputStream fos = new FileOutputStream(outputFile)) {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setNamespaceAware(true);
+            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+            Document document = docBuilder.parse(new File(xsltFile));
+            Node node = (Node)document;
+            DOMSource domSource= new DOMSource(node);
+
+            XMLReader reader = XMLReaderFactory.createXMLReader();
+            SAXTransformerFactory saxTFactory
+                    = (SAXTransformerFactory)TransformerFactory.newInstance();
+            TransformerHandler handler =
+                        saxTFactory.newTransformerHandler(domSource);
+            Result result = new StreamResult(fos);
+            handler.setResult(result);
+            reader.setContentHandler(handler);
+            reader.parse(xmlFile);
+            assertTrue(compareWithGold(goldFile, outputFile));
+        } catch (TransformerConfigurationException | ParserConfigurationException
+                | SAXException | IOException ex) {
+            failUnexpected(ex);
+        } finally {
+            try {
+                Path outputPath = Paths.get(outputFile);
+                if(Files.exists(outputPath))
+                    Files.delete(outputPath);
+            } catch (IOException ex) {
+                failCleanup(ex, outputFile);
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest004.java	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2014, 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 javax.xml.transform.ptests;
+
+import java.io.File;
+import java.io.IOException;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
+import javax.xml.transform.sax.SAXTransformerFactory;
+import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
+
+/*
+ * TransformerConfigurationException expected when there is relative URI is used
+ * in citiesinclude.xsl file
+ */
+public class SAXTFactoryTest004 {
+    /**
+     * Negative test for newTransformerHandler when relative URI is in XML file.
+     * @throws TransformerConfigurationException If for some reason the
+     * TransformerHandler can not be created.
+     */
+    @Test(expectedExceptions = TransformerConfigurationException.class)
+    public void transformerHandlerTest01() throws TransformerConfigurationException {
+        try {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setNamespaceAware(true);
+            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+            Document document = docBuilder.parse(new File(XML_DIR + "citiesinclude.xsl"));
+            DOMSource domSource= new DOMSource(document);
+            SAXTransformerFactory saxTFactory
+                    = (SAXTransformerFactory)TransformerFactory.newInstance();
+            saxTFactory.newTransformerHandler(domSource);
+        } catch (ParserConfigurationException | IOException | SAXException ex) {
+            failUnexpected(ex);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest005.java	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2014, 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 javax.xml.transform.ptests;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.Result;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import static javax.xml.transform.ptests.TransformerTestConst.CLASS_DIR;
+import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR;
+import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
+import javax.xml.transform.sax.SAXTransformerFactory;
+import javax.xml.transform.sax.TransformerHandler;
+import javax.xml.transform.stream.StreamResult;
+import static jaxp.library.JAXPTestUtilities.compareWithGold;
+import static jaxp.library.JAXPTestUtilities.failCleanup;
+import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import static org.testng.Assert.assertTrue;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.XMLReaderFactory;
+
+/**
+ * Test SAXSource API when relative URI is used in xsl file and SystemId was set
+ */
+public class SAXTFactoryTest005 {
+    /**
+     * Unit test for XMLReader parsing when relative URI is used in xsl file and
+     * SystemId was set.
+     */
+    @Test
+    public void testcase01() {
+        String outputFile = CLASS_DIR + "saxtf005.out";
+        String goldFile = GOLDEN_DIR + "saxtf005GF.out";
+        String xsltFile = XML_DIR + "citiesinclude.xsl";
+        String xmlFile = XML_DIR + "cities.xml";
+
+        try (FileOutputStream fos = new FileOutputStream(outputFile)) {
+            XMLReader reader = XMLReaderFactory.createXMLReader();
+            SAXTransformerFactory saxTFactory
+                    = (SAXTransformerFactory)TransformerFactory.newInstance();
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setNamespaceAware(true);
+            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+            Document document = docBuilder.parse(new File(xsltFile));
+            Node node = (Node)document;
+            DOMSource domSource= new DOMSource(node);
+
+            domSource.setSystemId("file:///" + XML_DIR);
+
+            TransformerHandler handler =
+                        saxTFactory.newTransformerHandler(domSource);
+            Result result = new StreamResult(fos);
+
+            handler.setResult(result);
+            reader.setContentHandler(handler);
+            reader.parse(xmlFile);
+            assertTrue(compareWithGold(goldFile, outputFile));
+        } catch (TransformerConfigurationException | ParserConfigurationException
+                | SAXException | IOException ex) {
+            failUnexpected(ex);
+        } finally {
+            try {
+                Path outputPath = Paths.get(outputFile);
+                if(Files.exists(outputPath))
+                    Files.delete(outputPath);
+            } catch (IOException ex) {
+                failCleanup(ex, outputFile);
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest006.java	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2014, 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 javax.xml.transform.ptests;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.Result;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.sax.SAXTransformerFactory;
+import javax.xml.transform.sax.TransformerHandler;
+import javax.xml.transform.stream.StreamResult;
+import static jaxp.library.JAXPTestUtilities.compareWithGold;
+import static jaxp.library.JAXPTestUtilities.failCleanup;
+import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import static org.testng.Assert.assertTrue;
+import org.testng.annotations.Test;
+import org.w3c.dom.Node;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.XMLReaderFactory;
+
+/**
+ * Test newTransformerHandler with a DOMSource and StreamResult set.
+ */
+public class SAXTFactoryTest006 extends TransformerTestConst{
+    /**
+     * Unit test newTransformerHandler with a DOMSource.
+     */
+    @Test
+    public void testcase01() {
+        String outputFile = CLASS_DIR + "saxtf006.out";
+        String goldFile = GOLDEN_DIR + "saxtf006GF.out";
+        String xsltFile = XML_DIR + "citiesinclude.xsl";
+        String xmlFile = XML_DIR + "cities.xml";
+
+        try (FileOutputStream fos = new FileOutputStream(outputFile)) {
+            XMLReader reader = XMLReaderFactory.createXMLReader();
+            SAXTransformerFactory saxTFactory
+                    = (SAXTransformerFactory)TransformerFactory.newInstance();
+
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setNamespaceAware(true);
+            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+            Node node = (Node)docBuilder.parse(new File(xsltFile));
+
+            DOMSource domSource = new DOMSource(node, "file:///" + XML_DIR);
+            TransformerHandler handler =
+                        saxTFactory.newTransformerHandler(domSource);
+
+            Result result = new StreamResult(fos);
+            handler.setResult(result);
+            reader.setContentHandler(handler);
+            reader.parse(xmlFile);
+            assertTrue(compareWithGold(goldFile, outputFile));
+        } catch (TransformerConfigurationException | ParserConfigurationException
+                | SAXException | IOException ex) {
+            failUnexpected(ex);
+        } finally {
+            try {
+                Path outputPath = Paths.get(outputFile);
+                if(Files.exists(outputPath))
+                    Files.delete(outputPath);
+            } catch (IOException ex) {
+                failCleanup(ex, outputFile);
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest008.java	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2014, 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 javax.xml.transform.ptests;
+
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import javax.xml.transform.Result;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerFactory;
+import static javax.xml.transform.ptests.TransformerTestConst.CLASS_DIR;
+import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR;
+import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
+import javax.xml.transform.sax.SAXTransformerFactory;
+import javax.xml.transform.sax.TemplatesHandler;
+import javax.xml.transform.sax.TransformerHandler;
+import javax.xml.transform.stream.StreamResult;
+import static jaxp.library.JAXPTestUtilities.compareWithGold;
+import static jaxp.library.JAXPTestUtilities.failCleanup;
+import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import static org.testng.Assert.assertTrue;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.XMLReaderFactory;
+
+/**
+ * Test newTransformerHandler with a Template Handler.
+ */
+public class SAXTFactoryTest008 {
+    /**
+     * Test newTransformerHandler with a Template Handler.
+     */
+    public void testcase01() {
+        String outputFile = CLASS_DIR + "saxtf008.out";
+        String goldFile = GOLDEN_DIR + "saxtf008GF.out";
+        String xsltFile = XML_DIR + "cities.xsl";
+        String xmlFile = XML_DIR + "cities.xml";
+
+        try (FileOutputStream fos = new FileOutputStream(outputFile)) {
+            XMLReader reader = XMLReaderFactory.createXMLReader();
+            SAXTransformerFactory saxTFactory
+                    = (SAXTransformerFactory)TransformerFactory.newInstance();
+
+            TemplatesHandler thandler = saxTFactory.newTemplatesHandler();
+            reader.setContentHandler(thandler);
+            reader.parse(xsltFile);
+            TransformerHandler tfhandler
+                    = saxTFactory.newTransformerHandler(thandler.getTemplates());
+
+            Result result = new StreamResult(fos);
+            tfhandler.setResult(result);
+
+            reader.setContentHandler(tfhandler);
+            reader.parse(xmlFile);
+            assertTrue(compareWithGold(goldFile, outputFile));
+        } catch (SAXException | IOException | TransformerConfigurationException ex) {
+            failUnexpected(ex);
+        } finally {
+            try {
+                Path outputPath = Paths.get(outputFile);
+                if(Files.exists(outputPath))
+                    Files.delete(outputPath);
+            } catch (IOException ex) {
+                failCleanup(ex, outputFile);
+            }
+        }
+  }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest009.java	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2014, 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 javax.xml.transform.ptests;
+
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import javax.xml.transform.Result;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerFactory;
+import static javax.xml.transform.ptests.TransformerTestConst.CLASS_DIR;
+import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR;
+import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
+import javax.xml.transform.sax.SAXTransformerFactory;
+import javax.xml.transform.sax.TemplatesHandler;
+import javax.xml.transform.sax.TransformerHandler;
+import javax.xml.transform.stream.StreamResult;
+import static jaxp.library.JAXPTestUtilities.compareWithGold;
+import static jaxp.library.JAXPTestUtilities.failCleanup;
+import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import static org.testng.Assert.assertTrue;
+import org.testng.annotations.Test;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.XMLReaderFactory;
+
+/**
+ * Test newTransformerHandler with a Template Handler along with a relative URI
+ * in the xslt file.
+ */
+public class SAXTFactoryTest009 {
+    /**
+     * Test newTransformerHandler with a Template Handler along with a relative
+     * URI in the xslt file.
+     */
+    @Test
+    public void testcase01() {
+        String outputFile = CLASS_DIR + "saxtf009.out";
+        String goldFile = GOLDEN_DIR + "saxtf009GF.out";
+        String xsltFile = XML_DIR + "citiesinclude.xsl";
+        String xmlFile = XML_DIR + "cities.xml";
+
+        try (FileOutputStream fos = new FileOutputStream(outputFile)) {
+            XMLReader reader = XMLReaderFactory.createXMLReader();
+            SAXTransformerFactory saxTFactory
+                    = (SAXTransformerFactory)TransformerFactory.newInstance();
+
+            TemplatesHandler thandler = saxTFactory.newTemplatesHandler();
+            thandler.setSystemId("file:///" + XML_DIR);
+            reader.setContentHandler(thandler);
+            reader.parse(xsltFile);
+            TransformerHandler tfhandler=
+                saxTFactory.newTransformerHandler(thandler.getTemplates());
+            Result result = new StreamResult(fos);
+            tfhandler.setResult(result);
+            reader.setContentHandler(tfhandler);
+            reader.parse(xmlFile);
+            assertTrue(compareWithGold(goldFile, outputFile));
+        } catch (SAXException | IOException | TransformerConfigurationException ex) {
+            failUnexpected(ex);
+        } finally {
+            try {
+                Path outputPath = Paths.get(outputFile);
+                if(Files.exists(outputPath))
+                    Files.delete(outputPath);
+            } catch (IOException ex) {
+                failCleanup(ex, outputFile);
+            }
+        }
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest010.java	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2014, 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 javax.xml.transform.ptests;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerFactory;
+import static javax.xml.transform.ptests.TransformerTestConst.CLASS_DIR;
+import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR;
+import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
+import javax.xml.transform.sax.SAXTransformerFactory;
+import javax.xml.transform.stream.StreamSource;
+import static jaxp.library.JAXPTestUtilities.compareWithGold;
+import static jaxp.library.JAXPTestUtilities.failCleanup;
+import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import static org.testng.Assert.assertTrue;
+import org.testng.annotations.Test;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLFilter;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.XMLReaderFactory;
+
+/**
+ * Test XMLFilter parse InputSource along with customized ContentHandler.
+ */
+public class SAXTFactoryTest010 {
+    /**
+     * Unit test for contentHandler setter/getter along reader as handler's
+     * parent.
+     */
+    @Test
+    public void testcase01() {
+        String outputFile = CLASS_DIR + "saxtf010.out";
+        String goldFile = GOLDEN_DIR + "saxtf010GF.out";
+        String xsltFile = XML_DIR + "cities.xsl";
+        String xmlFile = XML_DIR + "cities.xml";
+
+        try {
+            // The transformer will use a SAX parser as it's reader.
+            XMLReader reader = XMLReaderFactory.createXMLReader();
+
+            SAXTransformerFactory saxTFactory
+                    = (SAXTransformerFactory)TransformerFactory.newInstance();
+            XMLFilter filter =
+                saxTFactory.newXMLFilter(new StreamSource(xsltFile));
+
+            filter.setParent(reader);
+            filter.setContentHandler(new MyContentHandler(outputFile));
+
+            // Now, when you call transformer.parse, it will set itself as
+            // the content handler for the parser object (it's "parent"), and
+            // will then call the parse method on the parser.
+            filter.parse(new InputSource(xmlFile));
+            assertTrue(compareWithGold(goldFile, outputFile));
+        } catch (SAXException | IOException | TransformerConfigurationException ex) {
+            failUnexpected(ex);
+        } finally {
+            try {
+                Path outputPath = Paths.get(outputFile);
+                if(Files.exists(outputPath))
+                    Files.delete(outputPath);
+            } catch (IOException ex) {
+                failCleanup(ex, outputFile);
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest011.java	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2014, 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 javax.xml.transform.ptests;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import static javax.xml.transform.ptests.TransformerTestConst.CLASS_DIR;
+import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR;
+import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
+import javax.xml.transform.sax.SAXTransformerFactory;
+import static jaxp.library.JAXPTestUtilities.compareWithGold;
+import static jaxp.library.JAXPTestUtilities.failCleanup;
+import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import static org.testng.Assert.assertTrue;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLFilter;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.XMLReaderFactory;
+
+/**
+ * Test XMLFilter parse InputSource along with customized ContentHandler by
+ * using SAX parser as it's reader.
+ */
+public class SAXTFactoryTest011 {
+    /**
+     * Unit test for contentHandler setter/getter with parent.
+     */
+    @Test
+    public void testcase01() {
+        String outputFile = CLASS_DIR + "saxtf011.out";
+        String goldFile = GOLDEN_DIR + "saxtf011GF.out";
+        String xsltFile = XML_DIR + "cities.xsl";
+        String xmlFile = XML_DIR + "cities.xml";
+
+        try {
+            // The transformer will use a SAX parser as it's reader.
+            XMLReader reader = XMLReaderFactory.createXMLReader();
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setNamespaceAware(true);
+            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+            Document document = docBuilder.parse(new File(xsltFile));
+            Node node = (Node)document;
+            DOMSource domSource= new DOMSource(node);
+
+            SAXTransformerFactory saxTFactory
+                    = (SAXTransformerFactory)TransformerFactory.newInstance();
+            XMLFilter filter = saxTFactory.newXMLFilter(domSource);
+
+            filter.setParent(reader);
+            filter.setContentHandler(new MyContentHandler(outputFile));
+
+            // Now, when you call transformer.parse, it will set itself as
+            // the content handler for the parser object (it's "parent"), and
+            // will then call the parse method on the parser.
+            filter.parse(new InputSource(xmlFile));
+            assertTrue(compareWithGold(goldFile, outputFile));
+        } catch (SAXException | IOException | TransformerConfigurationException
+                | ParserConfigurationException ex) {
+            failUnexpected(ex);
+        } finally {
+            try {
+                Path outputPath = Paths.get(outputFile);
+                if(Files.exists(outputPath))
+                    Files.delete(outputPath);
+            } catch (IOException ex) {
+                failCleanup(ex, outputFile);
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest012.java	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2014, 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 javax.xml.transform.ptests;
+
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerFactory;
+import static javax.xml.transform.ptests.TransformerTestConst.CLASS_DIR;
+import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR;
+import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.sax.SAXTransformerFactory;
+import static jaxp.library.JAXPTestUtilities.compareWithGold;
+import static jaxp.library.JAXPTestUtilities.failCleanup;
+import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import static org.testng.Assert.assertTrue;
+import org.testng.annotations.Test;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLFilter;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.XMLReaderFactory;
+
+/**
+ * Test XMLFilter parse InputSource along with customized ContentHandler by
+ * using SAX parser as it's reader.
+ */
+public class SAXTFactoryTest012 {
+    /**
+     * Unit test for contentHandler setter/getter.
+     */
+    @Test
+    public void testcase01() {
+        String outputFile = CLASS_DIR + "saxtf012.out";
+        String goldFile = GOLDEN_DIR + "saxtf012GF.out";
+        String xsltFile = XML_DIR + "cities.xsl";
+        String xmlFile = XML_DIR + "cities.xml";
+        try {
+            // The transformer will use a SAX parser as it's reader.
+            XMLReader reader = XMLReaderFactory.createXMLReader();
+
+            InputSource is = new InputSource(new FileInputStream(xsltFile));
+            SAXSource saxSource = new SAXSource();
+            saxSource.setInputSource(is);
+
+            SAXTransformerFactory saxTFactory = (SAXTransformerFactory)TransformerFactory.newInstance();
+            XMLFilter filter = saxTFactory.newXMLFilter(saxSource);
+
+            filter.setParent(reader);
+            filter.setContentHandler(new MyContentHandler(outputFile));
+
+            // Now, when you call transformer.parse, it will set itself as
+            // the content handler for the parser object (it's "parent"), and
+            // will then call the parse method on the parser.
+            filter.parse(new InputSource(xmlFile));
+            assertTrue(compareWithGold(goldFile, outputFile));
+        } catch (SAXException | IOException | TransformerConfigurationException ex) {
+            failUnexpected(ex);
+        } finally {
+            try {
+                Path outputPath = Paths.get(outputFile);
+                if(Files.exists(outputPath))
+                    Files.delete(outputPath);
+            } catch (IOException ex) {
+                failCleanup(ex, outputFile);
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest013.java	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2014, 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 javax.xml.transform.ptests;
+
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerFactory;
+import static javax.xml.transform.ptests.TransformerTestConst.CLASS_DIR;
+import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR;
+import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
+import javax.xml.transform.sax.SAXTransformerFactory;
+import javax.xml.transform.sax.TemplatesHandler;
+import static jaxp.library.JAXPTestUtilities.compareWithGold;
+import static jaxp.library.JAXPTestUtilities.failCleanup;
+import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import static org.testng.Assert.assertTrue;
+import org.testng.annotations.Test;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLFilter;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.XMLReaderFactory;
+
+/**
+ * Test XMLFilter parse InputSource along with TemplatesHandler.
+ */
+public class SAXTFactoryTest013 {
+    /**
+     * Unit test for TemplatesHandler setter/getter.
+     */
+    @Test
+    public  void testcase01() {
+        String outputFile = CLASS_DIR + "saxtf013.out";
+        String goldFile = GOLDEN_DIR + "saxtf013GF.out";
+        String xsltFile = XML_DIR + "cities.xsl";
+        String xmlFile = XML_DIR + "cities.xml";
+
+        try {
+            // The transformer will use a SAX parser as it's reader.
+            XMLReader reader = XMLReaderFactory.createXMLReader();
+
+            SAXTransformerFactory saxTFactory
+                    = (SAXTransformerFactory) TransformerFactory.newInstance();
+            TemplatesHandler thandler = saxTFactory.newTemplatesHandler();
+            // I have put this as it was complaining about systemid
+            thandler.setSystemId("file:///" + CLASS_DIR);
+
+            reader.setContentHandler(thandler);
+            reader.parse(xsltFile);
+            XMLFilter filter
+                    = saxTFactory.newXMLFilter(thandler.getTemplates());
+            filter.setParent(reader);
+
+            filter.setContentHandler(
+                    new MyContentHandler(outputFile));
+            filter.parse(new InputSource(new FileInputStream(xmlFile)));
+            assertTrue(compareWithGold(goldFile, outputFile));
+        } catch (SAXException | IOException | TransformerConfigurationException ex) {
+            failUnexpected(ex);
+        } finally {
+            try {
+                Path outputPath = Paths.get(outputFile);
+                if(Files.exists(outputPath))
+                    Files.delete(outputPath);
+            } catch (IOException ex) {
+                failCleanup(ex, outputFile);
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/StreamResultTest01.java	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2014, 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 javax.xml.transform.ptests;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Properties;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import static javax.xml.transform.ptests.TransformerTestConst.CLASS_DIR;
+import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
+
+/**
+ * Test a StreamResult using a file name that contains URL characters that need
+ * to be encoded.
+ */
+public class StreamResultTest01 {
+    /**
+     * Unit test for StreamResult.
+     */
+    @Test
+    public void testcase01() {
+        // Set Transformer properties
+        Properties transformProperties = new Properties();
+        transformProperties.put("method", "xml");
+        transformProperties.put("encoding", "UTF-8");
+        transformProperties.put("omit-xml-declaration", "yes");
+        transformProperties.put("{http://xml.apache.org/xslt}indent-amount", "0");
+        transformProperties.put("indent", "no");
+        transformProperties.put("standalone", "no");
+        transformProperties.put("version", "1.0");
+        transformProperties.put("media-type", "text/xml");
+
+        String[] fileNames = {
+            "StreamResult01.out",
+            "StreamResult 02.out",
+            "StreamResult#03.out"
+        };
+
+        String xslFile = XML_DIR + "cities.xsl";
+        String xmlFile = XML_DIR + "cities.xml";
+
+        Arrays.stream(fileNames).forEach(file -> {
+            try {
+                DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+                dbf.setNamespaceAware(true);
+                DocumentBuilder db = dbf.newDocumentBuilder();
+                Document document = db.parse(new File(xslFile));
+                DOMSource domSource = new DOMSource(document);
+                StreamSource streamSource = new StreamSource(new FileInputStream(xmlFile));
+
+                File streamResultFile = new File(CLASS_DIR + file);
+                StreamResult streamResult = new StreamResult(streamResultFile);
+
+                Transformer transformer = TransformerFactory.newInstance().newTransformer(domSource);
+                transformer.setOutputProperties(transformProperties);
+                transformer.transform(streamSource, streamResult);
+            } catch (SAXException | IOException | ParserConfigurationException
+                    | TransformerException ex) {
+                failUnexpected(ex);
+            }
+        });
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TfClearParamTest.java	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,264 @@
+/*
+ * Copyright (c) 2014, 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 javax.xml.transform.ptests;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.stream.StreamSource;
+import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNull;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+/**
+ * Class containing the test cases for SAXParserFactory API
+ */
+public class TfClearParamTest {
+    /**
+     * Test xslt file.
+     */
+    private final String XSL_FILE = XML_DIR + "cities.xsl";
+
+    /**
+     * Long parameter name embedded with a URI.
+     */
+    private final String LONG_PARAM_NAME = "{http://xyz.foo.com/yada/baz.html}foo";
+
+    /**
+     * Short parameter name.
+     */
+    private final String SHORT_PARAM_NAME = "foo";
+
+    /**
+     * Parameter value.
+     */
+    private final String PARAM_VALUE = "xyz";
+
+    /**
+     * Obtains transformer's parameter with the same name that set before. Value
+     * should be same as set one.
+     */
+    @Test
+    public void clear01() {
+        try {
+            Transformer transformer = TransformerFactory.newInstance().newTransformer();
+            transformer.setParameter(LONG_PARAM_NAME, PARAM_VALUE);
+            assertEquals(transformer.getParameter(LONG_PARAM_NAME).toString(), PARAM_VALUE);
+        } catch (TransformerConfigurationException ex) {
+            failUnexpected(ex);
+        }
+
+    }
+
+    /**
+     * Obtains transformer's parameter with the a name that wasn't set before.
+     * Null is expected.
+     */
+    @Test
+    public void clear02() {
+        try {
+            Transformer transformer = TransformerFactory.newInstance().newTransformer();
+            transformer.setParameter(LONG_PARAM_NAME, PARAM_VALUE);
+            transformer.clearParameters();
+            assertNull(transformer.getParameter(LONG_PARAM_NAME));
+        } catch (TransformerConfigurationException ex){
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * Obtains transformer's parameter whose initiated with a stream source with
+     * the a name that set before. Value should be same as set one.
+     */
+    @Test
+    public void clear03() {
+        try {
+            Transformer transformer = TransformerFactory.newInstance().
+                    newTransformer(new StreamSource(new File(XSL_FILE)));
+
+            transformer.setParameter(LONG_PARAM_NAME, PARAM_VALUE);
+            assertEquals(transformer.getParameter(LONG_PARAM_NAME), PARAM_VALUE);
+        } catch (TransformerConfigurationException ex){
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * Obtains transformer's parameter whose initiated with a stream source with
+     * the a name that wasn't set before. Null is expected.
+     */
+    @Test
+    public void clear04() {
+        try {
+            Transformer transformer = TransformerFactory.newInstance().
+                    newTransformer(new StreamSource(new File(XSL_FILE)));
+            transformer.setParameter(LONG_PARAM_NAME, PARAM_VALUE);
+            transformer.clearParameters();
+            assertNull(transformer.getParameter(LONG_PARAM_NAME));
+        } catch (TransformerConfigurationException ex){
+            failUnexpected(ex);
+        }
+
+    }
+
+    /**
+     * Obtains transformer's parameter whose initiated with a sax source with
+     * the a name that set before. Value should be same as set one.
+     */
+    @Test
+    public void clear05() {
+        try {
+            InputSource is = new InputSource(new FileInputStream(XSL_FILE));
+            SAXSource saxSource = new SAXSource();
+            saxSource.setInputSource(is);
+
+            Transformer transformer = TransformerFactory.newInstance().newTransformer(saxSource);
+
+            transformer.setParameter(LONG_PARAM_NAME, PARAM_VALUE);
+            assertEquals(transformer.getParameter(LONG_PARAM_NAME), PARAM_VALUE);
+        } catch (FileNotFoundException | TransformerConfigurationException ex){
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * Obtains transformer's parameter whose initiated with a sax source with
+     * the a name that wasn't set before. Null is expected.
+     */
+    @Test
+    public void clear06() {
+        try {
+            InputSource is = new InputSource(new FileInputStream(XSL_FILE));
+            SAXSource saxSource = new SAXSource();
+            saxSource.setInputSource(is);
+
+            Transformer transformer = TransformerFactory.newInstance().newTransformer(saxSource);
+
+            transformer.setParameter(LONG_PARAM_NAME, PARAM_VALUE);
+            transformer.clearParameters();
+            assertNull(transformer.getParameter(LONG_PARAM_NAME));
+        } catch (FileNotFoundException | TransformerConfigurationException ex){
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * Obtains transformer's parameter whose initiated with a dom source with
+     * the a name that set before. Value should be same as set one.
+     */
+    @Test
+    public void clear07() {
+        try {
+            TransformerFactory tfactory = TransformerFactory.newInstance();
+
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setNamespaceAware(true);
+            DocumentBuilder db = dbf.newDocumentBuilder();
+            Document document = db.parse(new File(XSL_FILE));
+            DOMSource domSource = new DOMSource((Node)document);
+
+            Transformer transformer = tfactory.newTransformer(domSource);
+
+            transformer.setParameter(LONG_PARAM_NAME, PARAM_VALUE);
+            assertEquals(transformer.getParameter(LONG_PARAM_NAME), PARAM_VALUE);
+        } catch (IOException | ParserConfigurationException
+                | TransformerConfigurationException | SAXException ex){
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * Obtains transformer's parameter whose initiated with a dom source with
+     * the a name that wasn't set before. Null is expected.
+     */
+    @Test
+    public void clear08() {
+        try {
+            TransformerFactory tfactory = TransformerFactory.newInstance();
+
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setNamespaceAware(true);
+            DocumentBuilder db = dbf.newDocumentBuilder();
+            Document document = db.parse(new File(XSL_FILE));
+            DOMSource domSource = new DOMSource((Node)document);
+
+            Transformer transformer = tfactory.newTransformer(domSource);
+            transformer.setParameter(LONG_PARAM_NAME, PARAM_VALUE);
+            transformer.clearParameters();
+            assertNull(transformer.getParameter(LONG_PARAM_NAME));
+        } catch (IOException | ParserConfigurationException
+                | TransformerConfigurationException | SAXException ex){
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * Obtains transformer's parameter with a short name that set before. Value
+     * should be same as set one.
+     */
+    @Test
+    public void clear09() {
+        try {
+            TransformerFactory tfactory = TransformerFactory.newInstance();
+            Transformer transformer = tfactory.newTransformer();
+
+            transformer.setParameter(SHORT_PARAM_NAME, PARAM_VALUE);
+            assertEquals(transformer.getParameter(SHORT_PARAM_NAME).toString(), PARAM_VALUE);
+        } catch (TransformerConfigurationException ex){
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * Obtains transformer's parameter with a short name that set with an integer
+     * object before. Value should be same as the set integer object.
+     */
+    @Test
+    public void clear10() {
+        try {
+            TransformerFactory tfactory = TransformerFactory.newInstance();
+            Transformer transformer = tfactory.newTransformer();
+
+            int intObject = 5;
+            transformer.setParameter(SHORT_PARAM_NAME, intObject);
+            assertEquals(transformer.getParameter(SHORT_PARAM_NAME), intObject);
+        } catch (TransformerConfigurationException ex){
+            failUnexpected(ex);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerExcpTest.java	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2014, 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 javax.xml.transform.ptests;
+
+import java.io.File;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
+import javax.xml.transform.sax.SAXResult;
+import javax.xml.transform.stream.StreamSource;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertNull;
+import static org.testng.Assert.fail;
+import org.testng.annotations.Test;
+
+/**
+ *  Basic test for TransformerException specification.
+ */
+public class TransformerExcpTest {
+    /**
+     * Transform an unformatted xslt file. TransformerException is thrown.
+     */
+    @Test
+    public void tfexception() {
+        try {
+            // invalid.xsl has well-formedness error. Therefore transform throws
+            // TransformerException
+            StreamSource streamSource
+                    = new StreamSource(new File(XML_DIR + "invalid.xsl"));
+            TransformerFactory tFactory = TransformerFactory.newInstance();
+            Transformer transformer = tFactory.newTransformer(streamSource);
+            transformer.transform(
+                    new StreamSource(new File(XML_DIR + "cities.xml")),
+                    new SAXResult());
+            fail("TransformerException is not thrown as expected");
+        } catch (TransformerException e) {
+            assertNotNull(e.getCause());
+            assertNotNull(e.getException());
+            assertNull(e.getLocationAsString());
+            assertEquals(e.getMessageAndLocation(),e.getMessage());
+        }
+    }
+
+
+    /**
+     * Spec says, "if the throwable was created with
+     * TransformerException(Throwable), initCause should throw
+     * IllegalStateException
+     */
+    @Test(expectedExceptions = IllegalStateException.class)
+    public void tfexception06() {
+        TransformerException te = new TransformerException(new Throwable());
+        te.initCause(null);
+    }
+
+    /**
+     * Spec says, "if the throwable was created with TransformerException(String,
+     * Throwable), initCause should throw IllegalStateException
+     */
+    @Test(expectedExceptions = IllegalStateException.class)
+    public void tfexception07() {
+        TransformerException te = new TransformerException("MyMessage", new Throwable());
+        te.initCause(null);
+    }
+
+    /**
+     * Tests if initCause(null) is allowed in other case.
+     */
+    @Test
+    public void tfexception08() {
+        TransformerException te = new TransformerException("My Message");
+        assertNotNull(te.initCause(null));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerFactoryTest.java	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2014, 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 javax.xml.transform.ptests;
+
+import java.io.*;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import javax.xml.parsers.*;
+import javax.xml.transform.*;
+import javax.xml.transform.dom.*;
+import static javax.xml.transform.ptests.TransformerTestConst.CLASS_DIR;
+import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR;
+import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
+import javax.xml.transform.stream.*;
+import static jaxp.library.JAXPTestUtilities.compareWithGold;
+import static jaxp.library.JAXPTestUtilities.failCleanup;
+import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import static org.testng.Assert.assertTrue;
+import org.testng.annotations.Test;
+import org.w3c.dom.*;
+import org.xml.sax.SAXException;
+
+/**
+ * Class containing the test cases for TransformerFactory API's
+ * getAssociatedStyleSheet method.
+ */
+public class TransformerFactoryTest {
+    /**
+     * This test case checks for the getAssociatedStylesheet method
+     * of TransformerFactory.
+     * The style sheet returned is then copied to an tfactory01.out
+     * It will then be verified to see if it matches the golden files
+     */
+    @Test
+    public void tfactory01() {
+        String outputFile = CLASS_DIR + "tfactory01.out";
+        String goldFile = GOLDEN_DIR + "tfactory01GF.out";
+        String xmlFile = XML_DIR + "TransformerFactoryTest.xml";
+        String xmlURI = "file:///" + XML_DIR;
+
+        try {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+
+            DocumentBuilder db = dbf.newDocumentBuilder();
+            Document doc = db.parse(new FileInputStream(xmlFile), xmlURI);
+            DOMSource domSource = new DOMSource(doc);
+            domSource.setSystemId(xmlURI);
+            StreamResult streamResult =new StreamResult(
+                new FileOutputStream(outputFile));
+            TransformerFactory tFactory = TransformerFactory.newInstance();
+
+            Source s = tFactory.getAssociatedStylesheet(domSource,"screen",
+                                           "Modern",null);
+            Transformer t = tFactory.newTransformer();
+            t.transform(s,streamResult);
+            assertTrue(compareWithGold(goldFile, outputFile));
+        }catch (IOException | ParserConfigurationException
+                | TransformerException | SAXException ex) {
+            failUnexpected(ex);
+        } finally {
+            try {
+                Path outputPath = Paths.get(outputFile);
+                if(Files.exists(outputPath))
+                    Files.delete(outputPath);
+            } catch (IOException ex) {
+                failCleanup(ex, outputFile);
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerTest.java	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,220 @@
+/*
+ * Copyright (c) 2014, 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 javax.xml.transform.ptests;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.Properties;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.ErrorListener;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.stream.StreamSource;
+import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+/**
+ * Basic test cases for Transformer API
+ */
+public class TransformerTest {
+    /**
+     * XSLT file serves every test method.
+     */
+    private final static String TEST_XSL = XML_DIR + "cities.xsl";
+
+    /**
+     * This tests if newTransformer(StreamSource) method returns Transformer
+     */
+    @Test
+    public void transformer01() {
+        try {
+            TransformerFactory tfactory = TransformerFactory.newInstance();
+            StreamSource streamSource = new StreamSource(
+                                        new File(TEST_XSL));
+            Transformer transformer = tfactory.newTransformer(streamSource);
+            assertNotNull(transformer);
+        } catch (TransformerConfigurationException ex){
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * This tests if newTransformer(SAXSource) method returns Transformer
+     */
+    @Test
+    public void transformer02() {
+        try {
+            TransformerFactory tfactory = TransformerFactory.newInstance();
+            InputSource is = new InputSource(
+                        new FileInputStream(TEST_XSL));
+            SAXSource saxSource = new SAXSource(is);
+            Transformer transformer = tfactory.newTransformer(saxSource);
+            assertNotNull(transformer);
+        } catch (TransformerConfigurationException | FileNotFoundException ex){
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * This tests if newTransformer(DOMSource) method returns Transformer
+     */
+    @Test
+    public void transformer03() {
+        try {
+            TransformerFactory tfactory = TransformerFactory.newInstance();
+
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setNamespaceAware(true);
+            DocumentBuilder db = dbf.newDocumentBuilder();
+            Document document = db.parse(new File(TEST_XSL));
+            DOMSource domSource = new DOMSource(document);
+
+            Transformer transformer = tfactory.newTransformer(domSource);
+            assertNotNull(transformer);
+        } catch (TransformerConfigurationException | IOException
+                | ParserConfigurationException | SAXException ex){
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * This tests set/get ErrorListener methods of Transformer
+     */
+    @Test
+    public void transformer04() {
+        try {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setNamespaceAware(true);
+            DocumentBuilder db = dbf.newDocumentBuilder();
+            Document document = db.parse(new File(TEST_XSL));
+            DOMSource domSource = new DOMSource(document);
+
+            Transformer transformer = TransformerFactory.newInstance()
+                    .newTransformer(domSource);
+            transformer.setErrorListener(new MyErrorListener());
+            assertNotNull(transformer.getErrorListener());
+            assertTrue(transformer.getErrorListener() instanceof MyErrorListener);
+        } catch (IOException | IllegalArgumentException | ParserConfigurationException
+                | TransformerConfigurationException | SAXException ex){
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * This tests getOutputProperties() method of Transformer
+     */
+    @Test
+    public void transformer05() {
+        try {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setNamespaceAware(true);
+            DocumentBuilder db = dbf.newDocumentBuilder();
+            Document document = db.parse(new File(TEST_XSL));
+            DOMSource domSource = new DOMSource(document);
+
+            Transformer transformer = TransformerFactory.newInstance().
+                    newTransformer(domSource);
+            Properties prop = transformer.getOutputProperties();
+
+            assertEquals(prop.getProperty("indent"), "yes");
+            assertEquals(prop.getProperty("method"), "xml");
+            assertEquals(prop.getProperty("encoding"), "UTF-8");
+            assertEquals(prop.getProperty("standalone"), "no");
+            assertEquals(prop.getProperty("version"), "1.0");
+            assertEquals(prop.getProperty("omit-xml-declaration"), "no");
+        } catch (ParserConfigurationException | SAXException | IOException
+                | TransformerConfigurationException ex){
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * This tests getOutputProperty() method of Transformer
+     */
+    @Test
+    public void transformer06() {
+        try {
+            TransformerFactory tfactory = TransformerFactory.newInstance();
+
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setNamespaceAware(true);
+            DocumentBuilder db = dbf.newDocumentBuilder();
+            Document document = db.parse(new File(TEST_XSL));
+            DOMSource domSource = new DOMSource(document);
+
+            Transformer transformer = tfactory.newTransformer(domSource);
+            assertEquals(transformer.getOutputProperty("method"), "xml");
+        } catch (ParserConfigurationException | SAXException | IOException
+                | TransformerConfigurationException | IllegalArgumentException ex){
+            failUnexpected(ex);
+        }
+    }
+}
+
+/**
+ * Simple ErrorListener print out all exception.
+ */
+class MyErrorListener implements ErrorListener {
+    /**
+     * Prints exception when notification of a recoverable error.
+     * @param e exception of a recoverable error.
+     */
+    @Override
+    public void error (TransformerException e) {
+        System.out.println(" In error" + e);
+    }
+
+    /**
+     * Prints exception when notification of a warning.
+     * @param e exception of a warning.
+     */
+    @Override
+    public void warning (TransformerException e) {
+        System.out.println(" In warning");
+    }
+
+    /**
+     * Prints exception when notification of a fatal error.
+     * @param e exception of a fatal error.
+     */
+    @Override
+    public void fatalError (TransformerException e) throws
+                TransformerException {
+        System.out.println(" In fatal");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerTest02.java	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2014, 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 javax.xml.transform.ptests;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import static javax.xml.transform.ptests.TransformerTestConst.CLASS_DIR;
+import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR;
+import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+import static jaxp.library.JAXPTestUtilities.compareWithGold;
+import static jaxp.library.JAXPTestUtilities.failCleanup;
+import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import static org.testng.Assert.assertTrue;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
+
+
+/**
+ * Here a transformer is created using DOMSource. Some specific output property
+ * is set on transformer. Then transform(StreamSource, StreamResult) is tested.
+ */
+public class TransformerTest02 {
+    /**
+     * Unit test for transform(StreamSource, StreamResult).
+     */
+    @Test
+    public void testcase01() {
+        String outputFile = CLASS_DIR + "transformer02.out";
+        String goldFile = GOLDEN_DIR + "transformer02GF.out";
+        String xsltFile = XML_DIR + "cities.xsl";
+        String xmlFile = XML_DIR + "cities.xml";
+
+        try (FileInputStream fis = new FileInputStream(xmlFile);
+                FileOutputStream fos = new FileOutputStream(outputFile)) {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setNamespaceAware(true);
+            DocumentBuilder db = dbf.newDocumentBuilder();
+            Document document = db.parse(new File(xsltFile));
+            DOMSource domSource = new DOMSource(document);
+
+            Transformer transformer = TransformerFactory.newInstance().
+                    newTransformer(domSource);
+            StreamSource streamSource = new StreamSource(fis);
+            StreamResult streamResult = new StreamResult(fos);
+
+            transformer.setOutputProperty("indent", "no");
+            transformer.transform( streamSource, streamResult);
+            assertTrue(compareWithGold(goldFile, outputFile));
+        } catch (IOException | IllegalArgumentException
+                | ParserConfigurationException | TransformerException
+                | SAXException ex) {
+            failUnexpected(ex);
+        } finally {
+            try {
+                Path outputPath = Paths.get(outputFile);
+                if(Files.exists(outputPath))
+                    Files.delete(outputPath);
+            } catch (IOException ex) {
+                failCleanup(ex, outputFile);
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerTest03.java	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 2014, 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 javax.xml.transform.ptests;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Properties;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import static javax.xml.transform.ptests.TransformerTestConst.CLASS_DIR;
+import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR;
+import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+import static jaxp.library.JAXPTestUtilities.compareWithGold;
+import static jaxp.library.JAXPTestUtilities.failCleanup;
+import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import static org.testng.Assert.assertTrue;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
+
+/**
+ * Here Properties Object is populated with required properties.A transformer
+ * is created using DOMSource. Using setOutputProperties(), Properties are set
+ * for transformer. Then transform(StreamSource, StreamResult) is used for
+ * transformation. This tests the setOutputProperties() method.
+ */
+public class TransformerTest03 {
+    /**
+     * Test for Transformer.setOutputProperties method.
+     */
+    @Test
+    public void testcase01() {
+        String outputFile = CLASS_DIR + "transformer03.out";
+        String goldFile = GOLDEN_DIR + "transformer03GF.out";
+        String xsltFile = XML_DIR + "cities.xsl";
+        String xmlFile = XML_DIR + "cities.xml";
+
+        try (FileInputStream fis = new FileInputStream(xmlFile);
+                FileOutputStream fos = new FileOutputStream(outputFile)) {
+            Properties properties = new Properties();
+            properties.put("method", "xml");
+            properties.put("encoding", "UTF-8");
+            properties.put("omit-xml-declaration", "yes");
+            properties.put("{http://xml.apache.org/xslt}indent-amount", "0");
+            properties.put("indent", "no");
+            properties.put("standalone", "no");
+            properties.put("version", "1.0");
+            properties.put("media-type", "text/xml");
+
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setNamespaceAware(true);
+            DocumentBuilder db = dbf.newDocumentBuilder();
+            Document document = db.parse(new File(xsltFile));
+            DOMSource domSource = new DOMSource(document);
+
+            Transformer transformer = TransformerFactory.newInstance().
+                    newTransformer(domSource);
+            StreamSource streamSource = new StreamSource(fis);
+            StreamResult streamResult = new StreamResult(fos);
+
+            transformer.setOutputProperties(properties);
+            transformer.transform( streamSource, streamResult);
+            assertTrue(compareWithGold(goldFile, outputFile));
+        } catch (ParserConfigurationException | SAXException
+                | IOException | TransformerException ex){
+            failUnexpected(ex);
+        } finally {
+            try {
+                Path outputPath = Paths.get(outputFile);
+                if(Files.exists(outputPath))
+                    Files.delete(outputPath);
+            } catch (IOException ex) {
+                failCleanup(ex, outputFile);
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/URIResolverTest.java	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,275 @@
+/*
+ * Copyright (c) 2014, 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 javax.xml.transform.ptests;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.URIResolver;
+import javax.xml.transform.dom.DOMSource;
+import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+import static jaxp.library.JAXPTestUtilities.FILE_SEP;
+import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import static org.testng.Assert.assertEquals;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+/**
+ * URIResolver should be invoked when transform happens.
+ */
+public class URIResolverTest implements URIResolver {
+    /**
+     * System ID constant.
+     */
+    private final static String SYSTEM_ID = "file:///" + XML_DIR;
+
+    /**
+     * XML file include link file.
+     */
+    private final static String XSL_INCLUDE_FILE = XML_DIR + "citiesinclude.xsl";
+
+    /**
+     * XML file import link file.
+     */
+    private final static String XSL_IMPORT_FILE = XML_DIR + "citiesimport.xsl";
+
+    /**
+     * TEMP XML file.
+     */
+    private final static String XSL_TEMP_FILE = "temp/cities.xsl";
+
+
+    /**
+     * expected Href.
+     */
+    private final String validateHref;
+
+    /**
+     * expected Base URI.
+     */
+    private final String validateBase;
+
+    /**
+     * Constructor for setting expected Href and expected Base URI.
+     * @param validateHref expected Href
+     * @param validateBase expected Base URI
+     */
+    public URIResolverTest(String validateHref, String validateBase){
+        this.validateHref = validateHref;
+        this.validateBase = validateBase;
+    }
+
+    /**
+     * Called by the processor when it encounters an xsl:include, xsl:import,
+     * or document() function.
+     * @param href An href attribute, which may be relative or absolute.
+     * @param base The base URI against which the first argument will be made
+     * absolute if the absolute URI is required.
+     * @return null always.
+     */
+    @Override
+    public Source resolve(String href, String base) {
+        assertEquals(href, validateHref);
+        assertEquals(base, validateBase);
+        return null;
+    }
+
+    /**
+     * This is to test the URIResolver.resolve() method when a transformer is
+     * created using StreamSource. xsl file has xsl:include in it
+     */
+    @Test
+    public static void resolver01() {
+        try {
+            TransformerFactory tfactory = TransformerFactory.newInstance();
+            URIResolverTest resolver = new URIResolverTest(XSL_TEMP_FILE, SYSTEM_ID);
+            tfactory.setURIResolver(resolver);
+
+            StreamSource streamSource = new StreamSource(new FileInputStream(XSL_INCLUDE_FILE));
+            streamSource.setSystemId(SYSTEM_ID);
+
+            Transformer transformer = tfactory.newTransformer(streamSource);
+        } catch (FileNotFoundException | TransformerConfigurationException ex){
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * This is to test the URIResolver.resolve() method when a transformer is
+     * created using DOMSource. xsl file has xsl:include in it
+     */
+    @Test
+    public static void resolver02() {
+        try {
+            TransformerFactory tfactory = TransformerFactory.newInstance();
+            URIResolverTest resolver = new URIResolverTest(XSL_TEMP_FILE, SYSTEM_ID);
+            tfactory.setURIResolver(resolver);
+
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setNamespaceAware(true);
+            DocumentBuilder db = dbf.newDocumentBuilder();
+            Document document = db.parse(XSL_INCLUDE_FILE);
+            DOMSource domSource = new DOMSource(document, SYSTEM_ID);
+
+            Transformer transformer = tfactory.newTransformer(domSource);
+        } catch (IOException | ParserConfigurationException
+                | TransformerConfigurationException | SAXException ex){
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * This is to test the URIResolver.resolve() method when a transformer is
+     * created using SAXSource. xsl file has xsl:include in it
+     */
+    @Test
+    public static void resolver03() {
+        try {
+            URIResolverTest resolver = new URIResolverTest(XSL_TEMP_FILE, SYSTEM_ID);
+            TransformerFactory tfactory = TransformerFactory.newInstance();
+            tfactory.setURIResolver(resolver);
+            InputSource is = new InputSource(new FileInputStream(XSL_INCLUDE_FILE));
+            is.setSystemId(SYSTEM_ID);
+            SAXSource saxSource = new SAXSource(is);
+
+            Transformer transformer = tfactory.newTransformer(saxSource);
+        } catch (FileNotFoundException |  TransformerConfigurationException ex){
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * This is to test the URIResolver.resolve() method when a transformer is
+     * created using StreamSource. xsl file has xsl:import in it
+     */
+    @Test
+    public static void resolver04() {
+        try {
+            URIResolverTest resolver = new URIResolverTest(XSL_TEMP_FILE, SYSTEM_ID);
+            TransformerFactory tfactory = TransformerFactory.newInstance();
+            tfactory.setURIResolver(resolver);
+
+            StreamSource streamSource = new StreamSource(new FileInputStream(XSL_IMPORT_FILE));
+            streamSource.setSystemId(SYSTEM_ID);
+
+            Transformer transformer = tfactory.newTransformer(streamSource);
+        } catch (FileNotFoundException | TransformerConfigurationException ex){
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * This is to test the URIResolver.resolve() method when a transformer is
+     * created using DOMSource. xsl file has xsl:import in it
+     */
+    @Test
+    public static void resolver05() {
+        try {
+            URIResolverTest resolver = new URIResolverTest(XSL_TEMP_FILE, SYSTEM_ID);
+            TransformerFactory tfactory = TransformerFactory.newInstance();
+            tfactory.setURIResolver(resolver);
+
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setNamespaceAware(true);
+            DocumentBuilder db = dbf.newDocumentBuilder();
+            Document document = db.parse(new File(XSL_IMPORT_FILE));
+            DOMSource domSource = new DOMSource(document, SYSTEM_ID);
+
+            Transformer transformer = tfactory.newTransformer(domSource);
+        } catch (ParserConfigurationException | SAXException | IOException
+                | TransformerConfigurationException ex){
+            failUnexpected(ex);
+        }
+
+    }
+
+    /**
+     * This is to test the URIResolver.resolve() method when a transformer is
+     * created using SAXSource. xsl file has xsl:import in it
+     */
+    @Test
+    public static void resolver06() {
+        try {
+            URIResolverTest resolver = new URIResolverTest(XSL_TEMP_FILE, SYSTEM_ID);
+            TransformerFactory tfactory = TransformerFactory.newInstance();
+            tfactory.setURIResolver(resolver);
+
+            InputSource is = new InputSource(new FileInputStream(XSL_IMPORT_FILE));
+            is.setSystemId(SYSTEM_ID);
+            SAXSource saxSource = new SAXSource(is);
+
+            Transformer transformer = tfactory.newTransformer(saxSource);
+        } catch (FileNotFoundException | TransformerConfigurationException ex){
+            failUnexpected(ex);
+        }
+
+    }
+
+    /**
+     * This is to test the URIResolver.resolve() method when there is an error
+     * in the file.
+     */
+    @Test
+    public static void docResolver01() {
+        try {
+            URIResolverTest resolver = new URIResolverTest("temp/colors.xml", SYSTEM_ID);
+            TransformerFactory tfactory = TransformerFactory.newInstance();
+
+            StreamSource streamSource = new StreamSource(
+                    new FileInputStream(XML_DIR + FILE_SEP + "doctest.xsl"));
+            streamSource.setSystemId(SYSTEM_ID);
+            System.err.println(streamSource.getSystemId());
+
+            Transformer transformer = tfactory.newTransformer(streamSource);
+            transformer.setURIResolver(resolver);
+
+            File f = new File(XML_DIR + FILE_SEP + "myFake.xml");
+            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+            DocumentBuilder builder = factory.newDocumentBuilder();
+            Document document = builder.parse(f);
+
+            // Use a Transformer for output
+            DOMSource source = new DOMSource(document);
+            System.err.println("Ignore the following output -- just dumping it here");
+            StreamResult result = new StreamResult(System.err);
+            transformer.transform(source, result);
+        } catch (IOException | ParserConfigurationException | SAXException
+                | TransformerException ex) {
+            failUnexpected(ex);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/othervm/TFCErrorTest.java	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2014, 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 javax.xml.transform.ptests.othervm;
+
+import javax.xml.transform.*;
+import org.testng.annotations.Test;
+
+/**
+ * Negative test for set invalid TransformerFactory property.
+ */
+public class TFCErrorTest{
+    @Test(expectedExceptions = ClassNotFoundException.class)
+    public void tfce01() throws Exception {
+        try{
+            System.setProperty("javax.xml.transform.TransformerFactory","xx");
+            TransformerFactory tFactory = TransformerFactory.newInstance();
+        } catch (TransformerFactoryConfigurationError error) {
+            throw error.getException();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/TransformerFactoryTest.xml	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,13 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="TransformerFactoryTest.xsl" media="screen" title="Modern" ?>
+<Review>
+	<About>
+		<Text> Richard Schelunberg reviews the Pasedena Shakesperares Compnay Henry IV
+		</Text>
+
+	</About>
+</Review>
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/TransformerFactoryTest.xsl	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+<xsl:template match="/">
+		<html> 
+		<xsl:apply-templates/>
+		</html>
+</xsl:template>
+<xsl:template match="Review">
+		<body>
+	        <xsl:apply-templates select="//About"/>
+		</body>
+</xsl:template>
+<xsl:template match="About">
+	<xsl:for-each select="Text">
+<Br>
+	<li>
+		<font size ="4" color ="Blue">
+<xsl:value-of select="."/>
+		</font>
+		</li>
+	</Br>
+		<xsl:apply-templates/>
+		</xsl:for-each>
+</xsl:template>
+</xsl:stylesheet>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/cities.xml	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,13 @@
+<?xml version="1.0" standalone="yes" ?>
+<cities>
+	<city name="Paris" country="France"/>
+	<city name="Roma" country="Italia"/>
+	<city name="Nice" country="France"/>
+	<city name="Madrid" country="Espana"/>
+	<city name="Milano" country="Italia"/>
+	<city name="Firenze" country="Italia"/>
+	<city name="Napoli" country="Italia"/>
+	<city name="Lyon" country="France"/>
+	<city name="Barcelona" country="Espana"/>
+</cities>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/cities.xsl	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,21 @@
+<?xml version="1.0" ?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+<xsl:output method="xml" indent="yes"/>
+<xsl:template match="/">
+<xsl:variable name="unique-countries"
+	select="/cities
+		/city[not(@country=preceding-sibling::city/@country)]
+		/@country"
+/>
+    <countries>
+	<xsl:for-each select="$unique-countries">
+	  <country name="{.}">
+		<xsl:for-each select="//city[@country=current()]">
+		  <city><xsl:value-of select="@name"/></city>
+		</xsl:for-each>
+	  </country> 
+	</xsl:for-each>
+    </countries>
+</xsl:template>
+</xsl:stylesheet>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/citiesimport.xsl	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,5 @@
+<?xml version="1.0" ?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+	<xsl:import href="temp/cities.xsl"/>
+</xsl:stylesheet>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/citiesinclude.xsl	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,5 @@
+<?xml version="1.0" ?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+	<xsl:include href="temp/cities.xsl"/>
+</xsl:stylesheet>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/doctest.xsl	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+<xsl:output method="html" version="4.0" indent="yes" encoding="iso-8859-1"/>
+
+<xsl:template match="/">
+<html>
+<body>
+<xsl:variable name="colors" select="document('temp/colors.xml')/colors"/>
+<p>Nodes in color <xsl:value-of select="count($colors)"/></p>
+<xsl:apply-templates/>
+</body>
+</html>
+</xsl:template>
+
+</xsl:stylesheet>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/invalid.xsl	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,20 @@
+<?xml version="1.0" ?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+<xsl:output method="xml" indent="yes"/>
+<xsl:template match="/">
+<xsl:variable name="unique-countries"
+	select="/cities
+		/city[not(@country=preceding-sibling::city/@country)]
+		/@country"
+/>
+    <countries>
+	<xsl:for-each select="$unique-countries">
+	  <country name="{.}">
+		<xsl:for-each select="//city[@country=current()]">
+		  <city><xsl:value-of select="@name"/></city>
+		</xsl:for-each>
+	  </country> 
+	</xsl:for-each>
+</xsl:template>
+</xsl:stylesheet>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/lexical.xml	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,24 @@
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE document PUBLIC "-//mkrishna mohan//DTD//music pub//EN/"
+		"http://sc11152338.us.oracle.com:8080/xmlsqe/jaxp/web/testfiles/JAXPREP/publishers.dtd">
+<document>
+	Publishers of the Music of New York Women Composers
+	<title>The Publishers <![CDATA[<?xml>]]> </title>
+	<!--This is a comment -->
+	<publisher>
+		<name>ACA</name>
+		<email>info@composers.com </email>
+		<homepage>http://www.composers.com/</homepage>
+		<address>
+			<street>170 West 74th St.</street>
+			<city>NY</city>
+			<state>NY</state>
+			<zip>10023</zip>
+		</address>
+		<voice>212-362-8900</voice>
+		<fax>212-874-8605</fax>
+		<!--This comment is for LexicalHandler -->
+		&familytree;
+	</publisher>
+</document>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/myFake.xml	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,4 @@
+<?xml version="1.0" standalone="yes" ?>
+<cities>
+	<!-- this file is just used for invoking transform method -->
+</cities>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/out/doctypeGF.out	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE document PUBLIC "-//mkrishna mohan//DTD//music pub//EN/" "http://sc11152338.us.oracle.com:8080/xmlsqe/jaxp/web/testfiles/publishers.dtd">
+<document>
+	Publishers of the Music of New York Women Composers
+	<title>The Publishers </title>
+	<publisher>
+		<name>ACA</name>
+		<email>info@composers.com </email>
+		<homepage>http://www.composers.com/</homepage>
+		<address>
+			<street>170 West 74th St.</street>
+			<city>NY</city>
+			<state>NY</state>
+			<zip>10023</zip>
+		</address>
+		<voice>212-362-8900</voice>
+		<fax>212-874-8605</fax>
+		<!-- This comment is for LexicalHandler -->
+		
+	</publisher>
+</document>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/out/domresult01GF.out	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,26 @@
+Node: #document
+Node: countries
+Node: country
+AttributeName:name, AttributeValue:France
+Node: city
+Node: #text
+Node: city
+Node: #text
+Node: city
+Node: #text
+Node: country
+AttributeName:name, AttributeValue:Italia
+Node: city
+Node: #text
+Node: city
+Node: #text
+Node: city
+Node: #text
+Node: city
+Node: #text
+Node: country
+AttributeName:name, AttributeValue:Espana
+Node: city
+Node: #text
+Node: city
+Node: #text
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/out/lexicalGF.out	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,4 @@
+In startCDATA
+In endCDATA
+In Comment:This is a comment 
+In Comment:This comment is for LexicalHandler 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/out/saxtf001GF.out	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?><countries>
+<country name="France">
+<city>Paris</city>
+<city>Nice</city>
+<city>Lyon</city>
+</country>
+<country name="Italia">
+<city>Roma</city>
+<city>Milano</city>
+<city>Firenze</city>
+<city>Napoli</city>
+</country>
+<country name="Espana">
+<city>Madrid</city>
+<city>Barcelona</city>
+</country>
+</countries>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/out/saxtf002GF.out	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?><countries>
+<country name="France">
+<city>Paris</city>
+<city>Nice</city>
+<city>Lyon</city>
+</country>
+<country name="Italia">
+<city>Roma</city>
+<city>Milano</city>
+<city>Firenze</city>
+<city>Napoli</city>
+</country>
+<country name="Espana">
+<city>Madrid</city>
+<city>Barcelona</city>
+</country>
+</countries>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/out/saxtf003GF.out	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?><countries>
+<country name="France">
+<city>Paris</city>
+<city>Nice</city>
+<city>Lyon</city>
+</country>
+<country name="Italia">
+<city>Roma</city>
+<city>Milano</city>
+<city>Firenze</city>
+<city>Napoli</city>
+</country>
+<country name="Espana">
+<city>Madrid</city>
+<city>Barcelona</city>
+</country>
+</countries>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/out/saxtf005GF.out	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?><countries>
+<country name="France">
+<city>Paris</city>
+<city>Nice</city>
+<city>Lyon</city>
+</country>
+<country name="Italia">
+<city>Roma</city>
+<city>Milano</city>
+<city>Firenze</city>
+<city>Napoli</city>
+</country>
+<country name="Espana">
+<city>Madrid</city>
+<city>Barcelona</city>
+</country>
+</countries>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/out/saxtf006GF.out	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?><countries>
+<country name="France">
+<city>Paris</city>
+<city>Nice</city>
+<city>Lyon</city>
+</country>
+<country name="Italia">
+<city>Roma</city>
+<city>Milano</city>
+<city>Firenze</city>
+<city>Napoli</city>
+</country>
+<country name="Espana">
+<city>Madrid</city>
+<city>Barcelona</city>
+</country>
+</countries>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/out/saxtf008GF.out	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?><countries>
+<country name="France">
+<city>Paris</city>
+<city>Nice</city>
+<city>Lyon</city>
+</country>
+<country name="Italia">
+<city>Roma</city>
+<city>Milano</city>
+<city>Firenze</city>
+<city>Napoli</city>
+</country>
+<country name="Espana">
+<city>Madrid</city>
+<city>Barcelona</city>
+</country>
+</countries>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/out/saxtf009GF.out	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?><countries>
+<country name="France">
+<city>Paris</city>
+<city>Nice</city>
+<city>Lyon</city>
+</country>
+<country name="Italia">
+<city>Roma</city>
+<city>Milano</city>
+<city>Firenze</city>
+<city>Napoli</city>
+</country>
+<country name="Espana">
+<city>Madrid</city>
+<city>Barcelona</city>
+</country>
+</countries>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/out/saxtf010GF.out	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,37 @@
+startDocument
+startElement: , , countries
+startElement: , , country, name
+startElement: , , city
+characters
+endElement: , , city
+startElement: , , city
+characters
+endElement: , , city
+startElement: , , city
+characters
+endElement: , , city
+endElement: , , country
+startElement: , , country, name
+startElement: , , city
+characters
+endElement: , , city
+startElement: , , city
+characters
+endElement: , , city
+startElement: , , city
+characters
+endElement: , , city
+startElement: , , city
+characters
+endElement: , , city
+endElement: , , country
+startElement: , , country, name
+startElement: , , city
+characters
+endElement: , , city
+startElement: , , city
+characters
+endElement: , , city
+endElement: , , country
+endElement: , , countries
+endDocument
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/out/saxtf011GF.out	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,37 @@
+startDocument
+startElement: , , countries
+startElement: , , country, name
+startElement: , , city
+characters
+endElement: , , city
+startElement: , , city
+characters
+endElement: , , city
+startElement: , , city
+characters
+endElement: , , city
+endElement: , , country
+startElement: , , country, name
+startElement: , , city
+characters
+endElement: , , city
+startElement: , , city
+characters
+endElement: , , city
+startElement: , , city
+characters
+endElement: , , city
+startElement: , , city
+characters
+endElement: , , city
+endElement: , , country
+startElement: , , country, name
+startElement: , , city
+characters
+endElement: , , city
+startElement: , , city
+characters
+endElement: , , city
+endElement: , , country
+endElement: , , countries
+endDocument
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/out/saxtf012GF.out	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,37 @@
+startDocument
+startElement: , , countries
+startElement: , , country, name
+startElement: , , city
+characters
+endElement: , , city
+startElement: , , city
+characters
+endElement: , , city
+startElement: , , city
+characters
+endElement: , , city
+endElement: , , country
+startElement: , , country, name
+startElement: , , city
+characters
+endElement: , , city
+startElement: , , city
+characters
+endElement: , , city
+startElement: , , city
+characters
+endElement: , , city
+startElement: , , city
+characters
+endElement: , , city
+endElement: , , country
+startElement: , , country, name
+startElement: , , city
+characters
+endElement: , , city
+startElement: , , city
+characters
+endElement: , , city
+endElement: , , country
+endElement: , , countries
+endDocument
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/out/saxtf013GF.out	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,37 @@
+startDocument
+startElement: , , countries
+startElement: , , country, name
+startElement: , , city
+characters
+endElement: , , city
+startElement: , , city
+characters
+endElement: , , city
+startElement: , , city
+characters
+endElement: , , city
+endElement: , , country
+startElement: , , country, name
+startElement: , , city
+characters
+endElement: , , city
+startElement: , , city
+characters
+endElement: , , city
+startElement: , , city
+characters
+endElement: , , city
+startElement: , , city
+characters
+endElement: , , city
+endElement: , , country
+startElement: , , country, name
+startElement: , , city
+characters
+endElement: , , city
+startElement: , , city
+characters
+endElement: , , city
+endElement: , , country
+endElement: , , countries
+endDocument
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/out/tfactory01GF.out	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+<xsl:template match="/">
+		<html> 
+		<xsl:apply-templates/>
+		</html>
+</xsl:template>
+<xsl:template match="Review">
+		<body>
+	        <xsl:apply-templates select="//About"/>
+		</body>
+</xsl:template>
+<xsl:template match="About">
+	<xsl:for-each select="Text">
+<Br>
+	<li>
+		<font size="4" color="Blue">
+<xsl:value-of select="."/>
+		</font>
+		</li>
+	</Br>
+		<xsl:apply-templates/>
+		</xsl:for-each>
+</xsl:template>
+</xsl:stylesheet>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/out/tfactory02GF.out	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+<xsl:template match="/">
+		<html> 
+		<xsl:apply-templates/>
+		</html>
+</xsl:template>
+<xsl:template match="Review">
+		<body>
+	        <xsl:apply-templates select="//About"/>
+		</body>
+</xsl:template>
+<xsl:template match="About">
+	<xsl:for-each select="Text">
+<Br>
+	<li>
+		<font size="4" color="Blue">
+<xsl:value-of select="."/>
+		</font>
+		</li>
+	</Br>
+		<xsl:apply-templates/>
+		</xsl:for-each>
+</xsl:template>
+</xsl:stylesheet>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/out/transformer02GF.out	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,1 @@
+<?xml version="1.0" encoding="UTF-8"?><countries><country name="France"><city>Paris</city><city>Nice</city><city>Lyon</city></country><country name="Italia"><city>Roma</city><city>Milano</city><city>Firenze</city><city>Napoli</city></country><country name="Espana"><city>Madrid</city><city>Barcelona</city></country></countries>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/out/transformer03GF.out	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,1 @@
+<countries><country name="France"><city>Paris</city><city>Nice</city><city>Lyon</city></country><country name="Italia"><city>Roma</city><city>Milano</city><city>Firenze</city><city>Napoli</city></country><country name="Espana"><city>Madrid</city><city>Barcelona</city></country></countries>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/publish2.xml	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,23 @@
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE document PUBLIC "-//mkrishna mohan//DTD//music pub//EN/"
+		"http://sc11152338.us.oracle.com:8080/xmlsqe/jaxp/web/testfiles/JAXPREP/publishers.dtd">
+<document>
+	Publishers of the Music of New York Women Composers
+	<title>The Publishers </title>
+	<publisher>
+		<name>ACA</name>
+		<email>info@composers.com </email>
+		<homepage>http://www.composers.com/</homepage>
+		<address>
+			<street>170 West 74th St.</street>
+			<city>NY</city>
+			<state>NY</state>
+			<zip>10023</zip>
+		</address>
+		<voice>212-362-8900</voice>
+		<fax>212-874-8605</fax>
+		<!-- This comment is for LexicalHandler -->
+		&familytree;
+	</publisher>
+</document>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/temp/cities.xsl	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,21 @@
+<?xml version="1.0" ?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+<xsl:output method="xml" indent="yes"/>
+<xsl:template match="/">
+<xsl:variable name="unique-countries"
+	select="/cities
+		/city[not(@country=preceding-sibling::city/@country)]
+		/@country"
+/>
+    <countries>
+	<xsl:for-each select="$unique-countries">
+	  <country name="{.}">
+		<xsl:for-each select="//city[@country=current()]">
+		  <city><xsl:value-of select="@name"/></city>
+		</xsl:for-each>
+	  </country> 
+	</xsl:for-each>
+    </countries>
+</xsl:template>
+</xsl:stylesheet>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/temp/colors.xml	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<colors>
+<dark>
+ <container name="book">
+  <category name="developer" version="1">088ea6</category>
+  <category name="default" version="1">0839a6</category>
+ </container>
+</dark>
+</colors>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathExpressionTest.java	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,529 @@
+/*
+ * Copyright (c) 2014, 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 javax.xml.xpath.ptests;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import javax.xml.XMLConstants;
+import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.xpath.XPath;
+import static javax.xml.xpath.XPathConstants.BOOLEAN;
+import static javax.xml.xpath.XPathConstants.NODE;
+import static javax.xml.xpath.XPathConstants.NODESET;
+import static javax.xml.xpath.XPathConstants.NUMBER;
+import static javax.xml.xpath.XPathConstants.STRING;
+import javax.xml.xpath.XPathExpressionException;
+import javax.xml.xpath.XPathFactory;
+import static javax.xml.xpath.ptests.XPathTestConst.XML_DIR;
+import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import static org.testng.Assert.assertEquals;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.NodeList;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+/**
+ * Class containing the test cases for XPathExpression API.
+ */
+public class XPathExpressionTest {
+    /**
+     * Document object for testing XML file.
+     */
+    private Document document;
+
+    /**
+     * A XPath for evaluation environment and expressions.
+     */
+    private XPath xpath;
+
+    /**
+     * A QName using default name space.
+     */
+    private static final QName TEST_QNAME = new QName(XMLConstants.XML_NS_URI, "");
+
+    /**
+     * XML File Path.
+     */
+    private static final Path XML_PATH = Paths.get(XML_DIR + "widgets.xml");
+
+    /**
+     * An expression name which locate at "/widgets/widget[@name='a']/@quantity"
+     */
+    private static final String EXPRESSION_NAME_A = "/widgets/widget[@name='a']/@quantity";
+
+    /**
+     * An expression name which locate at "/widgets/widget[@name='b']/@quantity"
+     */
+    private static final String EXPRESSION_NAME_B = "/widgets/widget[@name='b']/@quantity";
+
+    /**
+     * Create Document object and XPath object for every time
+     * @throws ParserConfigurationException If the factory class cannot be
+     *                                      loaded, instantiated
+     * @throws SAXException If any parse errors occur.
+     * @throws IOException If operation on xml file failed.
+     */
+    @BeforeTest
+    public void setup() throws ParserConfigurationException, SAXException, IOException {
+        document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(XML_PATH.toFile());
+        xpath = XPathFactory.newInstance().newXPath();
+    }
+
+    /**
+     * Test for evaluate(java.lang.Object item,QName returnType)throws
+     * XPathExpressionException.
+     */
+    @Test
+    public void testCheckXPathExpression01() {
+        try {
+            assertEquals(xpath.compile(EXPRESSION_NAME_A).
+                    evaluate(document, STRING), "6");
+        } catch (XPathExpressionException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * evaluate(java.lang.Object item,QName returnType) throws NPE if input
+     * source is null.
+     */
+    @Test(expectedExceptions = NullPointerException.class)
+    public void testCheckXPathExpression02() {
+        try {
+            xpath.compile(EXPRESSION_NAME_A).evaluate(null, STRING);
+        } catch (XPathExpressionException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * evaluate(java.lang.Object item,QName returnType) throws NPE if returnType
+     * is null.
+     */
+    @Test(expectedExceptions = NullPointerException.class)
+    public void testCheckXPathExpression03() {
+        try {
+            xpath.compile(EXPRESSION_NAME_A).evaluate(document, null);
+        } catch (XPathExpressionException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * Test for method evaluate(java.lang.Object item,QName returnType).If a
+     * request is made to evaluate the expression in the absence of a context
+     * item, simple expressions, such as "1+1", can be evaluated.
+     */
+    @Test
+    public void testCheckXPathExpression04() {
+        try {
+            assertEquals(xpath.compile("1+1").evaluate(document, STRING), "2");
+        } catch (XPathExpressionException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * evaluate(java.lang.Object item,QName returnType) throws IAE If returnType
+     * is not one of the types defined in XPathConstants.
+     */
+    @Test(expectedExceptions = IllegalArgumentException.class)
+    public void testCheckXPathExpression05() {
+        try {
+            xpath.compile(EXPRESSION_NAME_A).evaluate(document, TEST_QNAME);
+        } catch (XPathExpressionException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * evaluate(java.lang.Object item,QName returnType) return correct boolean
+     * value if returnType is Boolean.
+     */
+    @Test
+    public void testCheckXPathExpression06() {
+        try {
+            assertEquals(xpath.compile(EXPRESSION_NAME_A).
+                evaluate(document, BOOLEAN), true);
+        } catch (XPathExpressionException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * evaluate(java.lang.Object item,QName returnType) return correct boolean
+     * value if returnType is Boolean.
+     */
+    @Test
+    public void testCheckXPathExpression07() {
+        try {
+            assertEquals(xpath.compile(EXPRESSION_NAME_B).
+                evaluate(document, BOOLEAN), false);
+        } catch (XPathExpressionException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * evaluate(java.lang.Object item,QName returnType) return correct number
+     * value when return type is Double.
+     */
+    @Test
+    public void testCheckXPathExpression08() {
+        try {
+            assertEquals(xpath.compile(EXPRESSION_NAME_A).
+                evaluate(document, NUMBER), 6d);
+        } catch (XPathExpressionException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * evaluate(java.lang.Object item,QName returnType) evaluate an attribute
+     * value which returnType is Node.
+     */
+    @Test
+    public void testCheckXPathExpression09() {
+        try {
+            Attr attr = (Attr) xpath.compile(EXPRESSION_NAME_A).
+                    evaluate(document, NODE);
+            assertEquals(attr.getValue(), "6");
+        } catch (XPathExpressionException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * evaluate(java.lang.Object item,QName returnType) evaluate an attribute
+     * value which returnType is NodeList.
+     */
+    @Test
+    public void testCheckXPathExpression10() {
+        try {
+            NodeList nodeList = (NodeList) xpath.compile(EXPRESSION_NAME_A).
+                    evaluate(document, NODESET);
+            Attr attr = (Attr) nodeList.item(0);
+            assertEquals(attr.getValue(), "6");
+        } catch (XPathExpressionException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * Test for evaluate(java.lang.Object item) when returnType is left off of
+     * the XPath.evaluate method, all expressions are evaluated to a String
+     * value.
+     */
+    @Test
+    public void testCheckXPathExpression11() {
+        try {
+            assertEquals(xpath.compile(EXPRESSION_NAME_A).evaluate(document), "6");
+        } catch (XPathExpressionException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * evaluate(java.lang.Object item) throws NPE if expression is null.
+     */
+    @Test(expectedExceptions = NullPointerException.class)
+    public void testCheckXPathExpression12() {
+        try {
+            xpath.compile(null).evaluate(document);
+        } catch (XPathExpressionException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * evaluate(java.lang.Object item) when a request is made to evaluate the
+     * expression in the absence of a context item, simple expressions, such as
+     * "1+1", can be evaluated.
+     */
+    @Test
+    public void testCheckXPathExpression13() {
+        try {
+            assertEquals(xpath.compile("1+1").evaluate(document), "2");
+        } catch (XPathExpressionException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * evaluate(java.lang.Object item) throws NPE if document is null.
+     */
+    @Test(expectedExceptions = NullPointerException.class)
+    public void testCheckXPathExpression14() {
+        try {
+            xpath.compile(EXPRESSION_NAME_A).evaluate(null);
+        } catch (XPathExpressionException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * valuate(InputSource source) return a string value if return type is
+     * String.
+     */
+    @Test
+    public void testCheckXPathExpression15() {
+        try (InputStream is = Files.newInputStream(XML_PATH)) {
+            assertEquals(xpath.compile(EXPRESSION_NAME_A).
+                    evaluate(new InputSource(is)), "6");
+        } catch (XPathExpressionException | IOException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * evaluate(InputSource source) throws NPE if input source is null.
+     */
+    @Test(expectedExceptions = NullPointerException.class)
+    public void testCheckXPathExpression16() {
+        try {
+            xpath.compile(EXPRESSION_NAME_A).evaluate(null);
+        } catch (XPathExpressionException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * evaluate(InputSource source) throws NPE if expression is null
+     */
+    @Test(expectedExceptions = NullPointerException.class)
+    public void testCheckXPathExpression17() {
+        try (InputStream is = Files.newInputStream(XML_PATH)) {
+            xpath.compile(null).evaluate(new InputSource(is));
+        } catch (XPathExpressionException | IOException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * evaluate(InputSource source) throws XPathExpressionException if
+     * returnType is String junk characters.
+     *
+     * @throws XPathExpressionException
+     */
+    @Test(expectedExceptions = XPathExpressionException.class)
+    public void testCheckXPathExpression18() throws XPathExpressionException {
+        try (InputStream is = Files.newInputStream(XML_PATH)) {
+            xpath.compile("-*&").evaluate(new InputSource(is));
+        } catch (IOException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * evaluate(InputSource source) throws XPathExpressionException if
+     * expression is a blank string " ".
+     *
+     * @throws XPathExpressionException
+     */
+    @Test(expectedExceptions = XPathExpressionException.class)
+    public void testCheckXPathExpression19() throws XPathExpressionException {
+        try (InputStream is = Files.newInputStream(XML_PATH)) {
+            xpath.compile(" ").evaluate(new InputSource(is));
+        } catch (IOException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * Test for evaluate(InputSource source,QName returnType) returns a string
+     * value if returnType is String.
+     */
+    @Test
+    public void testCheckXPathExpression20() {
+        try (InputStream is = Files.newInputStream(XML_PATH)) {
+            assertEquals(xpath.compile(EXPRESSION_NAME_A).
+                evaluate(new InputSource(is), STRING), "6");
+        } catch (XPathExpressionException | IOException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * evaluate(InputSource source,QName returnType) throws NPE if source is
+     * null.
+     */
+    @Test(expectedExceptions = NullPointerException.class)
+    public void testCheckXPathExpression21() {
+        try {
+            xpath.compile(EXPRESSION_NAME_A).evaluate(null, STRING);
+        } catch (XPathExpressionException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * evaluate(InputSource source,QName returnType) throws NPE if expression is
+     * null.
+     */
+    @Test(expectedExceptions = NullPointerException.class)
+    public void testCheckXPathExpression22() {
+        try (InputStream is = Files.newInputStream(XML_PATH)) {
+            xpath.compile(null).evaluate(new InputSource(is), STRING);
+        } catch (XPathExpressionException | IOException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * evaluate(InputSource source,QName returnType) throws NPE if returnType is
+     * null.
+     */
+    @Test(expectedExceptions = NullPointerException.class)
+    public void testCheckXPathExpression23() {
+        try (InputStream is = Files.newInputStream(XML_PATH)) {
+            xpath.compile(EXPRESSION_NAME_A).evaluate(new InputSource(is), null);
+        } catch (XPathExpressionException | IOException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * evaluate(InputSource source,QName returnType) throws
+     * XPathExpressionException if expression is junk characters.
+     *
+     * @throws XPathExpressionException
+     */
+    @Test(expectedExceptions = XPathExpressionException.class)
+    public void testCheckXPathExpression24() throws XPathExpressionException {
+        try (InputStream is = Files.newInputStream(XML_PATH)) {
+            xpath.compile("-*&").evaluate(new InputSource(is), STRING);
+        } catch (IOException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * evaluate(InputSource source,QName returnType) throws
+     * XPathExpressionException if expression is blank " ".
+     *
+     * @throws XPathExpressionException
+     */
+    @Test(expectedExceptions = XPathExpressionException.class)
+    public void testCheckXPathExpression25() throws XPathExpressionException {
+        try (InputStream is = Files.newInputStream(XML_PATH)) {
+            xpath.compile(" ").evaluate(new InputSource(is), STRING);
+        } catch (IOException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * evaluate(InputSource source,QName returnType) throws
+     * IllegalArgumentException if returnType is not one of the types defined
+     * in XPathConstants.
+     */
+    @Test(expectedExceptions = IllegalArgumentException.class)
+    public void testCheckXPathExpression26() {
+        try (InputStream is = Files.newInputStream(XML_PATH)) {
+            xpath.compile(EXPRESSION_NAME_A).evaluate(new InputSource(is), TEST_QNAME);
+        } catch (XPathExpressionException | IOException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * evaluate(InputSource source,QName returnType) return a correct boolean
+     * value if returnType is Boolean.
+     */
+    @Test
+    public void testCheckXPathExpression27() {
+        try (InputStream is = Files.newInputStream(XML_PATH)) {
+            assertEquals(xpath.compile(EXPRESSION_NAME_A).
+                evaluate(new InputSource(is), BOOLEAN), true);
+        } catch (XPathExpressionException | IOException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * evaluate(InputSource source,QName returnType) return a correct boolean
+     * value if returnType is Boolean.
+     */
+    @Test
+    public void testCheckXPathExpression28() {
+        try (InputStream is = Files.newInputStream(XML_PATH)) {
+            assertEquals(xpath.compile(EXPRESSION_NAME_B).
+                evaluate(new InputSource(is), BOOLEAN), false);
+        } catch (XPathExpressionException | IOException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * evaluate(InputSource source,QName returnType) return a correct number
+     * value if returnType is Number.
+     */
+    @Test
+    public void testCheckXPathExpression29() {
+        try (InputStream is = Files.newInputStream(XML_PATH)) {
+            assertEquals(xpath.compile(EXPRESSION_NAME_A).
+                evaluate(new InputSource(is), NUMBER), 6d);
+        } catch (XPathExpressionException | IOException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * Test for evaluate(InputSource source,QName returnType) returns a node if
+     * returnType is Node.
+     */
+    @Test
+    public void testCheckXPathExpression30() {
+        try (InputStream is = Files.newInputStream(XML_PATH)) {
+            Attr attr = (Attr) xpath.compile(EXPRESSION_NAME_A).
+                evaluate(new InputSource(is), NODE);
+            assertEquals(attr.getValue(), "6");
+        } catch (XPathExpressionException | IOException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * Test for evaluate(InputSource source,QName returnType) return a node list
+     * if returnType is NodeList.
+     */
+    @Test
+    public void testCheckXPathExpression31() {
+        try (InputStream is = Files.newInputStream(XML_PATH)) {
+            NodeList nodeList = (NodeList) xpath.compile(EXPRESSION_NAME_A).
+                evaluate(new InputSource(is), NODESET);
+            assertEquals(((Attr) nodeList.item(0)).getValue(), "6");
+        } catch (XPathExpressionException | IOException  ex) {
+            failUnexpected(ex);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathFactoryTest.java	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,137 @@
+/*
+ * Copyright (c) 2014, 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 javax.xml.xpath.ptests;
+
+import static javax.xml.xpath.XPathConstants.DOM_OBJECT_MODEL;
+import javax.xml.xpath.XPathFactory;
+import javax.xml.xpath.XPathFactoryConfigurationException;
+import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import static org.testng.AssertJUnit.assertNotNull;
+import org.testng.annotations.Test;
+
+/**
+ * Class containing the test cases for XPathFactory API.
+ */
+public class XPathFactoryTest {
+    /**
+     * Valid URL for creating a XPath factory.
+     */
+    private static final String VALID_URL = "http://java.sun.com/jaxp/xpath/dom";
+
+    /**
+     * Invalid URL not able to create a XPath factory.
+     */
+    private static final String INVALID_URL = "http://java.sun.com/jaxp/xpath/dom1";
+
+    /**
+     * Test for constructor - XPathFactory.newInstance().
+     */
+    @Test
+    public void testCheckXPathFactory01() {
+        assertNotNull(XPathFactory.newInstance());
+    }
+
+    /**
+     * XPathFactory.newInstance(String uri) throws NPE if uri is null.
+     */
+    @Test(expectedExceptions = NullPointerException.class)
+    private void testCheckXPathFactory02() {
+        try {
+            XPathFactory.newInstance(null);
+        } catch (XPathFactoryConfigurationException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * XPathFactory.newInstance(String uri) throws XPFCE if uri is just a blank
+     * string.
+     *
+     * @throws XPathFactoryConfigurationException
+     */
+    @Test(expectedExceptions = XPathFactoryConfigurationException.class)
+    public void testCheckXPathFactory03() throws XPathFactoryConfigurationException {
+        XPathFactory.newInstance(" ");
+    }
+
+    /**
+     * Test for constructor - XPathFactory.newInstance(String uri) with valid
+     * url - "http://java.sun.com/jaxp/xpath/dom".
+     */
+    @Test
+    public void testCheckXPathFactory04() {
+        try {
+            assertNotNull(XPathFactory.newInstance(VALID_URL));
+        } catch (XPathFactoryConfigurationException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * Test for constructor - XPathFactory.newInstance(String uri) with invalid
+     * url - "http://java.sun.com/jaxp/xpath/dom1".
+     *
+     * @throws XPathFactoryConfigurationException
+     */
+    @Test(expectedExceptions = XPathFactoryConfigurationException.class)
+    public void testCheckXPathFactory05() throws XPathFactoryConfigurationException {
+        XPathFactory.newInstance(INVALID_URL);
+    }
+
+    /**
+     * Test for constructor - XPathFactory.newInstance() and creating XPath with
+     * newXPath().
+     */
+    @Test
+    public void testCheckXPathFactory06() {
+        assertNotNull(XPathFactory.newInstance().newXPath());
+    }
+
+    /**
+     * Test for constructor - XPathFactory.newInstance(String uri) with valid
+     * url - "http://java.sun.com/jaxp/xpath/dom" and creating XPath with
+     * newXPath().
+     */
+    @Test
+    public void testCheckXPathFactory07() {
+        try {
+            assertNotNull(XPathFactory.newInstance(VALID_URL).newXPath());
+        } catch (XPathFactoryConfigurationException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * Test for constructor - XPathFactory.newInstance(String uri) with valid
+     * uri - DOM_OBJECT_MODEL.toString().
+     */
+    @Test
+    public void testCheckXPathFactory08() {
+        try {
+            assertNotNull(XPathFactory.newInstance(DOM_OBJECT_MODEL));
+        } catch (XPathFactoryConfigurationException ex) {
+            failUnexpected(ex);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathFunctionResolverTest.java	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2014, 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 javax.xml.xpath.ptests;
+
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathExpressionException;
+import javax.xml.xpath.XPathFactory;
+import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import static org.testng.Assert.assertEquals;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+
+/**
+ * Class containing the test cases for XPathFunctionResolver.
+ */
+public class XPathFunctionResolverTest {
+    /**
+     * A XPath for evaluation environment and expressions.
+     */
+    private XPath xpath;
+
+    /**
+     * Create XPath object before every test. Make sure function resolver has
+     * been set for XPath object.
+     */
+    @BeforeTest
+    public void setup() {
+        xpath = XPathFactory.newInstance().newXPath();
+        if (xpath.getXPathFunctionResolver() == null) {
+            xpath.setXPathFunctionResolver((functionName,arity) -> null);
+        }
+    }
+    /**
+     * Test for resolveFunction(QName functionName,int arity). evaluate will
+     * continue as long as functionName is meaningful.
+     */
+    @Test
+    public void testCheckXPathFunctionResolver01() {
+        try {
+            assertEquals(xpath.evaluate("round(1.7)", (Object)null), "2");
+        } catch (XPathExpressionException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * Test for resolveFunction(QName functionName,int arity); evaluate throws
+     * NPE if functionName  is null.
+     */
+    @Test(expectedExceptions = NullPointerException.class)
+    public void testCheckXPathFunctionResolver02() {
+        try {
+            assertEquals(xpath.evaluate(null, "5"), "2");
+        } catch (XPathExpressionException ex) {
+            failUnexpected(ex);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathTest.java	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,805 @@
+/*
+ * Copyright (c) 2014, 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 javax.xml.xpath.ptests;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Iterator;
+import javax.xml.XMLConstants;
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.xpath.XPath;
+import static javax.xml.xpath.XPathConstants.BOOLEAN;
+import static javax.xml.xpath.XPathConstants.NODE;
+import static javax.xml.xpath.XPathConstants.NODESET;
+import static javax.xml.xpath.XPathConstants.NUMBER;
+import static javax.xml.xpath.XPathConstants.STRING;
+import javax.xml.xpath.XPathExpressionException;
+import javax.xml.xpath.XPathFactory;
+import static javax.xml.xpath.ptests.XPathTestConst.XML_DIR;
+import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertNotNull;
+import static org.testng.AssertJUnit.assertNull;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.NodeList;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+/**
+ * Class containing the test cases for XPath API.
+ */
+public class XPathTest {
+    /**
+     * Document object for testing XML file.
+     */
+    private Document document;
+
+    /**
+     * A XPath for evaluation environment and expressions.
+     */
+    private XPath xpath;
+
+    /**
+     * A QName using default name space.
+     */
+    private static final QName TEST_QNAME = new QName(XMLConstants.XML_NS_URI, "");
+
+    /**
+     * XML File Path.
+     */
+    private static final Path XML_PATH = Paths.get(XML_DIR + "widgets.xml");
+
+    /**
+     * An expression name which locate at "/widgets/widget[@name='a']/@quantity"
+     */
+    private static final String EXPRESSION_NAME_A = "/widgets/widget[@name='a']/@quantity";
+
+    /**
+     * An expression name which locate at "/widgets/widget[@name='b']/@quantity"
+     */
+    private static final String EXPRESSION_NAME_B = "/widgets/widget[@name='b']/@quantity";
+
+    /**
+     * Create Document object and XPath object for every time
+     * @throws ParserConfigurationException If the factory class cannot be
+     *                                      loaded, instantiated
+     * @throws SAXException If any parse errors occur.
+     * @throws IOException If operation on xml file failed.
+     */
+    @BeforeTest
+    public void setup() throws ParserConfigurationException, SAXException, IOException {
+        document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(XML_PATH.toFile());
+        xpath = XPathFactory.newInstance().newXPath();
+    }
+
+    /**
+     * Test for XPath.evaluate(java.lang.String expression, java.lang.Object
+     * item, QName returnType) which return type is String.
+     */
+    @Test
+    public void testCheckXPath01() {
+        try {
+            assertEquals(xpath.evaluate(EXPRESSION_NAME_A, document, STRING), "6");
+        } catch (XPathExpressionException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+
+    /**
+     * Test for XPath.compile(java.lang.String expression) and then
+     * evaluate(java.lang.Object item, QName returnType).
+     */
+    @Test
+    public void testCheckXPath02() {
+        try {
+            assertEquals(xpath.compile(EXPRESSION_NAME_A).evaluate(document, STRING), "6");
+        } catch (XPathExpressionException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * Test for XPath.evaluate(java.lang.String expression, java.lang.Object
+     * item) when the third argument is left off of the XPath.evaluate method,
+     * all expressions are evaluated to a String value.
+     */
+    @Test
+    public void testCheckXPath03() {
+        try {
+            assertEquals(xpath.evaluate(EXPRESSION_NAME_A, document), "6");
+        } catch (XPathExpressionException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * Test for XPath.compile(java.lang.String expression). If expression is
+     * null, should throw NPE.
+     */
+    @Test(expectedExceptions = NullPointerException.class)
+    public void testCheckXPath04() {
+        try {
+            xpath.compile(null);
+        } catch (XPathExpressionException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * Test for XPath.compile(java.lang.String expression). If expression cannot
+     * be compiled junk characters, should throw XPathExpressionException.
+     *
+     * @throws XPathExpressionException
+     */
+    @Test(expectedExceptions = XPathExpressionException.class)
+    public void testCheckXPath05() throws XPathExpressionException {
+        xpath.compile("-*&");
+    }
+
+    /**
+     * Test for XPath.compile(java.lang.String expression). If expression is
+     * blank, should throw XPathExpressionException
+     *
+     * @throws XPathExpressionException
+     */
+    @Test(expectedExceptions = XPathExpressionException.class)
+    public void testCheckXPath06() throws XPathExpressionException {
+        xpath.compile(" ");
+    }
+
+    /**
+     * Test for XPath.compile(java.lang.String expression). The expression
+     * cannot be evaluated as this does not exist.
+     */
+    @Test
+    public void testCheckXPath07() {
+        try {
+            assertEquals(xpath.compile(EXPRESSION_NAME_B).evaluate(document, STRING), "");
+        } catch (XPathExpressionException ex) {
+            failUnexpected(ex);
+        }
+
+    }
+
+
+    /**
+     * Test for XPath.evaluate(java.lang.String expression, java.lang.Object
+     * item, QName returnType). If String expression is null, should throw NPE
+     */
+    @Test(expectedExceptions = NullPointerException.class)
+    public void testCheckXPath08() {
+        try {
+            xpath.evaluate(null, document, STRING);
+        } catch (XPathExpressionException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * Test for XPath.evaluate(java.lang.String expression, java.lang.Object
+     * item, QName returnType). If item is null, should throw NPE.
+     */
+    @Test(expectedExceptions = NullPointerException.class)
+    public void testCheckXPath09() {
+        try {
+            xpath.evaluate(EXPRESSION_NAME_A, null, STRING);
+        } catch (XPathExpressionException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * Test for XPath.evaluate(java.lang.String expression, java.lang.Object
+     * item, QName returnType). If returnType is null, should throw NPE.
+     */
+    @Test(expectedExceptions = NullPointerException.class)
+    public void testCheckXPath10() {
+        try {
+            xpath.evaluate(EXPRESSION_NAME_A, document, null);
+        } catch (XPathExpressionException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * Test for XPath.evaluate(java.lang.String expression, java.lang.Object
+     * item, QName returnType). If a request is made to evaluate the expression
+     * in the absence of a context item, simple expressions, such as "1+1", can
+     * be evaluated.
+     */
+    @Test
+    public void testCheckXPath11() {
+        try {
+            assertEquals(xpath.evaluate("1+1", document, STRING), "2");
+        } catch (XPathExpressionException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * XPath.evaluate(java.lang.String expression, java.lang.Object item, QName
+     * returnType) throws XPathExpressionException if expression is a empty
+     * string "".
+     * .
+     *
+     * @throws XPathExpressionException
+     */
+    @Test(expectedExceptions = XPathExpressionException.class)
+    public void testCheckXPath12() throws XPathExpressionException {
+        xpath.evaluate("", document, STRING);
+    }
+
+    /**
+     * XPath.evaluate(java.lang.String expression, java.lang.Object item, QName
+     * returnType) throws IllegalArgumentException if returnType is not one of
+     * the types defined in XPathConstants.
+     */
+    @Test(expectedExceptions = IllegalArgumentException.class)
+    public void testCheckXPath13() {
+        try {
+            xpath.evaluate(EXPRESSION_NAME_A, document, TEST_QNAME);
+        } catch (XPathExpressionException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * XPath.evaluate(java.lang.String expression, java.lang.Object item, QName
+     * returnType) returns correct boolean value if returnType is Boolean.
+     */
+    @Test
+    public void testCheckXPath14() {
+        try {
+            assertEquals(xpath.evaluate(EXPRESSION_NAME_A, document, BOOLEAN), true);
+        } catch (XPathExpressionException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * XPath.evaluate(java.lang.String expression, java.lang.Object item, QName
+     * returnType) returns false as  expression is not successful in evaluating
+     * to any result if returnType is Boolean.
+     */
+    @Test
+    public void testCheckXPath15() {
+        try {
+            assertEquals(xpath.evaluate(EXPRESSION_NAME_B, document, BOOLEAN), false);
+        } catch (XPathExpressionException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * XPath.evaluate(java.lang.String expression, java.lang.Object item, QName
+     * returnType) returns correct number value if return type is Number.
+     */
+    @Test
+    public void testCheckXPath16() {
+        try {
+            assertEquals(xpath.evaluate(EXPRESSION_NAME_A, document, NUMBER), 6d);
+        } catch (XPathExpressionException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+
+    /**
+     * XPath.evaluate(java.lang.String expression, java.lang.Object item, QName
+     * returnType) returns correct string value if return type is Node.
+     */
+    @Test
+    public void testCheckXPath17() {
+        try {
+            assertEquals(((Attr)xpath.evaluate(EXPRESSION_NAME_A, document, NODE)).getValue(), "6");
+        } catch (XPathExpressionException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * Test for XPath.evaluate(java.lang.String expression, java.lang.Object
+     * item, QName returnType). If return type is NodeList,the evaluated value
+     * equals to "6" as expected.
+     */
+    @Test
+    public void testCheckXPath18() {
+        try {
+            NodeList nodeList = (NodeList)xpath.evaluate(EXPRESSION_NAME_A, document, NODESET);
+            assertEquals(((Attr) nodeList.item(0)).getValue(), "6");
+        } catch (XPathExpressionException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * Test for XPath.evaluate(java.lang.String expression, java.lang.Object
+     * item). If expression is null, should throw NPE.
+     */
+    @Test(expectedExceptions = NullPointerException.class)
+    public void testCheckXPath19() {
+        try {
+            xpath.evaluate(null, document);
+        } catch (XPathExpressionException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * Test for XPath.evaluate(java.lang.String expression, java.lang.Object
+     * item). If a request is made to evaluate the expression in the absence of
+     * a context item, simple expressions, such as "1+1", can be evaluated.
+     */
+    @Test
+    public void testCheckXPath20() {
+        try {
+            assertEquals(xpath.evaluate("1+1", document), "2");
+        } catch (XPathExpressionException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * XPath.evaluate(java.lang.String expression, java.lang.Object item) throws
+     * NPE if InputSource is null.
+     */
+    @Test(expectedExceptions = NullPointerException.class)
+    public void testCheckXPath21() {
+        try {
+            xpath.evaluate(EXPRESSION_NAME_A, null);
+        } catch (XPathExpressionException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * XPath.evaluate(java.lang.String expression, InputSource source) return
+     * correct value by looking for Node.
+     */
+    @Test
+    public void testCheckXPath22() {
+        try (InputStream is = Files.newInputStream(XML_PATH)) {
+            assertEquals(xpath.evaluate(EXPRESSION_NAME_A, new InputSource(is)), "6");
+        } catch (XPathExpressionException | IOException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * XPath.evaluate(java.lang.String expression, InputSource source) throws
+     * NPE if InputSource is null.
+     */
+    @Test(expectedExceptions = NullPointerException.class)
+    public void testCheckXPath23() {
+        try {
+            xpath.evaluate(EXPRESSION_NAME_A, null);
+        } catch (XPathExpressionException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * XPath.evaluate(java.lang.String expression, InputSource source) throws
+     * NPE if String expression is null.
+     */
+    @Test(expectedExceptions = NullPointerException.class)
+    public void testCheckXPath24() {
+        try (InputStream is = Files.newInputStream(XML_PATH)) {
+            xpath.evaluate(null, new InputSource(is));
+        } catch (XPathExpressionException | IOException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * Test for XPath.evaluate(java.lang.String expression, InputSource source).
+     * If expression is junk characters, expression cannot be evaluated, should
+     * throw XPathExpressionException.
+     *
+     * @throws XPathExpressionException
+     */
+    @Test(expectedExceptions = XPathExpressionException.class)
+    public void testCheckXPath25() throws XPathExpressionException {
+        try (InputStream is = Files.newInputStream(XML_PATH)) {
+            xpath.evaluate("-*&", new InputSource(is));
+        } catch (IOException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * XPath.evaluate(java.lang.String expression, InputSource source) throws
+     * XPathExpressionException if expression is blank " ".
+     *
+     * @throws XPathExpressionException
+     */
+    @Test(expectedExceptions = XPathExpressionException.class)
+    public void testCheckXPath26() throws XPathExpressionException {
+        try (InputStream is = Files.newInputStream(XML_PATH)) {
+            xpath.evaluate(" ", new InputSource(is));
+        } catch (IOException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * XPath.evaluate(java.lang.String expression, InputSource source, QName
+     * returnType) returns correct string value which return type is String.
+     */
+    @Test
+    public void testCheckXPath27() {
+        try (InputStream is = Files.newInputStream(XML_PATH)) {
+            assertEquals(xpath.evaluate(EXPRESSION_NAME_A, new InputSource(is), STRING), "6");
+        } catch (XPathExpressionException | IOException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * XPath.evaluate(java.lang.String expression, InputSource source, QName
+     * returnType) throws NPE if source is null.
+     */
+    @Test(expectedExceptions = NullPointerException.class)
+    public void testCheckXPath28() {
+        try {
+            xpath.evaluate(EXPRESSION_NAME_A, null, STRING);
+        } catch (XPathExpressionException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * XPath.evaluate(java.lang.String expression, InputSource source, QName
+     * returnType) throws NPE if expression is null.
+     */
+    @Test(expectedExceptions = NullPointerException.class)
+    public void testCheckXPath29() {
+        try (InputStream is = Files.newInputStream(XML_PATH)) {
+            xpath.evaluate(null, new InputSource(is), STRING);
+        } catch (XPathExpressionException | IOException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * XPath.evaluate(java.lang.String expression, InputSource source,
+     * QName returnType) throws NPE if returnType is null .
+     */
+    @Test(expectedExceptions = NullPointerException.class)
+    public void testCheckXPath30() {
+        try (InputStream is = Files.newInputStream(XML_PATH)) {
+            xpath.evaluate(EXPRESSION_NAME_A, new InputSource(is), null);
+        } catch (XPathExpressionException | IOException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * XPath.evaluate(java.lang.String expression, InputSource source, QName
+     * returnType) throws XPathExpressionException if expression is junk characters.
+     *
+     * @throws XPathExpressionException
+     */
+    @Test(expectedExceptions = XPathExpressionException.class)
+    public void testCheckXPath31() throws XPathExpressionException {
+        try (InputStream is = Files.newInputStream(XML_PATH)) {
+            xpath.evaluate("-*&", new InputSource(is), STRING);
+        } catch (IOException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * XPath.evaluate(java.lang.String expression, InputSource source, QName
+     * returnType) throws XPathExpressionException if expression is blank " ".
+     *
+     * @throws XPathExpressionException
+     */
+    @Test(expectedExceptions = XPathExpressionException.class)
+    public void testCheckXPath32() throws XPathExpressionException {
+        try (InputStream is = Files.newInputStream(XML_PATH)) {
+            xpath.evaluate(" ", new InputSource(is), STRING);
+        } catch (IOException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * XPath.evaluate(java.lang.String expression, InputSource source,
+     * QName returnType) throws IllegalArgumentException if returnType is not
+     * one of the types defined in XPathConstants.
+     */
+    @Test(expectedExceptions = IllegalArgumentException.class)
+    public void testCheckXPath33() {
+        try (InputStream is = Files.newInputStream(XML_PATH)) {
+            xpath.evaluate(EXPRESSION_NAME_A, new InputSource(is), TEST_QNAME);
+        } catch (XPathExpressionException | IOException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * XPath.evaluate(java.lang.String expression, InputSource source,
+     * QName returnType) return correct boolean value if return type is Boolean.
+     */
+    @Test
+    public void testCheckXPath34() {
+        try (InputStream is = Files.newInputStream(XML_PATH)) {
+            assertEquals(xpath.evaluate(EXPRESSION_NAME_A, new InputSource(is),
+                BOOLEAN), true);
+        } catch (XPathExpressionException | IOException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * XPath.evaluate(java.lang.String expression, InputSource source,
+     * QName returnType) return correct boolean value if return type is Boolean.
+     */
+    @Test
+    public void testCheckXPath35() {
+        try (InputStream is = Files.newInputStream(XML_PATH)) {
+            assertEquals(xpath.evaluate(EXPRESSION_NAME_B, new InputSource(is),
+                BOOLEAN), false);
+        } catch (XPathExpressionException | IOException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * XPath.evaluate(java.lang.String expression, InputSource source,
+     * QName returnType) return correct number value if return type is Number.
+     */
+    @Test
+    public void testCheckXPath36() {
+        try (InputStream is = Files.newInputStream(XML_PATH)) {
+            assertEquals(xpath.evaluate(EXPRESSION_NAME_A, new InputSource(is),
+                NUMBER), 6d);
+        } catch (XPathExpressionException | IOException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * XPath.evaluate(java.lang.String expression, InputSource source,
+     * QName returnType) return correct string value if return type is Node.
+     */
+    @Test
+    public void testCheckXPath37() {
+        try (InputStream is = Files.newInputStream(XML_PATH)) {
+            assertEquals(((Attr)xpath.evaluate(EXPRESSION_NAME_A,
+                new InputSource(is), NODE)).getValue(), "6");
+        } catch (XPathExpressionException | IOException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * Test for XPath.evaluate(java.lang.String expression, InputSource source,
+     * QName returnType) which return type is NodeList.
+     */
+    @Test
+    public void testCheckXPath38() {
+        try (InputStream is = Files.newInputStream(XML_PATH)) {
+            NodeList nodeList = (NodeList)xpath.evaluate(EXPRESSION_NAME_A,
+                new InputSource(is), NODESET);
+            assertEquals(((Attr) nodeList.item(0)).getValue(), "6");
+        } catch (XPathExpressionException | IOException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * Test for XPath.evaluate(java.lang.String expression, InputSource iSource,
+     * QName returnType). If return type is Boolean, should return false as
+     * expression is not successful in evaluating to any result.
+     */
+    @Test
+    public void testCheckXPath52() {
+        try (InputStream is = Files.newInputStream(XML_PATH)) {
+            assertEquals(xpath.evaluate(EXPRESSION_NAME_B, new InputSource(is),
+                BOOLEAN), false);
+        } catch (XPathExpressionException | IOException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * XPath.evaluate(java.lang.String expression, InputSource iSource, QName
+     * returnType) returns correct number value which return type is Number.
+     */
+    @Test
+    public void testCheckXPath53() {
+        try (InputStream is = Files.newInputStream(XML_PATH)) {
+            assertEquals(xpath.evaluate(EXPRESSION_NAME_A, new InputSource(is),
+                NUMBER), 6d);
+        } catch (XPathExpressionException | IOException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * XPath.evaluate(java.lang.String expression, InputSource iSource, QName
+     * returnType) returns a node value if returnType is Node.
+     */
+    @Test
+    public void testCheckXPath54() {
+        try (InputStream is = Files.newInputStream(XML_PATH)) {
+            assertEquals(((Attr)xpath.evaluate(EXPRESSION_NAME_A,
+                new InputSource(is), NODE)).getValue(), "6");
+        } catch (XPathExpressionException | IOException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * XPath.evaluate(java.lang.String expression, InputSource iSource, QName
+     * returnType) returns a node list if returnType is NodeList.
+     */
+    @Test
+    public void testCheckXPath55() {
+        try (InputStream is = Files.newInputStream(XML_PATH)) {
+            NodeList nodeList = (NodeList)xpath.evaluate(EXPRESSION_NAME_A,
+                new InputSource(is), NODESET);
+            assertEquals(((Attr) nodeList.item(0)).getValue(), "6");
+        } catch (XPathExpressionException | IOException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * Test for XPath.getNamespaceContext() returns the current namespace
+     * context, null is returned if no namespace context is in effect.
+     */
+    @Test
+    public void testCheckXPath56() {
+        // CR 6376058 says that an impl will be provided, but by
+        // default we still return null here
+        assertNull(xpath.getNamespaceContext());
+    }
+
+    /**
+     * Test for XPath.setNamespaceContext(NamespaceContext nsContext) Establish
+     * a namespace context. Set a valid nsContext and retrieve it using
+     * getNamespaceContext(), should return the same.
+     */
+    @Test
+    public void testCheckXPath57() {
+        MyNamespaceContext myNamespaceContext = new MyNamespaceContext();
+        xpath.setNamespaceContext(myNamespaceContext);
+        assertEquals(xpath.getNamespaceContext(), myNamespaceContext);
+    }
+
+    /**
+     * Test for XPath.setNamespaceContext(NamespaceContext nsContext) Establish
+     * a namespace context. NullPointerException is thrown if nsContext is null.
+     */
+    @Test(expectedExceptions = NullPointerException.class)
+    public void testCheckXPath58() {
+        xpath.setNamespaceContext(null);
+    }
+
+    /**
+     * Test for XPath.getXPathFunctionResolver() Return the current function
+     * resolver. Null is returned if no function resolver is in effect.
+     */
+    @Test
+    public void testCheckXPath59() {
+        assertNull(xpath.getXPathFunctionResolver());
+    }
+
+    /**
+     * Test for XPath.setXPathFunctionResolver(XPathFunctionResolver resolver).
+     * Set a valid resolver and retrieve it using getXPathFunctionResolver(),
+     * should return the same.
+     */
+    @Test
+    public void testCheckXPath60() {
+        xpath.setXPathFunctionResolver((functionName, arity) -> null);
+        assertNotNull(xpath.getXPathFunctionResolver());
+    }
+
+    /**
+     * Test for XPath.setXPathFunctionResolver(XPathFunctionResolver resolver).
+     * set resolver as null, should throw NPE.
+     */
+    @Test(expectedExceptions = NullPointerException.class)
+    public void testCheckXPath61() {
+        xpath.setXPathFunctionResolver(null);
+    }
+
+    /**
+     * Test for XPath.getXPathVariableResolver() Return the current variable
+     * resolver. null is returned if no variable resolver is in effect.
+     */
+    @Test
+    public void testCheckXPath62() {
+        assertNull(xpath.getXPathVariableResolver());
+    }
+
+    /**
+     * Test for XPath.setXPathVariableResolver(XPathVariableResolver resolver).
+     * Set a valid resolver and retrieve it using getXPathVariableResolver(),
+     * should return the same.
+     */
+    @Test
+    public void testCheckXPath63() {
+        xpath.setXPathVariableResolver(qname -> null);
+        assertNotNull(xpath.getXPathVariableResolver());
+    }
+
+    /**
+     * Test for XPath.setXPathVariableResolver(XPathVariableResolver resolver).
+     * Set resolver as null, should throw NPE.
+     */
+    @Test(expectedExceptions = NullPointerException.class)
+    public void testCheckXPath64() {
+        xpath.setXPathVariableResolver(null);
+    }
+
+    /**
+     * Customized NamespaceContext used for test
+     */
+    private class MyNamespaceContext implements NamespaceContext {
+        /**
+         * et Namespace URI bound to a prefix in the current scope.
+         * @param prefix prefix to look up
+         * @return a Namespace URI identical to prefix
+         */
+        @Override
+        public String getNamespaceURI(String prefix) {
+            return prefix;
+        }
+
+        /**
+         * Get prefix bound to Namespace URI in the current scope.
+         * @param namespaceURI URI of Namespace to lookup
+         * @return prefix identical to URI of Namespace
+         */
+        @Override
+        public String getPrefix(String namespaceURI) {
+            return namespaceURI;
+        }
+
+        /**
+         * Get all prefixes bound to a Namespace URI in the current scope.
+         * @param namespaceURI URI of Namespace to lookup
+         * @return null
+         */
+        @Override
+        public Iterator getPrefixes(String namespaceURI) {
+            return null;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/javax/xml/xpath/xmlfiles/widgets.xml	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,8 @@
+<?xml version="1.0" standalone="yes"?>
+<widgets>
+	<widget name="a" style="red" quantity="6"/>
+	<widget name="b" style="blue"/>
+	<widget name="c">
+		<style>green</style>
+	</widget>
+</widgets>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/xml/sax/ptests/AttrImplTest.java	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,195 @@
+/*
+ * Copyright (c) 2014, 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.xml.sax.ptests;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNull;
+import org.testng.annotations.Test;
+import org.xml.sax.helpers.AttributesImpl;
+
+/**
+ * Class containing the test cases for AttributesImpl API.
+ */
+public class AttrImplTest {
+    private static final String CAR_URI = "http://www.cars.com/xml";
+
+    private static final String CAR_LOCALNAME = "part";
+
+    private static final String CAR_QNAME = "p";
+
+    private static final String CAR_TYPE = "abc";
+
+    private static final String CAR_VALUE = "Merc";
+
+    private static final String JEEP_URI = "http://www.jeeps.com/xml";
+
+    private static final String JEEP_LOCALNAME = "wheel";
+
+    private static final String JEEP_QNAME = "w";
+
+    private static final String JEEP_TYPE = "xyz";
+
+    private static final String JEEP_VALUE = "Mit";
+
+    /**
+     * Basic test for getIndex(String).
+     */
+    @Test
+    public void testcase01() {
+        AttributesImpl attr = new AttributesImpl();
+        attr.addAttribute(CAR_URI, CAR_LOCALNAME, CAR_QNAME, CAR_TYPE, CAR_VALUE);
+        attr.addAttribute(JEEP_URI, JEEP_LOCALNAME, JEEP_QNAME, JEEP_TYPE,
+                JEEP_VALUE);
+        assertEquals(attr.getIndex(CAR_QNAME), 0);
+        assertEquals(attr.getIndex(JEEP_QNAME), 1);
+    }
+
+    /**
+     * Basic test for getIndex(String, String).
+     */
+    @Test
+    public void testcase02() {
+        AttributesImpl attr = new AttributesImpl();
+        attr.addAttribute(CAR_URI, CAR_LOCALNAME, CAR_QNAME, CAR_TYPE, CAR_VALUE);
+        attr.addAttribute(JEEP_URI, JEEP_LOCALNAME, JEEP_QNAME, JEEP_TYPE,
+                JEEP_VALUE);
+        assertEquals(attr.getIndex(JEEP_URI, JEEP_LOCALNAME), 1);
+    }
+
+    /**
+     * getIndex(String, String) returns -1 if none matches.
+     */
+    @Test
+    public void testcase03() {
+        AttributesImpl attr = new AttributesImpl();
+        assertEquals(attr.getIndex(JEEP_URI, "whl"), -1);
+    }
+
+    /**
+     * Basic test for getType(int) and getType(String).
+     */
+    @Test
+    public void testcase04() {
+        AttributesImpl attr = new AttributesImpl();
+        attr.addAttribute(CAR_URI, CAR_LOCALNAME, CAR_QNAME, CAR_TYPE, CAR_VALUE);
+        attr.addAttribute(JEEP_URI, JEEP_LOCALNAME, JEEP_QNAME, JEEP_TYPE,
+                JEEP_VALUE);
+        assertEquals(attr.getType(1), JEEP_TYPE);
+        assertEquals(attr.getType(JEEP_QNAME), JEEP_TYPE);
+    }
+
+    /**
+     * Basic test for getValue(int), getValue(String) and getValue(String, String).
+     */
+    @Test
+    public void testcase05() {
+        AttributesImpl attr = new AttributesImpl();
+        attr.addAttribute(CAR_URI, CAR_LOCALNAME, CAR_QNAME, CAR_TYPE, CAR_VALUE);
+        attr.addAttribute(JEEP_URI, JEEP_LOCALNAME, JEEP_QNAME, JEEP_TYPE,
+                JEEP_VALUE);
+        assertEquals(attr.getValue(1), JEEP_VALUE);
+        assertEquals(attr.getValue(attr.getQName(1)), JEEP_VALUE);
+        assertEquals(attr.getValue(attr.getURI(1), attr.getLocalName(1)), JEEP_VALUE);
+    }
+
+    /**
+     * Basic test for getLocalName(int), getQName(int), getType(int),
+     * getType(String) and getURI(int).
+     */
+    @Test
+    public void testcase06() {
+        AttributesImpl attr = new AttributesImpl();
+        attr.addAttribute(CAR_URI, CAR_LOCALNAME, CAR_QNAME, CAR_TYPE, CAR_VALUE);
+        attr.addAttribute(JEEP_URI, JEEP_LOCALNAME, JEEP_QNAME, JEEP_TYPE,
+                JEEP_VALUE);
+        attr.setAttribute(1, "www.megginson.com", "author", "meg", "s", "SAX2");
+        assertEquals(attr.getLocalName(1), "author");
+        assertEquals(attr.getQName(1), "meg");
+        assertEquals(attr.getType(1), "s");
+        assertEquals(attr.getType("meg"), "s");
+        assertEquals(attr.getURI(1), "www.megginson.com");
+    }
+
+    /**
+     * Basic test for setLocalName(int, String), setQName(int, String),
+     * setType(int, String), setValue(int, String) and setURI(int, String).
+     */
+    @Test
+    public void testcase07() {
+        AttributesImpl attr = new AttributesImpl();
+        attr.addAttribute(CAR_URI, CAR_LOCALNAME, CAR_QNAME, CAR_TYPE, CAR_VALUE);
+        attr.addAttribute(JEEP_URI, JEEP_LOCALNAME, JEEP_QNAME, JEEP_TYPE,
+                JEEP_VALUE);
+        attr.setLocalName(1, "speclead");
+        attr.setQName(1, "megi");
+        attr.setType(1, "sax");
+        attr.setValue(1, "SAX01");
+        attr.setURI(1, "www.megginson.com/sax/sax01");
+
+        assertEquals(attr.getLocalName(1), "speclead");
+        assertEquals(attr.getQName(1), "megi");
+        assertEquals(attr.getType(1), "sax");
+        assertEquals(attr.getType("megi"), "sax");
+        assertEquals(attr.getURI(1), "www.megginson.com/sax/sax01");
+    }
+
+    /**
+     * Basic test for getLength().
+     */
+    @Test
+    public void testcase08() {
+        AttributesImpl attr = new AttributesImpl();
+        assertEquals(attr.getLength(), 0);
+        attr.addAttribute(CAR_URI, CAR_LOCALNAME, CAR_QNAME, CAR_TYPE, CAR_VALUE);
+        attr.addAttribute(JEEP_URI, JEEP_LOCALNAME, JEEP_QNAME, JEEP_TYPE,
+                JEEP_VALUE);
+        assertEquals(attr.getLength(), 2);
+    }
+
+    /**
+     * Javadoc says getLocalName returns null if the index if out of range.
+     */
+    @Test
+    public void testcase09() {
+        AttributesImpl attr = new AttributesImpl();
+        attr.addAttribute(CAR_URI, CAR_LOCALNAME, CAR_QNAME, CAR_TYPE, CAR_VALUE);
+        attr.addAttribute(JEEP_URI, JEEP_LOCALNAME, JEEP_QNAME, JEEP_TYPE,
+                JEEP_VALUE);
+        attr.removeAttribute(1);
+        assertNull(attr.getLocalName(1));
+    }
+
+    /**
+     * Javadoc says java.lang.ArrayIndexOutOfBoundsException is thrown When the
+     * supplied index does not point to an attribute in the list.
+     */
+    @Test(expectedExceptions = ArrayIndexOutOfBoundsException.class)
+    public void testcase10() {
+        AttributesImpl attr = new AttributesImpl();
+        attr.addAttribute(CAR_URI, CAR_LOCALNAME, CAR_QNAME, CAR_TYPE, CAR_VALUE);
+        attr.addAttribute(JEEP_URI, JEEP_LOCALNAME, JEEP_QNAME, JEEP_TYPE,
+                JEEP_VALUE);
+        attr.removeAttribute(1);
+        attr.removeAttribute(1);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/xml/sax/ptests/AttributesNSTest.java	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2014, 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.xml.sax.ptests;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import static jaxp.library.JAXPTestUtilities.compareWithGold;
+import static jaxp.library.JAXPTestUtilities.failCleanup;
+import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import static org.testng.Assert.assertTrue;
+import org.testng.annotations.Test;
+import org.xml.sax.SAXException;
+import static org.xml.sax.ptests.SAXTestConst.CLASS_DIR;
+import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR;
+import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
+
+/**
+ * This tests the Attributes interface. Here the startElement() callback of
+ * ContentHandler has Attributes as one of its arguments. Attributes
+ * pertaining to an element are taken into this argument and various methods
+ * of Attributes interfaces are tested. This program uses Namespace processing
+ * with namespaces in xml file. This program does not use Validation
+ */
+public class AttributesNSTest {
+    /**
+     * Test for Attribute Interface's setter/getter.
+     */
+    @Test
+    public void testcase01() {
+        String outputFile = CLASS_DIR + "AttributesNS.out";
+        String goldFile = GOLDEN_DIR + "AttributesNSGF.out";
+        String xmlFile = XML_DIR + "namespace1.xml";
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            spf.setNamespaceAware(true);
+            // http://www.saxproject.com/?selected=namespaces namespace-prefixes
+            //set to false to supress xmlns attributes
+            spf.setFeature("http://xml.org/sax/features/namespace-prefixes",
+                                        false);
+            SAXParser saxParser = spf.newSAXParser();
+            MyAttrCHandler myAttrCHandler = new MyAttrCHandler(outputFile);
+            saxParser.parse(new File(xmlFile), myAttrCHandler);
+            myAttrCHandler.flushAndClose();
+            assertTrue(compareWithGold(goldFile, outputFile));
+        } catch (IOException | ParserConfigurationException | SAXException ex) {
+            failUnexpected(ex);
+        } finally {
+            try {
+                Path outputPath = Paths.get(outputFile);
+                if(Files.exists(outputPath))
+                    Files.delete(outputPath);
+            } catch (IOException ex) {
+                failCleanup(ex, outputFile);
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/xml/sax/ptests/AttributesTest.java	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2014, 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.xml.sax.ptests;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import static jaxp.library.JAXPTestUtilities.compareWithGold;
+import static jaxp.library.JAXPTestUtilities.failCleanup;
+import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import static org.testng.Assert.assertTrue;
+import org.testng.annotations.Test;
+import org.xml.sax.SAXException;
+import static org.xml.sax.ptests.SAXTestConst.CLASS_DIR;
+import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR;
+import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
+
+/**
+ * This tests the Attributes interface. Here the startElement() callback of
+ * ContentHandler has Attributes as one of its arguments. Attributes
+ * pertaining to an element are taken into this argument and various methods
+ * of Attributes interfaces are tested.
+ * This program uses Namespace processing without any namepsaces in xml file.
+ * This program uses Validation
+ */
+public class AttributesTest {
+    /**
+     * Unit test for Attributes interface. Prints all attributes into output
+     * file. Check it with golden file.
+     */
+    @Test
+    public void testcase01() {
+        String outputFile = CLASS_DIR + "Attributes.out";
+        String goldFile = GOLDEN_DIR + "AttributesGF.out";
+        String xmlFile = XML_DIR + "family.xml";
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            spf.setNamespaceAware(true);
+            spf.setFeature("http://xml.org/sax/features/namespace-prefixes",
+                                        true);
+            spf.setValidating(true);
+            SAXParser saxParser = spf.newSAXParser();
+            MyAttrCHandler myAttrCHandler = new MyAttrCHandler(outputFile);
+            saxParser.parse(new File(xmlFile), myAttrCHandler);
+            myAttrCHandler.flushAndClose();
+            assertTrue(compareWithGold(goldFile, outputFile));
+        } catch (IOException | ParserConfigurationException | SAXException ex) {
+            failUnexpected(ex);
+        } finally {
+            try {
+                Path outputPath = Paths.get(outputFile);
+                if(Files.exists(outputPath))
+                    Files.delete(outputPath);
+            } catch (IOException ex) {
+                failCleanup(ex, outputFile);
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/xml/sax/ptests/ContentHandlerTest.java	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,261 @@
+/*
+ * Copyright (c) 2014, 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.xml.sax.ptests;
+
+import java.io.BufferedWriter;
+import java.io.FileInputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParserFactory;
+import static jaxp.library.JAXPTestUtilities.compareWithGold;
+import static jaxp.library.JAXPTestUtilities.failCleanup;
+import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import static org.testng.Assert.assertTrue;
+import org.testng.annotations.Test;
+import org.xml.sax.Attributes;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.InputSource;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.XMLFilterImpl;
+import static org.xml.sax.ptests.SAXTestConst.CLASS_DIR;
+import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR;
+import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
+
+/**
+ * Class registers a content event handler to XMLReader. Content event handler
+ * transverses XML and print all visited node  when XMLreader parses XML. Test
+ * verifies output is same as the golden file.
+ */
+public class ContentHandlerTest {
+    /**
+     * Content event handler visit all nodes to print to output file.
+     */
+    @Test
+    public void testcase01() {
+        String outputFile = CLASS_DIR + "Content.out";
+        String goldFile = GOLDEN_DIR + "ContentGF.out";
+        String xmlFile = XML_DIR + "namespace1.xml";
+
+        try(FileInputStream instream = new FileInputStream(xmlFile)) {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            spf.setNamespaceAware(true);
+            XMLReader xmlReader = spf.newSAXParser().getXMLReader();
+            ContentHandler cHandler = new MyContentHandler(outputFile);
+            xmlReader.setContentHandler(cHandler);
+            InputSource is = new InputSource(instream);
+            xmlReader.parse(is);
+            assertTrue(compareWithGold(goldFile, outputFile));
+        } catch( IOException | SAXException | ParserConfigurationException ex) {
+            failUnexpected(ex);
+        } finally {
+            try {
+                Path outputPath = Paths.get(outputFile);
+                if(Files.exists(outputPath))
+                    Files.delete(outputPath);
+            } catch (IOException ex) {
+                failCleanup(ex, outputFile);
+            }
+        }
+    }
+}
+
+/**
+ * A content write out handler.
+ */
+class MyContentHandler extends XMLFilterImpl {
+    /**
+     * Prefix to every exception.
+     */
+    private final static String WRITE_ERROR = "bWriter error";
+
+    /**
+     * FileWriter to write string to output file.
+     */
+    private final BufferedWriter bWriter;
+
+    /**
+     * Default document locator.
+     */
+    private Locator locator;
+
+    /**
+     * Initiate FileWriter when construct a MyContentHandler.
+     * @param outputFileName output file name.
+     * @throws SAXException creation of FileWriter failed.
+     */
+    public MyContentHandler(String outputFileName) throws SAXException {
+        try {
+            bWriter = new BufferedWriter(new FileWriter(outputFileName));
+        } catch (IOException ex) {
+            throw new SAXException(ex);
+        }
+    }
+
+    /**
+     * Write characters tag along with content of characters when meet
+     * characters event.
+     * @throws IOException error happen when writing file.
+     */
+    @Override
+    public void characters(char[] ch, int start, int length) throws SAXException {
+        String s = new String(ch, start, length);
+        println("characters...\n" + s);
+    }
+
+    /**
+     * Write endDocument tag then flush the content and close the file when meet
+     * endDocument event.
+     * @throws IOException error happen when writing file or closing file.
+     */
+    @Override
+    public void endDocument() throws SAXException {
+        try {
+            println("endDocument...");
+            bWriter.flush();
+            bWriter.close();
+        } catch (IOException ex) {
+            throw new SAXException(WRITE_ERROR, ex);
+        }
+    }
+
+    /**
+     * Write endElement tag with namespaceURI, localName, qName to the file when
+     * meet endElement event.
+     * @throws IOException error happen when writing file.
+     */
+    @Override
+    public void endElement(String namespaceURI,String localName,String qName) throws SAXException{
+        println("endElement...\n" + "namespaceURI: " + namespaceURI +
+                " localName: "+ localName + " qName: " + qName);
+    }
+
+    /**
+     * Write endPrefixMapping tag along with prefix to the file when meet
+     * endPrefixMapping event.
+     * @throws IOException error happen when writing file.
+     */
+    @Override
+    public void endPrefixMapping(String prefix) throws SAXException {
+        println("endPrefixMapping...\n" + "prefix: " + prefix);
+    }
+
+    /**
+     * Write ignorableWhitespace tag along with white spaces when meet
+     * ignorableWhitespace event.
+     * @throws IOException error happen when writing file.
+     */
+    @Override
+    public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException {
+        String s = new String(ch, start, length);
+        println("ignorableWhitespace...\n" + s +
+                " ignorable white space string length: " + s.length());
+    }
+
+    /**
+     * Write processingInstruction tag along with target name and target data
+     * when meet processingInstruction event.
+     * @throws IOException error happen when writing file.
+     */
+    @Override
+    public void processingInstruction(String target, String data) throws SAXException {
+        println("processingInstruction...target:" + target +
+                " data: " + data);
+    }
+
+    /**
+     * Write setDocumentLocator tag when meet setDocumentLocator event.
+     */
+    @Override
+    public void setDocumentLocator(Locator locator) {
+        try {
+            this.locator = locator;
+            println("setDocumentLocator...");
+        } catch (SAXException ex) {
+            System.err.println(WRITE_ERROR + ex);
+        }
+    }
+
+    /**
+     * Write skippedEntity tag along with entity name when meet skippedEntity
+     * event.
+     * @throws IOException error happen when writing file.
+     */
+    @Override
+    public void skippedEntity(String name) throws SAXException {
+        println("skippedEntity...\n" + "name: " + name);
+    }
+
+    /**
+     * Write startDocument tag when meet startDocument event.
+     * @throws IOException error happen when writing file.
+     */
+    @Override
+    public void startDocument() throws SAXException {
+        println("startDocument...");
+    }
+
+    /**
+     * Write startElement tag along with namespaceURI, localName, qName, number
+     * of attributes and line number when meet startElement event.
+     * @throws IOException error happen when writing file.
+     */
+    @Override
+    public void startElement(String namespaceURI, String localName,
+                        String qName, Attributes atts) throws SAXException {
+        println("startElement...\n" + "namespaceURI: " +  namespaceURI +
+                " localName: " + localName +  " qName: " + qName +
+                " Number of Attributes: " + atts.getLength() +
+                " Line# " + locator.getLineNumber());
+    }
+
+    /**
+     * Write startPrefixMapping tag along with prefix and uri when meet
+     * startPrefixMapping event.
+     * @throws IOException error happen when writing file.
+     */
+    @Override
+    public void startPrefixMapping(String prefix, String uri) throws SAXException {
+        println("startPrefixMapping...\n" + "prefix: " + prefix +
+                " uri: " + uri);
+    }
+
+    /**
+     * Write outString to file.
+     * @param outString String to be written to File
+     * @throws SAXException if write file failed
+     */
+    private void println(String outString) throws SAXException {
+        try {
+            bWriter.write( outString, 0, outString.length());
+            bWriter.newLine();
+        } catch (IOException ex) {
+            throw new SAXException(WRITE_ERROR, ex);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/xml/sax/ptests/DefaultHandlerTest.java	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,283 @@
+/*
+ * Copyright (c) 2014, 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.xml.sax.ptests;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import static jaxp.library.JAXPTestUtilities.compareWithGold;
+import static jaxp.library.JAXPTestUtilities.failCleanup;
+import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import static org.testng.Assert.assertTrue;
+import org.testng.annotations.Test;
+import org.xml.sax.Attributes;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+import org.xml.sax.helpers.DefaultHandler;
+import static org.xml.sax.ptests.SAXTestConst.CLASS_DIR;
+import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR;
+import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
+
+/**
+ * XMLReader parse XML with default handler that transverses XML and
+ * print all visited node. Test verifies output is same as the golden file.
+ */
+public class DefaultHandlerTest {
+    /**
+     * Test default handler that transverses XML and  print all visited node.
+     */
+    @Test
+    public void testDefaultHandler() {
+        String outputFile = CLASS_DIR + "DefaultHandler.out";
+        String goldFile = GOLDEN_DIR + "DefaultHandlerGF.out";
+        String xmlFile = XML_DIR + "namespace1.xml";
+
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            spf.setNamespaceAware(true);
+            SAXParser saxparser = spf.newSAXParser();
+
+            MyDefaultHandler handler = new MyDefaultHandler(outputFile);
+            File file = new File(xmlFile);
+            String Absolutepath = file.getAbsolutePath();
+            String newAbsolutePath = Absolutepath;
+            if (File.separatorChar == '\\')
+                    newAbsolutePath = Absolutepath.replace('\\', '/');
+            String uri = "file:///" + newAbsolutePath;
+            saxparser.parse(uri, handler);
+        } catch (IOException | ParserConfigurationException | SAXException ex) {
+            failUnexpected(ex);
+        }
+        // Need close the output file before we compare it with golden file.
+        try {
+            assertTrue(compareWithGold(goldFile, outputFile));
+        } catch (IOException ex) {
+            failUnexpected(ex);
+        } finally {
+            try {
+                Path outputPath = Paths.get(outputFile);
+                if(Files.exists(outputPath))
+                    Files.delete(outputPath);
+            } catch (IOException ex) {
+                failCleanup(ex, outputFile);
+            }
+        }
+    }
+}
+
+class MyDefaultHandler extends DefaultHandler {
+    /**
+     * Prefix to every exception.
+     */
+    private final static String WRITE_ERROR = "bWrite error";
+
+    /**
+     * FileWriter to write string to output file.
+     */
+    private final BufferedWriter bWriter;
+
+    /**
+     * Initiate FileWriter when construct a MyContentHandler.
+     * @param outputFileName output file name.
+     * @throws SAXException creation of FileWriter failed.
+     */
+    MyDefaultHandler(String outputFileName) throws SAXException {
+        try {
+            bWriter = new BufferedWriter(new FileWriter(outputFileName));
+        } catch (IOException ex) {
+            throw new SAXException(ex);
+        }
+    }
+
+    /**
+     * Write characters tag along with content of characters when meet
+     * characters event.
+     * @throws IOException error happen when writing file.
+     */
+    @Override
+    public void characters(char[] ch, int start, int length) throws SAXException {
+        println("characters...\n" + new String(ch, start, length));
+    }
+
+    /**
+     * Write endDocument tag then flush the content and close the file when meet
+     * endDocument event.
+     * @throws IOException error happen when writing file or closing file.
+     */
+    @Override
+    public void endDocument() throws SAXException {
+        try {
+            println("endDocument...");
+            bWriter.flush();
+            bWriter.close();
+        } catch (IOException ex) {
+            throw new SAXException(WRITE_ERROR, ex);
+        }
+    }
+
+    /**
+     * Write endElement tag with namespaceURI, localName, qName to the file when
+     * meet endElement event.
+     * @throws IOException error happen when writing file.
+     */
+    @Override
+    public void endElement(String namespaceURI,String localName,String qName) throws SAXException{
+        println("endElement...\n" + "namespaceURI: " + namespaceURI +
+                " localName: "+ localName + " qName: " + qName);
+    }
+
+    /**
+     * Write endPrefixMapping tag along with prefix to the file when meet
+     * endPrefixMapping event.
+     * @throws IOException error happen when writing file.
+     */
+    @Override
+    public void endPrefixMapping(String prefix) throws SAXException {
+        println("endPrefixmapping .." + prefix);
+    }
+
+    /**
+     * Write error tag along with exception to the file when meet recoverable
+     * error event.
+     * @throws IOException error happen when writing file.
+     */
+    @Override
+    public void error(SAXParseException e) throws SAXException {
+        println("error: " + e.getMessage());
+    }
+
+    /**
+     * Write fatalError tag along with exception to the file when meet
+     * unrecoverable error event.
+     * @throws IOException error happen when writing file.
+     */
+    @Override
+    public void fatalError(SAXParseException e) throws SAXException {
+        println("fatal error: ");
+    }
+
+    /**
+     * Write warning tag along with exception to the file when meet warning event.
+     * @throws IOException error happen when writing file.
+     */
+    @Override
+    public void warning(SAXParseException e) throws SAXException {
+        println("warning : ");
+    }
+
+    /**
+     * Write ignorableWhitespace tag along with white spaces when meet
+     * ignorableWhitespace event.
+     * @throws IOException error happen when writing file.
+     */
+    @Override
+    public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException {
+        String s = new String(ch, start, length);
+        println("ignorableWhitespace...\n" + s +
+                " ignorable white space string length: " + s.length());
+    }
+
+    /**
+     * Write processingInstruction tag along with target name and target data
+     * when meet processingInstruction event.
+     * @throws IOException error happen when writing file.
+     */
+    @Override
+    public void processingInstruction(String target, String data) throws SAXException {
+        println("processingInstruction...target:" + target +
+                        " data: " + data);
+    }
+
+    @Override
+    public void setDocumentLocator(Locator locator) {
+        try {
+            println("setDocumentLocator...");
+        } catch (SAXException ex) {
+            System.err.println(WRITE_ERROR + ex);
+        }
+    }
+
+    /**
+     * Write skippedEntity tag along with entity name when meet skippedEntity
+     * event.
+     * @throws IOException error happen when writing file.
+     */
+    @Override
+    public void skippedEntity(String name) throws SAXException {
+        println("skippedEntity...\n" + "name: " + name);
+    }
+
+    /**
+     * Write startDocument tag when meet startDocument event.
+     * @throws IOException error happen when writing file.
+     */
+    @Override
+    public void startDocument() throws SAXException {
+        println("startDocument...");
+    }
+
+    /**
+     * Write startElement tag along with namespaceURI, localName, qName, number
+     * of attributes and line number when meet startElement event.
+     * @throws IOException error happen when writing file.
+     */
+    @Override
+    public void startElement(String namespaceURI, String localName,
+                                        String qName, Attributes atts) throws SAXException {
+        println("startElement...\n" + "namespaceURI: " +  namespaceURI +
+                        " localName: " + localName +  " qName: " + qName +
+                        " Number of Attributes: " + atts.getLength());
+    }
+
+    /**
+     * Write startPrefixMapping tag along with prefix and uri when meet
+     * startPrefixMapping event.
+     * @throws IOException error happen when writing file.
+     */
+    @Override
+    public void startPrefixMapping(String prefix, String uri) throws SAXException {
+        println("startPrefixMapping...\n" + "prefix: " + prefix + " uri: " + uri);
+    }
+
+    /**
+     * Write outString to file.
+     * @param outString String to be written to File
+     * @throws SAXException if write file failed
+     */
+    private void println(String outString) throws SAXException {
+        try {
+            bWriter.write( outString, 0, outString.length());
+            bWriter.newLine();
+        } catch (IOException ex) {
+            throw new SAXException(WRITE_ERROR, ex);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/xml/sax/ptests/EHFatalTest.java	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,142 @@
+/*
+ * Copyright (c) 2014, 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.xml.sax.ptests;
+
+import java.io.BufferedWriter;
+import java.io.FileInputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import static jaxp.library.JAXPTestUtilities.compareWithGold;
+import static jaxp.library.JAXPTestUtilities.failCleanup;
+import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import static org.testng.Assert.assertTrue;
+import org.testng.annotations.Test;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.XMLFilterImpl;
+import static org.xml.sax.ptests.SAXTestConst.CLASS_DIR;
+import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR;
+import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
+
+/**
+ * ErrorHandler unit test. Set a ErrorHandle to XMLReader. Capture fatal error
+ * events in ErrorHandler.
+ */
+public class EHFatalTest {
+    /**
+     * Error Handler to capture all error events to output file. Verifies the
+     * output file is same as golden file.
+     */
+    @Test
+    public void testEHFatal() {
+        String outputFile = CLASS_DIR + "EHFatal.out";
+        String goldFile = GOLDEN_DIR + "EHFatalGF.out";
+        String xmlFile = XML_DIR + "invalid.xml";
+
+        try(MyErrorHandler eHandler = new MyErrorHandler(outputFile);
+                FileInputStream instream = new FileInputStream(xmlFile)) {
+            SAXParser saxParser = SAXParserFactory.newInstance().newSAXParser();
+            XMLReader xmlReader = saxParser.getXMLReader();
+            xmlReader.setErrorHandler(eHandler);
+            InputSource is = new InputSource(instream);
+            xmlReader.parse(is);
+        } catch (IOException | ParserConfigurationException ex) {
+            failUnexpected(ex);
+        } catch (SAXException ex) {
+            System.out.println("This is expected:" + ex);
+        }
+        // Need close the output file before we compare it with golden file.
+        try {
+            assertTrue(compareWithGold(goldFile, outputFile));
+        } catch (IOException ex) {
+            failUnexpected(ex);
+        } finally {
+            try {
+                Path outputPath = Paths.get(outputFile);
+                if(Files.exists(outputPath))
+                    Files.delete(outputPath);
+            } catch (IOException ex) {
+                failCleanup(ex, outputFile);
+            }
+        }
+    }
+}
+
+/**
+ * A fatal error event handler only capture fatal error event and write event to
+ * output file.
+ */
+class MyErrorHandler extends XMLFilterImpl implements AutoCloseable {
+    /**
+     * FileWriter to write string to output file.
+     */
+    private final BufferedWriter bWriter;
+
+    /**
+     * Initiate FileWriter when construct a MyContentHandler.
+     * @param outputFileName output file name.
+     * @throws SAXException creation of FileWriter failed.
+     */
+    MyErrorHandler(String outputFileName) throws SAXException {
+        super();
+        try {
+            bWriter = new BufferedWriter(new FileWriter(outputFileName));
+        } catch (IOException ex) {
+            throw new SAXException(ex);
+        }
+    }
+
+    /**
+     * Write fatalError tag along with exception to the file when meet
+     * unrecoverable error event.
+     * @throws IOException error happen when writing file.
+     */
+    @Override
+    public void fatalError(SAXParseException e) throws SAXException {
+        String str = "In fatalError..\nSAXParseException: " + e.getMessage();
+        try {
+            bWriter.write( str, 0,str.length());
+            bWriter.newLine();
+        } catch (IOException ex) {
+            throw new SAXException(ex);
+        }
+    }
+
+    /**
+     * Flush the content and close the file.
+     * @throws IOException error happen when writing file or closing file.
+     */
+    @Override
+    public void close() throws IOException {
+        bWriter.flush();
+        bWriter.close();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/xml/sax/ptests/MyAttrCHandler.java	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 2014, 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.xml.sax.ptests;
+
+import java.io.BufferedWriter;
+import java.io.FileWriter;
+import java.io.IOException;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+
+/**
+ * Simple attributes handler.
+ */
+public class MyAttrCHandler extends DefaultHandler {
+    /**
+     * FileWriter to write string to output file.
+     */
+    private final BufferedWriter bWriter;
+
+    /**
+     * Initiate FileWriter
+     * @param fileName output file name.
+     * @throws IOException
+     */
+    public MyAttrCHandler(String fileName) throws IOException {
+        bWriter = new BufferedWriter(new FileWriter(fileName));
+    }
+
+    /**
+     * Write element content before start access every element.
+     * @throws org.xml.sax.SAXException
+     */
+    @Override
+    public void startElement(String uri, String localName,
+                String qName, Attributes attributes) throws SAXException {
+        try {
+            String string = "uri <" + uri + "> localName <" + localName +
+                        "> qName <" + qName + ">";
+
+            bWriter.write( string, 0, string.length());
+            bWriter.newLine();
+
+            int length = attributes.getLength();
+            string = "length: " + length;
+
+            bWriter.write( string, 0, string.length());
+            bWriter.newLine();
+
+            for (int ind=0; ind < length ; ind++) {
+                string = "For index = " + ind + "\n";
+                string += "getLocalName <" + attributes.getLocalName(ind)
+                                +">" + "\n";
+                string += "getQName <" + attributes.getQName(ind) +">" + "\n";
+                string += "getType <" + attributes.getType(ind) +">" + "\n";
+                string += "getURI <" + attributes.getURI(ind) +">" + "\n";
+                string += "getValue <" + attributes.getValue(ind) +">" + "\n";
+
+                bWriter.write( string, 0, string.length());
+                bWriter.newLine();
+
+                String gotLocalName = attributes.getLocalName(ind);
+                String gotQName = attributes.getQName(ind);
+                String gotURI = attributes.getURI(ind);
+
+                string ="Using localName, qname and uri pertaining to index = "
+                                + ind;
+                bWriter.write( string, 0, string.length());
+                bWriter.newLine();
+
+                string = "getIndex(qName) <" + attributes.getIndex(gotQName)
+                                +">" + "\n";
+                string += "getIndex(uri, localName) <" +
+                        attributes.getIndex(gotURI, gotLocalName) +">" + "\n";
+
+                string += "getType(qName) <" +
+                        attributes.getType(gotQName) +">" + "\n";
+                string += "getType(uri, localName) <" +
+                        attributes.getType(gotURI, gotLocalName) +">" + "\n";
+
+                string += "getValue(qName) <" +
+                        attributes.getValue(gotQName) +">" + "\n";
+                string += "getValue(uri, localName) <" +
+                        attributes.getValue(gotURI, gotLocalName) +">" + "\n";
+
+                bWriter.write( string, 0, string.length());
+                bWriter.newLine();
+            }
+            bWriter.newLine();
+        } catch(IOException ex){
+            throw new SAXException(ex);
+        }
+    }
+
+    /**
+     * Flush the stream and close the file.
+     * @throws IOException when writing or closing file failed.
+     */
+    public void flushAndClose() throws IOException {
+        bWriter.flush();
+        bWriter.close();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/xml/sax/ptests/MyNSContentHandler.java	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,208 @@
+/*
+ * Copyright (c) 2014, 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.xml.sax.ptests;
+
+import org.xml.sax.helpers.DefaultHandler;
+import org.xml.sax.helpers.LocatorImpl;
+import org.xml.sax.Locator;
+import org.xml.sax.Attributes;
+import java.io.BufferedWriter;
+import java.io.IOException;
+import java.io.FileWriter;
+import org.xml.sax.SAXException;
+
+class MyNSContentHandler extends DefaultHandler {
+    /**
+     * Prefix for written string.
+     */
+    private final static String WRITE_ERROR = "bWrite error";
+    /**
+     * FileWriter to write output file.
+     */
+    private final BufferedWriter bWriter;
+
+    /**
+     * Default locator.
+     */
+    Locator locator = new LocatorImpl();
+
+    /**
+     * Initiate FileWrite.
+     * @param outputFileName file name of output file.
+     * @throws SAXException when open output file failed.
+     */
+    public MyNSContentHandler(String outputFileName) throws SAXException {
+        try {
+            bWriter = new BufferedWriter(new FileWriter(outputFileName));
+        } catch (IOException ex) {
+            throw new SAXException(ex);
+        }
+    }
+
+    /**
+     * Write characters tag along with content of characters when meet
+     * characters event.
+     * @throws IOException error happen when writing file.
+     */
+    @Override
+    public void characters(char[] ch, int start, int length)
+            throws SAXException {
+        String s = new String(ch, start, length);
+        println("characters...length is:" + s.length() + "\n"
+                + "<" + s + ">");
+    }
+
+    /**
+     * Write endDocument tag then flush the content and close the file when meet
+     * endDocument event.
+     * @throws IOException error happen when writing file or closing file.
+     */
+    @Override
+    public void endDocument() throws SAXException {
+        try {
+            println("endDocument...");
+            bWriter.flush();
+            bWriter.close();
+        } catch (IOException ex) {
+            throw new SAXException(WRITE_ERROR, ex);
+        }
+    }
+
+    /**
+     * Write endElement tag with namespaceURI, localName, qName to the file when
+     * meet endElement event.
+     * @throws IOException error happen when writing file.
+     */
+    @Override
+    public void endElement(String namespaceURI, String localName, String qName)
+            throws SAXException {
+        println("endElement...\n" + "namespaceURI: <" + namespaceURI
+                + "> localName: <" + localName + "> qName: <" + qName + ">");
+    }
+
+    /**
+     * Write endPrefixMapping tag along with prefix to the file when meet
+     * endPrefixMapping event.
+     * @throws IOException error happen when writing file.
+     */
+    @Override
+    public void endPrefixMapping(String prefix) throws SAXException {
+        println("endPrefixMapping...\n" + "prefix: <" + prefix + ">");
+    }
+
+    /**
+     * Write ignorableWhitespace tag along with white spaces when meet
+     * ignorableWhitespace event.
+     * @throws IOException error happen when writing file.
+     */
+    @Override
+    public void ignorableWhitespace(char[] ch, int start, int length)
+            throws SAXException {
+        String s = new String(ch, start, length);
+        println("ignorableWhitespace...\n" + s
+                + " ignorable white space string length: " + s.length());
+    }
+
+    /**
+     * Write processingInstruction tag along with target name and target data
+     * when meet processingInstruction event.
+     * @throws IOException error happen when writing file.
+     */
+    @Override
+    public void processingInstruction(String target, String data)
+            throws SAXException {
+        println("processingInstruction...target:<" + target
+                + "> data: <" + data + ">");
+    }
+
+    /**
+     * Write setDocumentLocator tag when meet setDocumentLocator event.
+     */
+    @Override
+    public void setDocumentLocator(Locator locator) {
+        try {
+            this.locator = locator;
+            println("setDocumentLocator...");
+        } catch (SAXException ex) {
+            System.err.println(WRITE_ERROR + ex);
+        }
+    }
+
+    /**
+     * Write skippedEntity tag along with entity name when meet skippedEntity
+     * event.
+     * @throws IOException error happen when writing file.
+     */
+    @Override
+    public void skippedEntity(String name) throws SAXException {
+        println("skippedEntity...\n" + "name: <" + name + ">");
+    }
+
+    /**
+     * Write startDocument tag when meet startDocument event.
+     * @throws IOException error happen when writing file.
+     */
+    @Override
+    public void startDocument() throws SAXException {
+        println("startDocument...");
+    }
+
+    /**
+     * Write startElement tag along with namespaceURI, localName, qName, number
+     * of attributes and line number when meet startElement event.
+     * @throws IOException error happen when writing file.
+     */
+    @Override
+    public void startElement(String namespaceURI, String localName,
+            String qName, Attributes atts) throws SAXException {
+        println("startElement...\n" + "namespaceURI: <" + namespaceURI
+                + "> localName: <" + localName + "> qName: <" + qName
+                + "> Number of Attributes: <" + atts.getLength()
+                + "> Line# <" + locator.getLineNumber() + ">");
+    }
+
+    /**
+     * Write startPrefixMapping tag along with prefix and uri when meet
+     * startPrefixMapping event.
+     * @throws IOException error happen when writing file.
+     */
+    @Override
+    public void startPrefixMapping(String prefix, String uri)
+            throws SAXException {
+        println("startPrefixMapping...\n" + "prefix: <" + prefix
+                + "> uri: <" + uri + ">");
+    }
+    /**
+     * Write outString to output file.
+     * @param outString string to be written.
+     * @throws SAXException
+     */
+    private void println(String outString) throws SAXException {
+        try {
+            bWriter.write( outString, 0, outString.length());
+            bWriter.newLine();
+        } catch (IOException ex) {
+            throw new SAXException(WRITE_ERROR, ex);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/xml/sax/ptests/NSSupportTest.java	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 2014, 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.xml.sax.ptests;
+
+import java.util.Enumeration;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNull;
+import org.testng.annotations.Test;
+import org.xml.sax.helpers.NamespaceSupport;
+
+/**
+ * Unit test cases for NamespaceSupport API
+ */
+public class NSSupportTest {
+    /**
+     * Empty prefix name.
+     */
+    private final static String EMPTY_PREFIX = "";
+
+    /**
+     * A URI for W3 1999 HTML sepc.
+     */
+    private final static String W3_URI = "http://www.w3.org/1999/xhtml";
+
+    /**
+     * A prefix named "dc".
+     */
+    private final static String DC_PREFIX = "dc";
+
+    /**
+     * A URI for "http://www.purl.org/dc#".
+     */
+    private final static String PURL_URI = "http://www.purl.org/dc#";
+
+    /**
+     * Test for NamespaceSupport.getDeclaredPrefixes().
+     */
+    @Test
+    public void testcase01() {
+        String[] prefixes = new String[2];
+        NamespaceSupport support = new NamespaceSupport();
+        support.pushContext();
+        support.declarePrefix(EMPTY_PREFIX, W3_URI);
+        support.declarePrefix(DC_PREFIX, PURL_URI);
+
+        Enumeration e = support.getDeclaredPrefixes();
+        int i = 0;
+        while(e.hasMoreElements()) {
+            prefixes[i++] = e.nextElement().toString();
+        }
+        support.popContext();
+
+        assertEquals(prefixes, new String[]{EMPTY_PREFIX, DC_PREFIX});
+    }
+
+    /**
+     * Test for NamespaceSupport.getDeclaredPrefixes() and support.processName().
+     */
+    @Test
+    public void testcase02() {
+        String[] parts = new String[3];
+        NamespaceSupport support = new NamespaceSupport();
+
+        support.pushContext();
+        support.declarePrefix(DC_PREFIX, PURL_URI);
+        parts = support.processName("dc:title", parts, false);
+        support.popContext();
+        assertEquals(parts, new String[]{PURL_URI, "title", "dc:title"});
+    }
+
+    /**
+     * Test for NamespaceSupport.getDeclaredPrefixes() and support.processName().
+     */
+    @Test
+    public void testcase03() {
+        String[] parts = new String[3];
+        NamespaceSupport support = new NamespaceSupport();
+        support.pushContext();
+        support.declarePrefix(EMPTY_PREFIX, W3_URI);
+        parts = support.processName("a", parts, false);
+        support.popContext();
+        assertEquals(parts, new String[]{W3_URI, "a", "a"});
+    }
+
+
+    /**
+     * Test for NamespaceSupport.popContext().
+     */
+    @Test
+    public void testcase04() {
+        NamespaceSupport support = new NamespaceSupport();
+
+        support.pushContext();
+        support.declarePrefix(EMPTY_PREFIX, W3_URI);
+        support.declarePrefix(DC_PREFIX, PURL_URI);
+
+        assertEquals(support.getURI(EMPTY_PREFIX), W3_URI);
+        assertEquals(support.getURI(DC_PREFIX), PURL_URI);
+        support.popContext();
+        assertNull(support.getURI(EMPTY_PREFIX));
+        assertNull(support.getURI(DC_PREFIX));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/xml/sax/ptests/NSTableTest01.java	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,193 @@
+/*
+ * Copyright (c) 2014, 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.xml.sax.ptests;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+import org.testng.annotations.Test;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXNotRecognizedException;
+import org.xml.sax.SAXNotSupportedException;
+import org.xml.sax.XMLReader;
+
+/**
+ * Class containing the test cases for Namespace Table defined at
+ * http://www.megginson.com/SAX/Java/namespaces.html
+ */
+public class NSTableTest01 {
+    private static final String NAMESPACES =
+                        "http://xml.org/sax/features/namespaces";
+    private static final String NAMESPACE_PREFIXES =
+                        "http://xml.org/sax/features/namespace-prefixes";
+
+    /**
+     * Here namespace processing and namespace-prefixes are enabled.
+     * The testcase tests XMLReader for this.
+     */
+    @Test
+    public void xrNSTable01() {
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            spf.setNamespaceAware(true);
+            SAXParser saxParser = spf.newSAXParser();
+
+            XMLReader xmlReader = saxParser.getXMLReader();
+            xmlReader.setFeature(NAMESPACE_PREFIXES, true);
+
+            assertTrue(xmlReader.getFeature(NAMESPACES));
+            assertTrue(xmlReader.getFeature(NAMESPACE_PREFIXES));
+        } catch (ParserConfigurationException | SAXException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * Here namespace processing is enabled. This will make namespace-prefixes
+     * disabled. The testcase tests XMLReader for this.
+     */
+    @Test
+    public void xrNSTable02() {
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            spf.setNamespaceAware(true);
+            SAXParser saxParser = spf.newSAXParser();
+
+            XMLReader xmlReader = saxParser.getXMLReader();
+            assertTrue(xmlReader.getFeature(NAMESPACES));
+            assertFalse(xmlReader.getFeature(NAMESPACE_PREFIXES));
+        } catch (ParserConfigurationException | SAXException ex) {
+            failUnexpected(ex);
+        }
+
+    }
+
+    /**
+     * Here namespace processing is disabled. This will make namespace-prefixes
+     * enabled. The testcase tests XMLReader for this.
+     */
+    @Test
+    public void xrNSTable03() {
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            SAXParser saxParser = spf.newSAXParser();
+            XMLReader xmlReader = saxParser.getXMLReader();
+            assertFalse(xmlReader.getFeature(NAMESPACES));
+            assertTrue(xmlReader.getFeature(NAMESPACE_PREFIXES));
+        } catch (ParserConfigurationException | SAXException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * Here namespace processing is disabled, and namespace-prefixes is
+     * disabled. This will make namespace processing on.The testcase tests
+     * XMLReader for this.  This behavior only apply to crimson, not
+     * xerces
+     */
+    @Test
+    public void xrNSTable04() {
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            SAXParser saxParser = spf.newSAXParser();
+            XMLReader xmlReader = saxParser.getXMLReader();
+            xmlReader.setFeature(NAMESPACE_PREFIXES, false);
+
+            assertFalse(xmlReader.getFeature(NAMESPACE_PREFIXES));
+        } catch (ParserConfigurationException | SAXException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * Here namespace processing and namespace-prefixes are enabled.
+     * The testcase tests SAXParserFactory for this.
+     */
+    @Test
+    public void spNSTable01() {
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            spf.setNamespaceAware(true);
+            spf.setFeature(NAMESPACE_PREFIXES,true);
+            assertTrue(spf.getFeature(NAMESPACES));
+            assertTrue(spf.getFeature(NAMESPACE_PREFIXES));
+        } catch (ParserConfigurationException | SAXNotRecognizedException
+                | SAXNotSupportedException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * Here namespace processing is enabled. This will make namespace-prefixes
+     * disabled. The testcase tests SAXParserFactory for this.
+     */
+    @Test
+    public void spNSTable02() {
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            spf.setNamespaceAware(true);
+            assertTrue(spf.getFeature(NAMESPACES));
+            assertFalse(spf.getFeature(NAMESPACE_PREFIXES));
+        } catch (ParserConfigurationException | SAXNotRecognizedException
+                | SAXNotSupportedException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * Here namespace processing is disabled. This will make namespace-prefixes
+     * enabled. The testcase tests SAXParserFactory for this.
+     */
+    @Test
+    public void spNSTable03() {
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            assertFalse(spf.getFeature(NAMESPACES));
+            assertTrue(spf.getFeature(NAMESPACE_PREFIXES));
+        } catch (ParserConfigurationException | SAXNotRecognizedException
+                | SAXNotSupportedException ex) {
+            failUnexpected(ex);
+        }
+    }
+    /**
+     * Here namespace processing is disabled, and namespace-prefixes is
+     * disabled. This will make namespace processing on.The testcase tests
+     * SAXParserFactory for this.  This behavior only apply to crimson,
+     * not xerces.
+     */
+    @Test
+    public void spNSTable04() {
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            spf.setFeature(NAMESPACE_PREFIXES, false);
+
+            assertFalse(spf.getFeature(NAMESPACE_PREFIXES));
+        } catch (ParserConfigurationException | SAXNotRecognizedException
+                | SAXNotSupportedException ex) {
+            failUnexpected(ex);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/xml/sax/ptests/ParserAdapterTest.java	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,279 @@
+/*
+ * Copyright (c) 2014, 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.xml.sax.ptests;
+
+import java.io.FileInputStream;
+import java.io.IOException;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParserFactory;
+import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
+import org.testng.annotations.Test;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXNotRecognizedException;
+import org.xml.sax.SAXNotSupportedException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.ParserAdapter;
+import org.xml.sax.helpers.XMLFilterImpl;
+import org.xml.sax.helpers.XMLReaderAdapter;
+import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
+
+
+/**
+ * Unit test cases for ParserAdapter API. By default the only features recognized
+ * are namespaces and namespace-prefixes.
+ */
+public class ParserAdapterTest {
+    /**
+     * namespaces feature name.
+     */
+    private static final String NAMESPACES =
+                "http://xml.org/sax/features/namespaces";
+
+    /**
+     * namespaces-prefiexs feature name.
+     */
+    private static final String NAMESPACE_PREFIXES =
+                "http://xml.org/sax/features/namespace-prefixes";
+
+    /**
+     * ParserAdapter instance to share by all tests.
+     */
+    private final ParserAdapter parserAdapter;
+
+    /**
+     * Initiate ParserAdapter.
+     * @throws ParserConfigurationException
+     * @throws SAXException
+     */
+    ParserAdapterTest() throws ParserConfigurationException, SAXException {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        XMLReader xmlReader = spf.newSAXParser().getXMLReader();
+        XMLReaderAdapter xmlReaderAdapter = new XMLReaderAdapter(xmlReader);
+        parserAdapter = new ParserAdapter(xmlReaderAdapter);
+    }
+
+    /**
+     * Verifies parserAdapter.getContentHandler()
+     */
+    @Test
+    public void contentHandler01() {
+        ContentHandler contentHandler = new XMLFilterImpl();
+        parserAdapter.setContentHandler(contentHandler);
+        assertNotNull(parserAdapter.getContentHandler());
+    }
+
+    /**
+     * No exception is expected when set content handler as null.
+     */
+    @Test
+    public void contentHandler02() {
+        parserAdapter.setContentHandler(null);
+    }
+
+    /**
+     * Verifies parserAdapter.getEntityResolver()
+     */
+    @Test
+    public void entity01() {
+        XMLFilterImpl xmlFilter = new XMLFilterImpl();
+        parserAdapter.setEntityResolver(xmlFilter);
+        assertNotNull(parserAdapter.getEntityResolver());
+    }
+
+    /**
+     * No exception is expected when set entity resolver as null.
+     */
+    @Test
+    public void entity02() {
+        parserAdapter.setEntityResolver(null);
+    }
+
+    /**
+     * Verifies parserAdapter.getDTDHandler()
+     */
+    @Test
+    public void dtdHandler01() {
+        XMLFilterImpl xmlFilter = new XMLFilterImpl();
+        parserAdapter.setDTDHandler(xmlFilter);
+        assertNotNull(parserAdapter.getDTDHandler());
+    }
+
+    /**
+     * No exception is expected when set DTD handler as null.
+     */
+    @Test
+    public void dtdHandler02() {
+        parserAdapter.setDTDHandler(null);
+    }
+
+    /**
+     * Verifies parserAdapter.getErrorHandler()
+     */
+    @Test
+    public void errorHandler01() {
+        XMLFilterImpl eHandler = new XMLFilterImpl();
+        parserAdapter.setErrorHandler(eHandler);
+        assertNotNull(parserAdapter.getErrorHandler());
+    }
+
+    /**
+     * No exception is expected when set error handler as null.
+     */
+    @Test
+    public void errorHandler02() {
+        parserAdapter.setErrorHandler(null);
+    }
+
+    /**
+     * parserAdapter.getFeature(NAMESPACES) returns true be default.
+     */
+    @Test
+    public void getFeature01() {
+        try {
+           assertTrue(parserAdapter.getFeature(NAMESPACES));
+        } catch (SAXNotRecognizedException | SAXNotSupportedException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * parserAdapter.getFeature(NAMESPACE_PREFIXES) returns true be default.
+     */
+    @Test
+    public void getFeature02() {
+        try {
+           assertFalse(parserAdapter.getFeature(NAMESPACE_PREFIXES));
+        } catch (SAXNotRecognizedException | SAXNotSupportedException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * SAXNotRecognizedException thrown when feature name is not known one.
+     * @throws org.xml.sax.SAXNotRecognizedException expected Exception
+     */
+    @Test(expectedExceptions = SAXNotRecognizedException.class)
+    public void getFeature03() throws SAXNotRecognizedException {
+        try {
+            parserAdapter.getFeature("no-meaning-feature");
+        } catch (SAXNotSupportedException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * Obtain getFeature after it's set returns set value.
+     */
+    @Test
+    public void setFeature01() {
+        try {
+           parserAdapter.setFeature(NAMESPACES, false);
+           assertFalse(parserAdapter.getFeature(NAMESPACES));
+        } catch (SAXNotRecognizedException | SAXNotSupportedException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * Obtain getFeature after it's set returns set value.
+     */
+    @Test
+    public void setFeature02() {
+        try {
+           parserAdapter.setFeature(NAMESPACE_PREFIXES, false);
+           assertFalse(parserAdapter.getFeature(NAMESPACE_PREFIXES));
+        } catch (SAXNotRecognizedException | SAXNotSupportedException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * Obtain getFeature after it's set returns set value.
+     */
+    @Test
+    public void setFeature03() {
+        try {
+           parserAdapter.setFeature(NAMESPACES, true);
+           assertTrue(parserAdapter.getFeature(NAMESPACES));
+        } catch (SAXNotRecognizedException | SAXNotSupportedException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * Obtain getFeature after it's set returns set value.
+     */
+    @Test
+    public void setFeature04() {
+        try {
+           parserAdapter.setFeature(NAMESPACE_PREFIXES, true);
+           assertTrue(parserAdapter.getFeature(NAMESPACE_PREFIXES));
+        } catch (SAXNotRecognizedException | SAXNotSupportedException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * NPE expected when parsing a null object by ParserAdapter.
+     */
+    @Test(expectedExceptions = NullPointerException.class)
+    public void parse01() {
+        try {
+            parserAdapter.parse((InputSource)null);
+        } catch (IOException | SAXException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * SAXException expected when parsing a wrong-formatter XML with ParserAdapter.
+     * @throws org.xml.sax.SAXException
+     */
+    @Test(expectedExceptions = SAXException.class)
+    public void parse02() throws SAXException {
+        try(FileInputStream fis = new FileInputStream(XML_DIR + "invalid.xml")) {
+            InputSource is = new InputSource(fis);
+            parserAdapter.parse(is);
+        } catch (IOException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * Parse a well-formatter XML with ParserAdapter.
+     */
+    @Test
+    public void parse03() {
+        try(FileInputStream fis = new FileInputStream(XML_DIR + "correct.xml")) {
+            InputSource is = new InputSource(fis);
+            parserAdapter.parse(is);
+        } catch (IOException | SAXException ex) {
+            failUnexpected(ex);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/xml/sax/ptests/ResolverTest.java	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,133 @@
+/*
+ * Copyright (c) 2014, 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.xml.sax.ptests;
+
+import java.io.BufferedWriter;
+import java.io.FileInputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import static jaxp.library.JAXPTestUtilities.compareWithGold;
+import static jaxp.library.JAXPTestUtilities.failCleanup;
+import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import static org.testng.Assert.assertTrue;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.XMLFilterImpl;
+import static org.xml.sax.ptests.SAXTestConst.CLASS_DIR;
+import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR;
+import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
+
+/**
+ * Entity resolver should be invoked in XML parse. This test verifies parsing
+ * process by checking the output with golden file.
+ */
+public class ResolverTest {
+    /**
+     * Unit test for entityResolver setter.
+     */
+    public void testResolver() {
+        String outputFile = CLASS_DIR + "EntityResolver.out";
+        String goldFile = GOLDEN_DIR + "EntityResolverGF.out";
+        String xmlFile = XML_DIR + "publish.xml";
+
+        try(FileInputStream instream = new FileInputStream(xmlFile);
+                MyEntityResolver eResolver = new MyEntityResolver(outputFile)) {
+            SAXParser saxParser = SAXParserFactory.newInstance().newSAXParser();
+            XMLReader xmlReader = saxParser.getXMLReader();
+            xmlReader.setEntityResolver(eResolver);
+            InputSource is = new InputSource(instream);
+            xmlReader.parse(is);
+        } catch(IOException | SAXException | ParserConfigurationException ex ) {
+            failUnexpected(ex);
+        }
+        // Need close the output file before we compare it with golden file.
+        try {
+            assertTrue(compareWithGold(goldFile, outputFile));
+        } catch (IOException ex) {
+            failUnexpected(ex);
+        } finally {
+            try {
+                Path outputPath = Paths.get(outputFile);
+                if(Files.exists(outputPath))
+                    Files.delete(outputPath);
+            } catch (IOException ex) {
+                failCleanup(ex, outputFile);
+            }
+        }
+    }
+}
+
+/**
+ * Simple entity resolver to write every entity to an output file.
+ */
+class MyEntityResolver extends XMLFilterImpl implements AutoCloseable {
+    /**
+     * FileWriter to write string to output file.
+     */
+    private final BufferedWriter bWriter;
+
+    /**
+     * Initiate FileWriter when construct a MyContentHandler.
+     * @param outputFileName output file name.
+     * @throws SAXException creation of FileWriter failed.
+     */
+    MyEntityResolver(String outputFileName) throws SAXException {
+        super();
+        try {
+            bWriter = new BufferedWriter(new FileWriter(outputFileName));
+        } catch (IOException ex) {
+            throw new SAXException(ex);
+        }
+    }
+
+    /**
+     * Write In resolveEntity tag along with publicid and systemId when meet
+     * resolveEntity event.
+     * @throws IOException error happen when writing file.
+     */
+    @Override
+    public InputSource resolveEntity(String publicid, String systemid)
+            throws SAXException, IOException {
+        String str = "In resolveEntity.." + " " + publicid + " " + systemid;
+        bWriter.write( str, 0,str.length());
+        bWriter.newLine();
+        return super.resolveEntity(publicid, systemid);
+    }
+
+    /**
+     * Flush the content and close the file.
+     * @throws IOException error happen when writing file or closing file.
+     */
+    @Override
+    public void close() throws IOException {
+        bWriter.flush();
+        bWriter.close();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/xml/sax/ptests/SAXParserNSTableTest.java	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,134 @@
+/*
+ * Copyright (c) 2014, 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.xml.sax.ptests;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import static jaxp.library.JAXPTestUtilities.compareWithGold;
+import static jaxp.library.JAXPTestUtilities.failCleanup;
+import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import static org.testng.Assert.assertTrue;
+import org.testng.annotations.Test;
+import org.xml.sax.SAXException;
+import static org.xml.sax.ptests.SAXTestConst.CLASS_DIR;
+import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR;
+import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
+
+/**
+ * This class contains the testcases to test SAXParser with regard to
+ * Namespace Table defined at http://www.megginson.com/SAX/Java/namespaces.html
+ */
+public class SAXParserNSTableTest {
+    /**
+     * namespace processing is enabled. namespace-prefix is also is enabled.
+     * So it is a True-True combination.
+     * The test is to test SAXParser with these conditions
+     */
+    @Test
+    public void testWithTrueTrue() {
+        String outputFile = CLASS_DIR + "SPNSTableTT.out";
+        String goldFile = GOLDEN_DIR + "NSTableTTGF.out";
+        String xmlFile = XML_DIR + "namespace1.xml";
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            spf.setNamespaceAware(true);
+            spf.setFeature("http://xml.org/sax/features/namespace-prefixes",
+                                        true);
+
+            SAXParser saxParser = spf.newSAXParser();
+            saxParser.parse(new File(xmlFile), new MyNSContentHandler(outputFile));
+            assertTrue(compareWithGold(goldFile, outputFile));
+        } catch (ParserConfigurationException | SAXException | IOException ex) {
+            failUnexpected(ex);
+        } finally {
+            try {
+                Path outputPath = Paths.get(outputFile);
+                if(Files.exists(outputPath))
+                    Files.delete(outputPath);
+            } catch (IOException ex) {
+                failCleanup(ex, outputFile);
+            }
+        }
+    }
+    /**
+     * namespace processing is enabled. Hence namespace-prefix is
+     * expected to be automaically off. So it is a True-False combination.
+     * The test is to test SAXParser with these conditions
+     */
+    public void testWithTrueFalse() {
+        String outputFile = CLASS_DIR + "SPNSTableTF.out";
+        String goldFile = GOLDEN_DIR + "NSTableTFGF.out";
+        String xmlFile = XML_DIR + "namespace1.xml";
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            spf.setNamespaceAware(true);
+            SAXParser saxParser = spf.newSAXParser();
+            saxParser.parse(new File(xmlFile), new MyNSContentHandler(outputFile));
+            assertTrue(compareWithGold(goldFile, outputFile));
+        } catch (ParserConfigurationException | SAXException | IOException ex) {
+            failUnexpected(ex);
+        } finally {
+            try {
+                Path outputPath = Paths.get(outputFile);
+                if(Files.exists(outputPath))
+                    Files.delete(outputPath);
+            } catch (IOException ex) {
+                failCleanup(ex, outputFile);
+            }
+        }
+    }
+
+    /**
+     * namespace processing is not enabled. Hence namespace-prefix is
+     * expected to be automaically on. So it is a False-True combination.
+     * The test is to test SAXParser with these conditions
+     */
+    public void testWithFalseTrue() {
+        String outputFile = CLASS_DIR + "SPNSTableFT.out";
+        String goldFile = GOLDEN_DIR + "NSTableFTGF.out";
+        String xmlFile = XML_DIR + "namespace1.xml";
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            spf.setNamespaceAware(true);
+            SAXParser saxParser = spf.newSAXParser();
+            saxParser.parse(new File(xmlFile), new MyNSContentHandler(outputFile));
+            assertTrue(compareWithGold(goldFile, outputFile));
+        } catch (ParserConfigurationException | SAXException | IOException ex) {
+            failUnexpected(ex);
+        } finally {
+            try {
+                Path outputPath = Paths.get(outputFile);
+                if(Files.exists(outputPath))
+                    Files.delete(outputPath);
+            } catch (IOException ex) {
+                failCleanup(ex, outputFile);
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLFilterCBTest.java	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,281 @@
+/*
+ * Copyright (c) 2014, 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.xml.sax.ptests;
+
+import java.io.BufferedWriter;
+import java.io.FileInputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParserFactory;
+import static jaxp.library.JAXPTestUtilities.compareWithGold;
+import static jaxp.library.JAXPTestUtilities.failCleanup;
+import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import static org.testng.Assert.assertTrue;
+import org.xml.sax.Attributes;
+import org.xml.sax.InputSource;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.XMLFilterImpl;
+import static org.xml.sax.ptests.SAXTestConst.CLASS_DIR;
+import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR;
+import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
+
+/**
+ * Set parent of XMLFilter to XMLReader. Parsing on XML file will invoke XMLFilter
+ * to write to output file. Test verifies output is same as the golden file.
+ */
+public class XMLFilterCBTest {
+    public void testXMLFilterCB() {
+        String outputFile = CLASS_DIR + "XMLFilter.out";
+        String goldFile = GOLDEN_DIR + "XMLFilterGF.out";
+        String xmlFile = XML_DIR + "namespace1.xml";
+
+        try (FileInputStream fis = new FileInputStream(xmlFile)){
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            spf.setNamespaceAware(true);
+            XMLReader xmlReader = spf.newSAXParser().getXMLReader();
+
+            MyXMLFilter myXmlFilter = new MyXMLFilter(outputFile);
+            myXmlFilter.setParent(xmlReader);
+            InputSource is = new InputSource(fis);
+            myXmlFilter.parse(is);
+        } catch( SAXException | IOException | ParserConfigurationException ex) {
+            failUnexpected(ex);
+        }
+        // Need close the output file before we compare it with golden file.
+        try {
+            assertTrue(compareWithGold(goldFile, outputFile));
+        } catch (IOException ex) {
+            failUnexpected(ex);
+        } finally {
+            try {
+                Path outputPath = Paths.get(outputFile);
+                if(Files.exists(outputPath))
+                    Files.delete(outputPath);
+            } catch (IOException ex) {
+                failCleanup(ex, outputFile);
+            }
+        }
+    }
+}
+
+/**
+ * Writer XMLFiler which write all tags to output file when event happens.
+ */
+class MyXMLFilter extends XMLFilterImpl{
+    /**
+     * FileWriter to write string to output file.
+     */
+    private final BufferedWriter bWriter;
+
+    /**
+     * Initiate FileWriter for output file.
+     * @param outputFileName output file name.
+     * @throws SAXException if open file failed.
+     */
+    MyXMLFilter(String outputFileName) throws SAXException {
+        try {
+            bWriter = new BufferedWriter(new FileWriter(outputFileName));
+        } catch (IOException ex) {
+            throw new SAXException(ex);
+        }
+    }
+
+    /**
+     * Write characters tag along with content of characters when meet
+     * characters event.
+     * @throws IOException error happen when writing file.
+     */
+    @Override
+    public void characters(char[] ch, int start, int length) throws SAXException {
+        String s = new String(ch, start, length);
+        println("characters...\n" + s);
+    }
+
+    /**
+     * Write endDocument tag then flush the content and close the file when meet
+     * endDocument event.
+     * @throws IOException error happen when writing file or closing file.
+     */
+    @Override
+    public void endDocument() throws SAXException {
+        try {
+            println("endDocument...");
+            bWriter.flush();
+            bWriter.close();
+        } catch (IOException ex) {
+            throw new SAXException(ex);
+        }
+    }
+
+    /**
+     * Write endElement tag with namespaceURI, localName, qName to the file when
+     * meet endElement event.
+     * @throws IOException error happen when writing file.
+     */
+    @Override
+    public void endElement(String namespaceURI,String localName,String qName)
+            throws SAXException{
+        println("endElement...\n" + "namespaceURI: " + namespaceURI +
+                " localName: "+ localName + " qName: " + qName);
+    }
+
+    /**
+     * Write endPrefixMapping tag along with prefix to the file when meet
+     * endPrefixMapping event.
+     * @throws IOException error happen when writing file.
+     */
+    @Override
+    public void endPrefixMapping(String prefix) throws SAXException {
+        println("endPrefixmapping .." + prefix);
+    }
+
+    /**
+     * Write error tag along with exception to the file when meet recoverable
+     * error event.
+     * @throws IOException error happen when writing file.
+     */
+    @Override
+    public void error(SAXParseException e) throws SAXException {
+        println("error: " + e.getMessage());
+    }
+
+    /**
+     * Write fatalError tag along with exception to the file when meet
+     * unrecoverable error event.
+     * @throws IOException error happen when writing file.
+     */
+    @Override
+    public void fatalError(SAXParseException e) throws SAXException {
+        println("fatal error: ");
+    }
+
+    /**
+     * Write warning tag along with exception to the file when meet warning event.
+     * @throws IOException error happen when writing file.
+     */
+    @Override
+    public void warning(SAXParseException e) throws SAXException {
+        println("warning : ");
+    }
+
+    /**
+     * Write ignorableWhitespace tag along with white spaces when meet
+     * ignorableWhitespace event.
+     * @throws IOException error happen when writing file.
+     */
+    @Override
+    public void ignorableWhitespace(char[] ch, int start, int length)
+            throws SAXException {
+        String s = new String(ch, start, length);
+        println("ignorableWhitespace...\n" + s +
+                " ignorable white space string length: " + s.length());
+    }
+
+    /**
+     * Write processingInstruction tag along with target name and target data
+     * when meet processingInstruction event.
+     * @throws IOException error happen when writing file.
+     */
+    @Override
+    public void processingInstruction(String target, String data)
+            throws SAXException {
+        println("processingInstruction...target:" + target +
+                        " data: " + data);
+    }
+
+    /**
+     * Write setDocumentLocator tag when meet setDocumentLocator event.
+     */
+    @Override
+    public void setDocumentLocator(Locator locator) {
+        try {
+            println("setDocumentLocator...");
+        } catch (SAXException ex) {
+            System.err.println(ex);
+        }
+    }
+
+    /**
+     * Write skippedEntity tag along with entity name when meet skippedEntity
+     * event.
+     * @throws IOException error happen when writing file.
+     */
+    @Override
+    public void skippedEntity(String name) throws SAXException {
+        println("skippedEntity...\n" + "name: " + name);
+    }
+
+    /**
+     * Write startDocument tag when meet startDocument event.
+     * @throws IOException error happen when writing file.
+     */
+    @Override
+    public void startDocument() throws SAXException {
+        println("startDocument...");
+    }
+
+    /**
+     * Write startElement tag along with namespaceURI, localName, qName, number
+     * of attributes and line number when meet startElement event.
+     * @throws IOException error happen when writing file.
+     */
+    @Override
+    public void startElement(String namespaceURI, String localName,
+                    String qName, Attributes atts) throws SAXException {
+        println("startElement...\n" + "namespaceURI: " +  namespaceURI +
+                        " localName: " + localName +  " qName: " + qName +
+                        " Number of Attributes: " + atts.getLength());
+    }
+
+    /**
+     * Write startPrefixMapping tag along with prefix and uri when meet
+     * startPrefixMapping event.
+     * @throws IOException error happen when writing file.
+     */
+    @Override
+    public void startPrefixMapping(String prefix, String uri) throws SAXException {
+        println("startPrefixMapping...\n" + "prefix: "
+                                + prefix + " uri: " + uri);
+    }
+
+    /**
+     * Write outString to file.
+     * @param outString String to be written to File
+     * @throws SAXException if write file failed
+     */
+    private void println(String outString) throws SAXException {
+        try {
+            bWriter.write( outString, 0, outString.length());
+            bWriter.newLine();
+        } catch (IOException ex) {
+            throw new SAXException(ex);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLFilterTest.java	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,267 @@
+/*
+ * Copyright (c) 2014, 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.xml.sax.ptests;
+
+import java.io.FileInputStream;
+import java.io.IOException;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParserFactory;
+import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
+import org.testng.annotations.Test;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXNotRecognizedException;
+import org.xml.sax.SAXNotSupportedException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.XMLFilterImpl;
+import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
+
+/**
+ * Unit test for XMLFilter.
+ */
+public class XMLFilterTest {
+    /**
+     * name spaces constant.
+     */
+    private static final String NAMESPACES =
+                "http://xml.org/sax/features/namespaces";
+
+    /**
+     * name spaces prefixes constant.
+     */
+    private static final String NAMESPACE_PREFIXES =
+                "http://xml.org/sax/features/namespace-prefixes";
+
+    /**
+     * No exception expected when set a correct content handler.
+     */
+    @Test
+    public void contentHandler01() {
+        XMLFilterImpl xmlFilter = new XMLFilterImpl();
+        xmlFilter.setContentHandler(xmlFilter);
+        assertNotNull(xmlFilter.getContentHandler());
+    }
+
+    /**
+     * No exception is expected when set content handler as null.
+     */
+    @Test
+    public void contentHandler02() {
+        new XMLFilterImpl().setContentHandler(null);
+    }
+
+    /**
+     * No exception expected when set a correct entity solver.
+     */
+    @Test
+    public void entity01() {
+        XMLFilterImpl xmlFilter = new XMLFilterImpl();
+        xmlFilter.setEntityResolver(xmlFilter);
+        assertNotNull(xmlFilter.getEntityResolver());
+    }
+
+    /**
+     * No exception is expected when set entity resolver as null.
+     */
+    @Test
+    public void entity02() {
+        new XMLFilterImpl().setEntityResolver(null);
+    }
+
+    /**
+     * No exception expected when set a correct DTD handler.
+     */
+    @Test
+    public void dtdHandler01() {
+        XMLFilterImpl xmlFilter = new XMLFilterImpl();
+        xmlFilter.setDTDHandler(xmlFilter);
+        assertNotNull(xmlFilter.getDTDHandler());
+    }
+
+    /**
+     * No exception is expected when set DTD handler as null.
+     */
+    @Test
+    public void dtdHandler02() {
+        new XMLFilterImpl().setDTDHandler(null);
+    }
+
+    /**
+     * No exception expected when set a correct error handler.
+     */
+    @Test
+    public void errorHandler01() {
+        XMLFilterImpl xmlFilter = new XMLFilterImpl();
+        xmlFilter.setErrorHandler(xmlFilter);
+        assertNotNull(xmlFilter.getErrorHandler());
+    }
+
+    /**
+     * No exception is expected when set error handler as null.
+     */
+    @Test
+    public void errorHandler02() {
+        new XMLFilterImpl().setErrorHandler(null);
+    }
+
+    /**
+     * By default true is expected get namespaces feature.
+     * @throws SAXException
+     */
+    @Test
+    public void getFeature01() throws SAXException {
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            spf.setNamespaceAware(true);
+            XMLReader xmlReader = spf.newSAXParser().getXMLReader();
+
+            XMLFilterImpl xmlFilter = new XMLFilterImpl();
+            xmlFilter.setParent(xmlReader);
+            assertTrue(xmlFilter.getFeature(NAMESPACES));
+        } catch (SAXException | ParserConfigurationException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * By default false is expected get namespaces-prefix feature.
+     */
+    @Test
+    public void getFeature02() {
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            spf.setNamespaceAware(true);
+            XMLReader xmlReader = spf.newSAXParser().getXMLReader();
+
+            XMLFilterImpl xmlFilter = new XMLFilterImpl();
+            xmlFilter.setParent(xmlReader);
+            assertFalse(xmlFilter.getFeature(NAMESPACE_PREFIXES));
+        } catch (SAXException | ParserConfigurationException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * SAXNotRecognizedException is expected when get a feature by an invalid
+     * feature name.
+     * @throws org.xml.sax.SAXNotRecognizedException If the feature
+     *            value can't be assigned or retrieved from the parent.
+     * @throws org.xml.sax.SAXNotSupportedException When the
+     *            parent recognizes the feature name but
+     *            cannot determine its value at this time.
+     */
+    @Test(expectedExceptions = SAXNotRecognizedException.class)
+    public void getFeature03() throws SAXNotRecognizedException,
+           SAXNotSupportedException {
+        new XMLFilterImpl().getFeature("no-meaning-feature");
+    }
+
+    /**
+     * Set namespaces feature to a value to XMLFilter. it's expected same when
+     * obtain it again.
+     */
+    @Test
+    public void setFeature01() {
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            spf.setNamespaceAware(true);
+            XMLReader xmlReader = spf.newSAXParser().getXMLReader();
+
+            XMLFilterImpl xmlFilter = new XMLFilterImpl();
+            xmlFilter.setParent(xmlReader);
+            xmlFilter.setFeature(NAMESPACES, false);
+            assertFalse(xmlFilter.getFeature(NAMESPACES));
+            xmlFilter.setFeature(NAMESPACES, true);
+            assertTrue(xmlFilter.getFeature(NAMESPACES));
+        } catch (SAXException | ParserConfigurationException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * Set namespaces-prefix feature to a value to XMLFilter. it's expected same
+     * when obtain it again.
+     */
+    @Test
+    public void setFeature02() {
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            spf.setNamespaceAware(true);
+            XMLReader xmlReader = spf.newSAXParser().getXMLReader();
+
+            XMLFilterImpl xmlFilter = new XMLFilterImpl();
+            xmlFilter.setParent(xmlReader);
+            xmlFilter.setFeature(NAMESPACE_PREFIXES, false);
+            assertFalse(xmlFilter.getFeature(NAMESPACE_PREFIXES));
+            xmlFilter.setFeature(NAMESPACE_PREFIXES, true);
+            assertTrue(xmlFilter.getFeature(NAMESPACE_PREFIXES));
+        } catch (SAXException | ParserConfigurationException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * NullPointerException is expected when parse a null InputSource.
+     */
+    @Test(expectedExceptions = NullPointerException.class)
+    public void parse01() {
+        try {
+            new XMLFilterImpl().parse((InputSource)null);
+        } catch (IOException | SAXException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * SAXException is expected when parsing a invalid formatted XML file.
+     * @throws org.xml.sax.SAXException when parse a incorrect formatted XML
+     * file.
+     */
+    @Test(expectedExceptions = NullPointerException.class)
+    public void parse02() throws SAXException {
+        XMLFilterImpl xmlFilter = new XMLFilterImpl();
+        try(FileInputStream fis = new FileInputStream(XML_DIR + "invalid.xml")) {
+            InputSource is = new InputSource(fis);
+            xmlFilter.parse(is);
+        } catch (IOException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * No exception when parse a normal XML file.
+     */
+    @Test(expectedExceptions = NullPointerException.class)
+    public void parse03() {
+        XMLFilterImpl xmlFilter = new XMLFilterImpl();
+        try(FileInputStream fis = new FileInputStream(XML_DIR + "correct2.xml")) {
+            InputSource is = new InputSource(fis);
+            xmlFilter.parse(is);
+        } catch (IOException | SAXException ex) {
+            failUnexpected(ex);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderAdapterTest.java	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,117 @@
+/*
+ * Copyright (c) 2014, 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.xml.sax.ptests;
+
+import java.io.FileInputStream;
+import java.io.IOException;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParserFactory;
+import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
+import org.testng.annotations.Test;
+import org.xml.sax.HandlerBase;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.XMLReaderAdapter;
+import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
+
+/**
+ * Class containing the test cases for XMLReaderAdapter API
+ */
+public class XMLReaderAdapterTest {
+    /**
+     * http://xml.org/sax/features/namespace-prefixes property name.
+     */
+    private final static String NM_PREFIXES_PROPERTY
+            = "http://xml.org/sax/features/namespace-prefixes";
+
+    /**
+     * To test the constructor that uses "org.xml.sax.driver" property
+     * @throws org.xml.sax.SAXException If the embedded driver cannot be
+     * instantiated or if the org.xml.sax.driver property is not specified.
+     */
+    @Test
+    public void constructor01() throws SAXException {
+        assertNotNull(new XMLReaderAdapter());
+    }
+
+    /**
+     * To test the constructor that uses XMLReader
+     */
+    @Test
+    public void constructor02() {
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            XMLReader xmlReader = spf.newSAXParser().getXMLReader();
+
+            assertNotNull(new XMLReaderAdapter(xmlReader));
+        } catch (ParserConfigurationException | SAXException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * To test the parse method. The specification says that this method
+     * will throw an exception if the embedded XMLReader does not support
+     * the http://xml.org/sax/features/namespace-prefixes property.
+     */
+    @Test
+    public void nsfeature01() {
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            XMLReader xmlReader = spf.newSAXParser().getXMLReader();
+            if (!xmlReader.getFeature(NM_PREFIXES_PROPERTY)) {
+                xmlReader.setFeature(NM_PREFIXES_PROPERTY, true);
+            }
+
+            assertTrue(xmlReader.getFeature(NM_PREFIXES_PROPERTY));
+        } catch (SAXException | ParserConfigurationException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * To test the parse method. The specification says that this method
+     * will throw an exception if the embedded XMLReader does not support
+     * the http://xml.org/sax/features/namespace-prefixes property.
+     */
+    @Test
+    public void parse01() {
+        try (FileInputStream fis = new FileInputStream(XML_DIR + "namespace1.xml")) {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            XMLReader xmlReader = spf.newSAXParser().getXMLReader();
+            if (!xmlReader.getFeature(NM_PREFIXES_PROPERTY)) {
+                xmlReader.setFeature(NM_PREFIXES_PROPERTY, true);
+            }
+            XMLReaderAdapter xmlRA = new XMLReaderAdapter(xmlReader);
+
+            InputSource is = new InputSource(fis);
+            xmlRA.setDocumentHandler(new HandlerBase());
+            xmlRA.parse(is);
+        } catch (IOException | SAXException | ParserConfigurationException ex) {
+            failUnexpected(ex);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderFactoryTest.java	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2014, 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.xml.sax.ptests;
+
+import static org.testng.Assert.assertNotNull;
+import org.testng.annotations.Test;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.XMLReaderFactory;
+
+/**
+ * Unit test for XMLReaderFactory.createXMLReader API.
+ */
+public class XMLReaderFactoryTest {
+    /**
+     * No exception expected when create XMLReader by default.
+     * @throws org.xml.sax.SAXException when xml reader creation failed.
+     */
+    @Test
+    public void createReader01() throws SAXException {
+        assertNotNull(XMLReaderFactory.createXMLReader());
+    }
+
+    /**
+     * No exception expected when create XMLReader with driver name
+     * org.apache.xerces.parsers.SAXParser
+     * or com.sun.org.apache.xerces.internal.parsers.SAXParser.
+     * @throws org.xml.sax.SAXException when xml reader creation failed.
+     */
+    @Test
+    public void createReader02() throws SAXException {
+        //Disable this test because this is only work for apache implementation.
+        /*System.setProperty("org.xml.sax.driver",
+            "org.apache.xerces.parsers.SAXParser");
+        assertNotNull(XMLReaderFactory.
+            createXMLReader("org.apache.xerces.parsers.SAXParser"));*/
+        System.setProperty("org.xml.sax.driver",
+            "com.sun.org.apache.xerces.internal.parsers.SAXParser");
+        assertNotNull(XMLReaderFactory.
+            createXMLReader("com.sun.org.apache.xerces.internal.parsers.SAXParser"));
+    }
+
+    /**
+     * SAXException expected when create XMLReader with an invalid driver name.
+     * @throws org.xml.sax.SAXException expected Exception
+     */
+    @Test(expectedExceptions = SAXException.class,
+            expectedExceptionsMessageRegExp =
+                    "SAX2 driver class org.apache.crimson.parser.ABCD not found")
+    public void createReader03() throws SAXException{
+        XMLReaderFactory.createXMLReader("org.apache.crimson.parser.ABCD");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderNSTableTest.java	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2014, 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.xml.sax.ptests;
+
+import java.io.FileInputStream;
+import java.io.IOException;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import static jaxp.library.JAXPTestUtilities.compareWithGold;
+import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import static org.testng.Assert.assertTrue;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+import static org.xml.sax.ptests.SAXTestConst.CLASS_DIR;
+import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR;
+import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
+
+/** This class contains the testcases to test XMLReader with regard to
+  * Namespace Table defined at
+  * http://www.megginson.com/SAX/Java/namespaces.html
+  */
+public class XMLReaderNSTableTest {
+    /**
+     * XML file that used to be parsed.
+     */
+    private static final String xmlFile = XML_DIR + "namespace1.xml";
+
+    /**
+     * XML namespaces prefixes.
+     */
+    private static final String NAMESPACE_PREFIXES =
+                "http://xml.org/sax/features/namespace-prefixes";
+    /**
+     * namespace processing is enabled. namespace-prefix is also is enabled.
+     * So it is a True-True combination.
+     * The test is to test XMLReader with these conditions
+     */
+    public void testWithTrueTrue() {
+        String outputFile = CLASS_DIR + "XRNSTableTT.out";
+        String goldFile = GOLDEN_DIR + "NSTableTTGF.out";
+
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            spf.setNamespaceAware(true);
+            SAXParser saxParser = spf.newSAXParser();
+
+            XMLReader xmlReader = saxParser.getXMLReader();
+            xmlReader.setFeature(NAMESPACE_PREFIXES, true);
+
+            xmlReader.setContentHandler(new MyNSContentHandler(outputFile));
+            xmlReader.parse(new InputSource(new FileInputStream(xmlFile)));
+            assertTrue(compareWithGold(goldFile, outputFile));
+        } catch (ParserConfigurationException | SAXException | IOException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * Namespace processing is enabled. Hence namespace-prefix is
+     * expected to be automaically off. So it is a True-False combination.
+     * The test is to test XMLReader with these conditions
+     */
+    public void testWithTrueFalse() {
+        String outputFile = CLASS_DIR + "XRNSTableTF.out";
+        String goldFile = GOLDEN_DIR + "NSTableTFGF.out";
+
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            spf.setNamespaceAware(true);
+            SAXParser saxParser = spf.newSAXParser();
+            XMLReader xmlReader = saxParser.getXMLReader();
+
+            xmlReader.setContentHandler(new MyNSContentHandler(outputFile));
+            xmlReader.parse(new InputSource(new FileInputStream(xmlFile)));
+            assertTrue(compareWithGold(goldFile, outputFile));
+        } catch (ParserConfigurationException | SAXException | IOException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * namespace processing is not enabled. Hence namespace-prefix is
+     * expected to be automaically on. So it is a False-True combination.
+     * The test is to test XMLReader with these conditions
+     */
+    public void testWithFalseTrue() {
+        String outputFile = CLASS_DIR + "XRNSTableFT.out";
+        String goldFile = GOLDEN_DIR + "NSTableFTGF.out";
+
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            spf.setNamespaceAware(true);
+            SAXParser saxParser = spf.newSAXParser();
+            XMLReader xmlReader = saxParser.getXMLReader();
+
+            xmlReader.setContentHandler(new MyNSContentHandler(outputFile));
+            xmlReader.parse(new InputSource(new FileInputStream(xmlFile)));
+            assertTrue(compareWithGold(goldFile, outputFile));
+        } catch (ParserConfigurationException | SAXException | IOException ex) {
+            failUnexpected(ex);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderTest.java	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,738 @@
+/*
+ * Copyright (c) 2014, 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.xml.sax.ptests;
+
+import java.io.FileInputStream;
+import java.io.IOException;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParserFactory;
+import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertNull;
+import static org.testng.Assert.assertTrue;
+import org.testng.annotations.Test;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXNotRecognizedException;
+import org.xml.sax.SAXNotSupportedException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.ext.DeclHandler;
+import org.xml.sax.ext.LexicalHandler;
+import org.xml.sax.helpers.XMLFilterImpl;
+import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
+
+/**
+ * Class containing the test cases for SAXParser API
+ */
+public class XMLReaderTest {
+    /**
+     * XML namespaces.
+     */
+    private static final String NAMESPACES =
+                "http://xml.org/sax/features/namespaces";
+
+    /**
+     * XML namespaces prefixes.
+     */
+    private static final String NAMESPACE_PREFIXES =
+                "http://xml.org/sax/features/namespace-prefixes";
+
+    /**
+     * A string intern name.
+     */
+    private static final String STRING_INTERNING =
+                "http://xml.org/sax/features/string-interning";
+
+    /**
+     * Validation name.
+     */
+    private static final String VALIDATION =
+                "http://xml.org/sax/features/validation";
+
+    /**
+     * A general external entities name
+     */
+    private static final String EXTERNAL_G_ENTITIES =
+                "http://xml.org/sax/features/external-general-entities";
+
+    /**
+     * A external parameter entities name
+     */
+    private static final String EXTERNAL_P_ENTITIES =
+                "http://xml.org/sax/features/external-parameter-entities";
+
+    /**
+     * XML DOM node name.
+     */
+    private static final String DOM_NODE = "http://xml.org/sax/properties/dom-node";
+
+    /**
+     * XML String name.
+     */
+    private static final String XML_STRING = "http://xml.org/sax/properties/xml-string";
+
+    /**
+     * Declare handler name
+     */
+    private static final String DECL_HANDLER =
+                        "http://xml.org/sax/properties/declaration-handler";
+
+    /**
+     * Lexical handler name
+     */
+    private static final String LEXICAL_HANDLER =
+                        "http://xml.org/sax/properties/lexical-handler";
+
+    /**
+     * According to the SAX2 specs, All XMLReaders are required to recognize the
+     * http://xml.org/sax/features/namespaces feature names.
+     * This test case is to test this.
+     */
+    @Test
+    public void featureNS01() {
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            XMLReader xmlReader =  spf.newSAXParser().getXMLReader();
+            assertFalse(xmlReader.getFeature(NAMESPACES));
+        } catch (ParserConfigurationException | SAXException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * According to the SAX2 specs, All XMLReaders are required to recognize the
+     * http://xml.org/sax/features/namespaces feature names.
+     * This test case is to test this.
+     */
+    @Test
+    public void featureNS02() {
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            spf.setNamespaceAware(true);
+            XMLReader xmlReader =  spf.newSAXParser().getXMLReader();
+            assertTrue(xmlReader.getFeature(NAMESPACES));
+        } catch (ParserConfigurationException | SAXException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * Obtain http://xml.org/sax/features/namespaces feature name after it's
+     * just set. Expect it's same as set value.
+     */
+    @Test
+    public void featureNS03() {
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            XMLReader xmlReader =  spf.newSAXParser().getXMLReader();
+            xmlReader.setFeature(NAMESPACES, true);
+            assertTrue(xmlReader.getFeature(NAMESPACES));
+            xmlReader.setFeature(NAMESPACES, false);
+            assertFalse(xmlReader.getFeature(NAMESPACES));
+        } catch (ParserConfigurationException | SAXException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * According to the SAX2 specs, All XMLReaders are required to recognize the
+     * http://xml.org/sax/features/namespace-prefixes feature names.
+     * This test case is to test this.
+     */
+    @Test
+    public void featureNSP01() {
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            XMLReader xmlReader =  spf.newSAXParser().getXMLReader();
+            assertTrue(xmlReader.getFeature(NAMESPACE_PREFIXES));
+
+        } catch (ParserConfigurationException | SAXException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * According to the SAX2 specs, All XMLReaders are required to recognize the
+     * http://xml.org/sax/features/namespace-prefixes feature names.
+     * This test case is to test this.
+     */
+    @Test
+    public void featureNSP02() {
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            spf.setNamespaceAware(true);
+            XMLReader xmlReader =  spf.newSAXParser().getXMLReader();
+            assertFalse(xmlReader.getFeature(NAMESPACE_PREFIXES));
+        } catch (ParserConfigurationException | SAXException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * Obtain http://xml.org/sax/features/namespaces-prefixes feature name after
+     * it's just set. Expect it's same as set value.
+     */
+    @Test
+    public void featureNSP03() {
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            XMLReader xmlReader =  spf.newSAXParser().getXMLReader();
+            xmlReader.setFeature(NAMESPACE_PREFIXES, true);
+            assertTrue(xmlReader.getFeature(NAMESPACE_PREFIXES));
+            xmlReader.setFeature(NAMESPACE_PREFIXES, false);
+            assertFalse(xmlReader.getFeature(NAMESPACE_PREFIXES));
+        } catch (ParserConfigurationException | SAXException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * getFeature returns true if a feature has not been preset when namespace
+     * awareness is set.
+     */
+    @Test
+    public void featureSI01() {
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            spf.setNamespaceAware(true);
+            XMLReader xmlReader =  spf.newSAXParser().getXMLReader();
+            assertTrue(xmlReader.getFeature(STRING_INTERNING));
+        } catch (SAXException | ParserConfigurationException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * getFeature with validation feature name returns the value that
+     * setValidation set.
+     */
+    @Test
+    public void featureV01() {
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            assertFalse(spf.newSAXParser().getXMLReader().getFeature(VALIDATION));
+            spf.setValidating(true);
+            assertTrue(spf.newSAXParser().getXMLReader().getFeature(VALIDATION));
+        } catch (SAXException | ParserConfigurationException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * getFeature returns the value that a feature has been preset as  when
+     * namespace awareness is set.
+     */
+    @Test
+    public void featureV02() {
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            XMLReader xmlReader =  spf.newSAXParser().getXMLReader();
+
+            xmlReader.setFeature(VALIDATION, true);
+            assertTrue(xmlReader.getFeature(VALIDATION));
+
+            xmlReader.setFeature(VALIDATION, false);
+            assertFalse(xmlReader.getFeature(VALIDATION));
+        } catch (SAXException | ParserConfigurationException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * getFeature returns true if a feature has not been preset when namespace
+     * awareness is set.
+     */
+    @Test
+    public void featureEGE01() {
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            spf.setNamespaceAware(true);
+            XMLReader xmlReader =  spf.newSAXParser().getXMLReader();
+            assertTrue(xmlReader.getFeature(EXTERNAL_G_ENTITIES));
+        } catch (SAXException | ParserConfigurationException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * getFeature returns false if a feature has been preset as false  when
+     * namespace awareness is set.
+     */
+    @Test
+    public void featureEGE02() {
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            spf.setNamespaceAware(true);
+            XMLReader xmlReader =  spf.newSAXParser().getXMLReader();
+            xmlReader.setFeature(EXTERNAL_G_ENTITIES, false);
+            assertFalse(xmlReader.getFeature(EXTERNAL_G_ENTITIES));
+        } catch (SAXException | ParserConfigurationException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * getFeature returns true if a feature has not been preset when namespace
+     * awareness is set.
+     */
+    @Test
+    public void featureEPE01() {
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            spf.setNamespaceAware(true);
+            XMLReader xmlReader =  spf.newSAXParser().getXMLReader();
+            assertTrue(xmlReader.getFeature(EXTERNAL_P_ENTITIES));
+        } catch (SAXException | ParserConfigurationException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * getFeature returns false if a feature has been preset as false  when
+     * namespace awareness is set.
+     */
+    @Test
+    public void featureEPE02() {
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            spf.setNamespaceAware(true);
+            XMLReader xmlReader = spf.newSAXParser().getXMLReader();
+            xmlReader.setFeature(EXTERNAL_P_ENTITIES, false);
+            assertFalse(xmlReader.getFeature(EXTERNAL_P_ENTITIES));
+        } catch (SAXException | ParserConfigurationException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * getFeature with a unknown feature name throws SAXNotRecognizedException.
+     * @throws SAXNotRecognizedException If the feature value can't be assigned
+     *                                   or retrieved.
+     */
+    @Test(expectedExceptions = SAXNotRecognizedException.class)
+    public void featureNE01() throws SAXNotRecognizedException  {
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            spf.setNamespaceAware(true);
+            XMLReader xmlReader =  spf.newSAXParser().getXMLReader();
+            boolean noMeaningFeature = xmlReader.getFeature("no-meaning-feature");
+        } catch(SAXNotRecognizedException ex) {
+            throw ex;
+        } catch (SAXException | ParserConfigurationException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * No exception expected when set entity resolver as simple entity resolver.
+     */
+    @Test
+    public void entity01() {
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            spf.setNamespaceAware(true);
+            XMLReader xmlReader =  spf.newSAXParser().getXMLReader();
+            XMLFilterImpl xmlFilter = new XMLFilterImpl();
+            xmlReader.setEntityResolver(xmlFilter);
+            assertNotNull(xmlReader.getEntityResolver());
+        } catch (SAXException | ParserConfigurationException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * No NPE expected when set entity resolver as null.
+     */
+    @Test
+    public void entity02() {
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            spf.setNamespaceAware(true);
+            XMLReader xmlReader =  spf.newSAXParser().getXMLReader();
+            xmlReader.setEntityResolver(null);
+        } catch (SAXException | ParserConfigurationException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * No exception expected when set DTD handler as simple DTD handler.
+     */
+    @Test
+    public void dtdhandler01() {
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            spf.setNamespaceAware(true);
+            XMLReader xmlReader =  spf.newSAXParser().getXMLReader();
+            XMLFilterImpl xmlFilter = new XMLFilterImpl();
+            xmlReader.setDTDHandler(xmlFilter);
+            assertNotNull(xmlReader.getDTDHandler());
+        } catch (SAXException | ParserConfigurationException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * No NPE expected when set DTD handler as null.
+     */
+    @Test
+    public void dtdhandler02() {
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            spf.setNamespaceAware(true);
+            XMLReader xmlReader =  spf.newSAXParser().getXMLReader();
+            xmlReader.setDTDHandler(null);
+        } catch (SAXException | ParserConfigurationException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * No exception expected when set content handler as simple content handler.
+     */
+    @Test
+    public void contenthandler01() {
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            spf.setNamespaceAware(true);
+            XMLReader xmlReader =  spf.newSAXParser().getXMLReader();
+            XMLFilterImpl xmlFilter = new XMLFilterImpl();
+            xmlReader.setContentHandler(xmlFilter);
+            assertNotNull(xmlReader.getContentHandler());
+        } catch (SAXException | ParserConfigurationException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * No NPE expected when set content handler as null.
+     */
+    @Test
+    public void contenthandler02() {
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            spf.setNamespaceAware(true);
+            XMLReader xmlReader =  spf.newSAXParser().getXMLReader();
+            xmlReader.setContentHandler(null);
+        } catch (SAXException | ParserConfigurationException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * No exception expected when set content handler as simple error handler.
+     */
+    @Test
+    public void errorhandler01() {
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            spf.setNamespaceAware(true);
+            XMLReader xmlReader =  spf.newSAXParser().getXMLReader();
+            xmlReader.setErrorHandler(new XMLFilterImpl());
+            assertNotNull(xmlReader.getErrorHandler());
+        } catch (SAXException | ParserConfigurationException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * No NPE expected when set error handler as null.
+     */
+    @Test
+    public void errorhandler02() {
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            spf.setNamespaceAware(true);
+            XMLReader xmlReader =  spf.newSAXParser().getXMLReader();
+            xmlReader.setErrorHandler(null);
+        } catch (SAXException | ParserConfigurationException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * Parse a null input source throw NPE.
+     */
+    @Test(expectedExceptions = NullPointerException.class)
+    public void parse01() {
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            spf.setNamespaceAware(true);
+            XMLReader xmlReader =  spf.newSAXParser().getXMLReader();
+            xmlReader.parse((InputSource)null);
+        } catch (SAXException | ParserConfigurationException | IOException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * Unit test for parse a error-formatted file. SAXException is expected.
+     * @throws org.xml.sax.SAXException parsing failed.
+     */
+    @Test(expectedExceptions = SAXException.class)
+    public void parse02() throws SAXException {
+        try (FileInputStream fis = new FileInputStream(XML_DIR + "invalid.xml")){
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            spf.setNamespaceAware(true);
+            XMLReader xmlReader =  spf.newSAXParser().getXMLReader();
+            InputSource is = new InputSource(fis);
+            xmlReader.parse(is);
+        } catch (ParserConfigurationException | IOException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * Unit test for parse a well-formatted file. No exception is expected.
+     */
+    @Test
+    public void parse03(){
+        try (FileInputStream fis = new FileInputStream(XML_DIR + "correct2.xml")) {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            spf.setNamespaceAware(true);
+            XMLReader xmlReader =  spf.newSAXParser().getXMLReader();
+            InputSource is = new InputSource(fis);
+            xmlReader.parse(is);
+        } catch (IOException | SAXException | ParserConfigurationException ex) {
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * Modified by IBM
+     * Xerces does not support this feature and it is not mandatory
+     * @throws org.xml.sax.SAXNotSupportedException
+     */
+    @Test(expectedExceptions = SAXNotSupportedException.class)
+    public void xrProperty01() throws SAXNotSupportedException  {
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            XMLReader xmlReader =  spf.newSAXParser().getXMLReader();
+            xmlReader.getProperty(XML_STRING);
+        } catch(SAXNotSupportedException ex) {
+            throw ex;
+        } catch (SAXException | ParserConfigurationException ex){
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * SAXNotSupportedException thrown if property name is known but no value
+     * assigned to this property.
+     * @throws org.xml.sax.SAXNotSupportedException when XMLReader recognizes
+     * the property name but cannot determine its value at this time.
+     */
+    @Test(expectedExceptions = SAXNotSupportedException.class)
+    public void xrProperty02() throws SAXNotSupportedException {
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            XMLReader xmlReader =  spf.newSAXParser().getXMLReader();
+            assertNull(xmlReader.getProperty(DOM_NODE));
+        } catch (SAXNotSupportedException ex) {
+            throw ex;
+        } catch (SAXException | ParserConfigurationException ex){
+            failUnexpected(ex);
+        }
+    }
+
+
+    /**
+     * XMLReader.getProperty returns null if LEXICAL_HANDLER wasn't set.
+     */
+    @Test
+    public void xrProperty03() {
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            XMLReader xmlReader =  spf.newSAXParser().getXMLReader();
+            assertNull(xmlReader.getProperty(LEXICAL_HANDLER));
+        } catch (SAXException | ParserConfigurationException ex){
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * XMLReader.getProperty returns null if DECL_HANDLER wasn't set.
+     */
+    @Test
+    public void xrProperty04() {
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            XMLReader xmlReader =  spf.newSAXParser().getXMLReader();
+            assertNull(xmlReader.getProperty(DECL_HANDLER));
+        } catch (SAXException | ParserConfigurationException ex){
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * XMLReader.setProperty/getProperty for LEXICAL_HANDLER unit test.
+     */
+    @Test
+    public void xrProperty05() {
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            XMLReader xmlReader =  spf.newSAXParser().getXMLReader();
+            MyLexicalHandler myLexicalHandler = new MyLexicalHandler();
+            xmlReader.setProperty(LEXICAL_HANDLER, myLexicalHandler);
+            assertNotNull(xmlReader.getProperty(LEXICAL_HANDLER));
+        } catch (SAXException | ParserConfigurationException ex){
+            failUnexpected(ex);
+        }
+    }
+
+    /**
+     * XMLReader.setProperty/getProperty for DECL_HANDLER unit test.
+     */
+    @Test
+    public void xrProperty06() {
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            XMLReader xmlReader =  spf.newSAXParser().getXMLReader();
+            MyDeclHandler myDeclHandler = new MyDeclHandler();
+            xmlReader.setProperty(DECL_HANDLER, myDeclHandler);
+            assertNotNull(xmlReader.getProperty(DECL_HANDLER));
+        } catch (ParserConfigurationException | SAXException ex){
+            failUnexpected(ex);
+        }
+    }
+}
+
+/**
+ * Simple LexicalHandler that skips every lexical event.
+ */
+class MyLexicalHandler implements LexicalHandler {
+    /**
+     * Report an XML comment anywhere in the document.
+     *
+     * @param ch An array holding the characters in the comment.
+     * @param start The starting position in the array.
+     * @param length The number of characters to use from the array.
+     */
+    @Override
+    public void comment(char[] ch, int start, int length) {
+    }
+
+    /**
+     * Report the end of a CDATA section.
+     */
+    @Override
+    public void endCDATA() {
+    }
+
+    /**
+     * Report the end of DTD declarations.
+     */
+    @Override
+    public void endDTD() {
+    }
+
+    /**
+     * Report the end of an entity.
+     *
+     * @param name The name of the entity that is ending.
+     */
+    @Override
+    public void endEntity(String name) {
+    }
+
+    /**
+     * Report the start of a CDATA section.
+     */
+    @Override
+    public void startCDATA() {
+    }
+
+    /**
+     * Report the start of DTD declarations, if any.
+     *
+     * @param name The document type name.
+     * @param publicId The declared public identifier for the external DTD subset.
+     * @param systemId The declared system identifier for the external DTD subset.
+     */
+    @Override
+    public void startDTD(String name, String publicId, String systemId) {
+    }
+
+    /**
+     * Report the beginning of some internal and external XML entities.
+     *
+     * @param name The name of the entity.
+     */
+    @Override
+    public void startEntity(String name) {
+    }
+}
+
+/**
+ * Simple DeclHandler that skips every DTD declaration event.
+ */
+class MyDeclHandler implements DeclHandler {
+    /**
+     * Report an attribute type declaration.
+     * @param eName The name of the associated element.
+     * @param aName The name of the attribute.
+     * @param type A string representing the attribute type.
+     * @param mode A string representing the attribute defaulting mode
+     *        ("#IMPLIED", "#REQUIRED", or "#FIXED") or null if
+     *        none of these applies.
+     * @param value A string representing the attribute's default value,
+     *        or null if there is none.
+     */
+    @Override
+    public void attributeDecl(String eName, String aName, String type,
+            String valueDefault, String value) {
+    }
+
+    /**
+     * Report an element type declaration.
+     * @param name The element type name.
+     * @param model The content model as a normalized string.
+     */
+    @Override
+    public void elementDecl(String name, String model) {
+    }
+
+    /**
+     * Report a parsed external entity declaration.
+     * @param name The name of the entity.  If it is a parameter
+     *        entity, the name will begin with '%'.
+     * @param publicId The entity's public identifier, or null if none
+     *        was given.
+     * @param systemId The entity's system identifier.
+     */
+    @Override
+    public void externalEntityDecl(String name, String publicId,
+            String systemId) {
+    }
+
+    /**
+     * Report an internal entity declaration.
+     * @param name The name of the entity.  If it is a parameter
+     *        entity, the name will begin with '%'.
+     * @param value The replacement text of the entity.
+     */
+    @Override
+    public void internalEntityDecl(String name, String value) {
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/correct.xml	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,23 @@
+<?xml version="1.0" standalone="yes"?>
+<document>
+	Publishers of the Music of New York Women Composers
+
+	<title>The Publishers </title>
+	
+	<publisher>
+	Alfred Publishing 
+	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'/> 
+	<xmlns:pages />
+
+	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/xml/sax/xmlfiles/correct2.xml	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,22 @@
+<?xml version="1.0" standalone="yes"?>
+<document>
+	Publishers of the Music of New York Women Composers
+
+	<title>The Publishers </title>
+	
+	<publisher>
+	Alfred Publishing 
+	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/xml/sax/xmlfiles/family.xml	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,14 @@
+<?xml version="1.0" standalone="yes" ?>
+<!DOCTYPE document [
+    <!ELEMENT document (person*)>
+    <!ELEMENT person (#PCDATA)>
+    <!ATTLIST person pnumber ID #REQUIRED>
+    <!ATTLIST person father IDREF #IMPLIED>
+    <!ATTLIST person mother IDREF #IMPLIED>
+]>
+<document>
+    <person pnumber="a1">Susan</person>
+    <person pnumber="a2">Jack</person>
+    <person pnumber="a3" mother="a1" father="a2">Chelsea</person>
+    <person pnumber="a4" mother="a1" father="a2">David</person>
+</document>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/firstdtd.dtd	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,13 @@
+<!ELEMENT document ANY>
+<!ELEMENT title (#PCDATA)>
+<!ELEMENT publisher (#PCDATA)>
+<!ELEMENT book (#PCDATA)>
+<!ELEMENT bookurn (#PCDATA)>
+<!ELEMENT xmlns:pages (#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 mkm "I am Krishna">
+<!ENTITY km "I am KrishnaMohan">
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/invalid.xml	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,24 @@
+<?xml version="1.0" standalone="yes"?>
+<document>
+	Publishers of the Music of New York Women Composers
+
+	<title>The Publishers </title>
+	
+	<publisher>
+	Alfred Publishing 
+	&mkm; 
+	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'/> 
+	<xmlns:pages />
+
+	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/xml/sax/xmlfiles/namespace1.xml	Thu Oct 23 13:45:30 2014 -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 style="font-family: sans-serif;">Digital Typography</b:title>
+    <b:author>Donald Knuth</b:author>
+    <?netscape http://www.hotmail.com?>
+  </body>
+
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/ns4.xml	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,8 @@
+<section><title>Book-Signing Event</title>
+  <signing>
+    <author title="Mr" name="Vikram Seth" />
+    <book title="A Suitable Boy" price="$22.95" /></signing>
+  <signing>
+    <author title="Dr" name="Oliver Sacks" />
+    <book title="The Island of the Color-Blind" price="$12.95" /></signing>
+  </section>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/out/AttributesGF.out	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,135 @@
+uri <> localName <document> qName <document>
+length: 0
+
+uri <> localName <person> qName <person>
+length: 1
+For index = 0
+getLocalName <pnumber>
+getQName <pnumber>
+getType <ID>
+getURI <>
+getValue <a1>
+
+Using localName, qname and uri pertaining to index = 0
+getIndex(qName) <0>
+getIndex(uri, localName) <0>
+getType(qName) <ID>
+getType(uri, localName) <ID>
+getValue(qName) <a1>
+getValue(uri, localName) <a1>
+
+
+uri <> localName <person> qName <person>
+length: 1
+For index = 0
+getLocalName <pnumber>
+getQName <pnumber>
+getType <ID>
+getURI <>
+getValue <a2>
+
+Using localName, qname and uri pertaining to index = 0
+getIndex(qName) <0>
+getIndex(uri, localName) <0>
+getType(qName) <ID>
+getType(uri, localName) <ID>
+getValue(qName) <a2>
+getValue(uri, localName) <a2>
+
+
+uri <> localName <person> qName <person>
+length: 3
+For index = 0
+getLocalName <pnumber>
+getQName <pnumber>
+getType <ID>
+getURI <>
+getValue <a3>
+
+Using localName, qname and uri pertaining to index = 0
+getIndex(qName) <0>
+getIndex(uri, localName) <0>
+getType(qName) <ID>
+getType(uri, localName) <ID>
+getValue(qName) <a3>
+getValue(uri, localName) <a3>
+
+For index = 1
+getLocalName <mother>
+getQName <mother>
+getType <IDREF>
+getURI <>
+getValue <a1>
+
+Using localName, qname and uri pertaining to index = 1
+getIndex(qName) <1>
+getIndex(uri, localName) <1>
+getType(qName) <IDREF>
+getType(uri, localName) <IDREF>
+getValue(qName) <a1>
+getValue(uri, localName) <a1>
+
+For index = 2
+getLocalName <father>
+getQName <father>
+getType <IDREF>
+getURI <>
+getValue <a2>
+
+Using localName, qname and uri pertaining to index = 2
+getIndex(qName) <2>
+getIndex(uri, localName) <2>
+getType(qName) <IDREF>
+getType(uri, localName) <IDREF>
+getValue(qName) <a2>
+getValue(uri, localName) <a2>
+
+
+uri <> localName <person> qName <person>
+length: 3
+For index = 0
+getLocalName <pnumber>
+getQName <pnumber>
+getType <ID>
+getURI <>
+getValue <a4>
+
+Using localName, qname and uri pertaining to index = 0
+getIndex(qName) <0>
+getIndex(uri, localName) <0>
+getType(qName) <ID>
+getType(uri, localName) <ID>
+getValue(qName) <a4>
+getValue(uri, localName) <a4>
+
+For index = 1
+getLocalName <mother>
+getQName <mother>
+getType <IDREF>
+getURI <>
+getValue <a1>
+
+Using localName, qname and uri pertaining to index = 1
+getIndex(qName) <1>
+getIndex(uri, localName) <1>
+getType(qName) <IDREF>
+getType(uri, localName) <IDREF>
+getValue(qName) <a1>
+getValue(uri, localName) <a1>
+
+For index = 2
+getLocalName <father>
+getQName <father>
+getType <IDREF>
+getURI <>
+getValue <a2>
+
+Using localName, qname and uri pertaining to index = 2
+getIndex(qName) <2>
+getIndex(uri, localName) <2>
+getType(qName) <IDREF>
+getType(uri, localName) <IDREF>
+getValue(qName) <a2>
+getValue(uri, localName) <a2>
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/out/AttributesNSGF.out	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,36 @@
+uri <http://www.w3.org/TR/REC-html40> localName <html> qName <html>
+length: 0
+
+uri <http://www.w3.org/TR/REC-html40> localName <head> qName <head>
+length: 0
+
+uri <http://www.w3.org/TR/REC-html40> localName <title> qName <title>
+length: 0
+
+uri <http://www.w3.org/TR/REC-html40> localName <body> qName <body>
+length: 0
+
+uri <http://www.w3.org/TR/REC-html40> localName <p> qName <p>
+length: 0
+
+uri <urn:BooksAreUs.org:BookInfo> localName <title> qName <b:title>
+length: 1
+For index = 0
+getLocalName <style>
+getQName <style>
+getType <CDATA>
+getURI <>
+getValue <font-family: sans-serif;>
+
+Using localName, qname and uri pertaining to index = 0
+getIndex(qName) <0>
+getIndex(uri, localName) <0>
+getType(qName) <CDATA>
+getType(uri, localName) <CDATA>
+getValue(qName) <font-family: sans-serif;>
+getValue(uri, localName) <font-family: sans-serif;>
+
+
+uri <urn:BooksAreUs.org:BookInfo> localName <author> qName <b:author>
+length: 0
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/out/ContentGF.out	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,80 @@
+setDocumentLocator...
+startDocument...
+startPrefixMapping...
+prefix:  uri: http://www.w3.org/TR/REC-html40
+startPrefixMapping...
+prefix: b uri: urn:BooksAreUs.org:BookInfo
+startElement...
+namespaceURI: http://www.w3.org/TR/REC-html40 localName: html qName: html Number of Attributes: 0 Line# 3
+characters...
+
+  
+startElement...
+namespaceURI: http://www.w3.org/TR/REC-html40 localName: head qName: head Number of Attributes: 0 Line# 4
+characters...
+
+    
+startElement...
+namespaceURI: http://www.w3.org/TR/REC-html40 localName: title qName: title Number of Attributes: 0 Line# 5
+characters...
+Typography
+endElement...
+namespaceURI: http://www.w3.org/TR/REC-html40 localName: title qName: title
+characters...
+
+  
+endElement...
+namespaceURI: http://www.w3.org/TR/REC-html40 localName: head qName: head
+characters...
+
+
+  
+startElement...
+namespaceURI: http://www.w3.org/TR/REC-html40 localName: body qName: body Number of Attributes: 0 Line# 8
+characters...
+
+    
+startElement...
+namespaceURI: http://www.w3.org/TR/REC-html40 localName: p qName: p Number of Attributes: 0 Line# 9
+characters...
+ Welcome to the world of typography! Here is a book that you may find useful.
+endElement...
+namespaceURI: http://www.w3.org/TR/REC-html40 localName: p qName: p
+characters...
+
+    
+startElement...
+namespaceURI: urn:BooksAreUs.org:BookInfo localName: title qName: b:title Number of Attributes: 1 Line# 10
+characters...
+Digital Typography
+endElement...
+namespaceURI: urn:BooksAreUs.org:BookInfo localName: title qName: b:title
+characters...
+
+    
+startElement...
+namespaceURI: urn:BooksAreUs.org:BookInfo localName: author qName: b:author Number of Attributes: 0 Line# 11
+characters...
+Donald Knuth
+endElement...
+namespaceURI: urn:BooksAreUs.org:BookInfo localName: author qName: b:author
+characters...
+
+    
+processingInstruction...target:netscape data: http://www.hotmail.com
+characters...
+
+  
+endElement...
+namespaceURI: http://www.w3.org/TR/REC-html40 localName: body qName: body
+characters...
+
+
+
+endElement...
+namespaceURI: http://www.w3.org/TR/REC-html40 localName: html qName: html
+endPrefixMapping...
+prefix: 
+endPrefixMapping...
+prefix: b
+endDocument...
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/out/DTDHandlerGF.out	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,2 @@
+In unparsedEntityDecl... name:logo publicId:null systemId:http://sc11152338.us.oracle.com:8080/xmlsqe/jaxp/web/testfiles/JAXPREP/images/tool.gif notationName:gif
+In notationDecl... name:gif publicId:null systemId:http://sardinia/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/out/DefaultHandlerGF.out	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,78 @@
+setDocumentLocator...
+startDocument...
+startPrefixMapping...
+prefix:  uri: http://www.w3.org/TR/REC-html40
+startPrefixMapping...
+prefix: b uri: urn:BooksAreUs.org:BookInfo
+startElement...
+namespaceURI: http://www.w3.org/TR/REC-html40 localName: html qName: html Number of Attributes: 0
+characters...
+
+  
+startElement...
+namespaceURI: http://www.w3.org/TR/REC-html40 localName: head qName: head Number of Attributes: 0
+characters...
+
+    
+startElement...
+namespaceURI: http://www.w3.org/TR/REC-html40 localName: title qName: title Number of Attributes: 0
+characters...
+Typography
+endElement...
+namespaceURI: http://www.w3.org/TR/REC-html40 localName: title qName: title
+characters...
+
+  
+endElement...
+namespaceURI: http://www.w3.org/TR/REC-html40 localName: head qName: head
+characters...
+
+
+  
+startElement...
+namespaceURI: http://www.w3.org/TR/REC-html40 localName: body qName: body Number of Attributes: 0
+characters...
+
+    
+startElement...
+namespaceURI: http://www.w3.org/TR/REC-html40 localName: p qName: p Number of Attributes: 0
+characters...
+ Welcome to the world of typography! Here is a book that you may find useful.
+endElement...
+namespaceURI: http://www.w3.org/TR/REC-html40 localName: p qName: p
+characters...
+
+    
+startElement...
+namespaceURI: urn:BooksAreUs.org:BookInfo localName: title qName: b:title Number of Attributes: 1
+characters...
+Digital Typography
+endElement...
+namespaceURI: urn:BooksAreUs.org:BookInfo localName: title qName: b:title
+characters...
+
+    
+startElement...
+namespaceURI: urn:BooksAreUs.org:BookInfo localName: author qName: b:author Number of Attributes: 0
+characters...
+Donald Knuth
+endElement...
+namespaceURI: urn:BooksAreUs.org:BookInfo localName: author qName: b:author
+characters...
+
+    
+processingInstruction...target:netscape data: http://www.hotmail.com
+characters...
+
+  
+endElement...
+namespaceURI: http://www.w3.org/TR/REC-html40 localName: body qName: body
+characters...
+
+
+
+endElement...
+namespaceURI: http://www.w3.org/TR/REC-html40 localName: html qName: html
+endPrefixmapping ..
+endPrefixmapping ..b
+endDocument...
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/out/EHFatalGF.out	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,2 @@
+In fatalError..
+SAXParseException: The entity "mkm" was referenced, but not declared.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/out/EntityResolverGF.out	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,2 @@
+In resolveEntity.. -//mkrishna mohan//DTD//music pub//EN/ http://sc11152338.us.oracle.com:8080/xmlsqe/jaxp/web/testfiles/JAXPREP/publishers.dtd
+In resolveEntity.. null http://sc11152338.us.oracle.com:8080/xmlsqe/jaxp/web/testfiles/JAXPREP/familytree.dtd
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/out/NSTableFTGF.out	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,130 @@
+setDocumentLocator...
+startDocument...
+startPrefixMapping...
+prefix: <xml> uri: <http://www.w3.org/XML/1998/namespace>
+startPrefixMapping...
+prefix: <xmlns> uri: <http://www.w3.org/2000/xmlns/>
+startElement...
+namespaceURI: <> localName: <> qName: <html> Number of Attributes: <2> Line# <3>
+characters...length is:3
+<
+  >
+startPrefixMapping...
+prefix: <xml> uri: <http://www.w3.org/XML/1998/namespace>
+startPrefixMapping...
+prefix: <xmlns> uri: <http://www.w3.org/2000/xmlns/>
+startElement...
+namespaceURI: <> localName: <> qName: <head> Number of Attributes: <0> Line# <4>
+characters...length is:5
+<
+    >
+startPrefixMapping...
+prefix: <xml> uri: <http://www.w3.org/XML/1998/namespace>
+startPrefixMapping...
+prefix: <xmlns> uri: <http://www.w3.org/2000/xmlns/>
+startElement...
+namespaceURI: <> localName: <> qName: <title> Number of Attributes: <0> Line# <5>
+characters...length is:10
+<Typography>
+endElement...
+namespaceURI: <> localName: <> qName: <title>
+endPrefixMapping...
+prefix: <xml>
+endPrefixMapping...
+prefix: <xmlns>
+characters...length is:3
+<
+  >
+endElement...
+namespaceURI: <> localName: <> qName: <head>
+endPrefixMapping...
+prefix: <xml>
+endPrefixMapping...
+prefix: <xmlns>
+characters...length is:4
+<
+
+  >
+startPrefixMapping...
+prefix: <xml> uri: <http://www.w3.org/XML/1998/namespace>
+startPrefixMapping...
+prefix: <xmlns> uri: <http://www.w3.org/2000/xmlns/>
+startElement...
+namespaceURI: <> localName: <> qName: <body> Number of Attributes: <0> Line# <8>
+characters...length is:5
+<
+    >
+startPrefixMapping...
+prefix: <xml> uri: <http://www.w3.org/XML/1998/namespace>
+startPrefixMapping...
+prefix: <xmlns> uri: <http://www.w3.org/2000/xmlns/>
+startElement...
+namespaceURI: <> localName: <> qName: <p> Number of Attributes: <0> Line# <9>
+characters...length is:77
+< Welcome to the world of typography! Here is a book that you may find useful.>
+endElement...
+namespaceURI: <> localName: <> qName: <p>
+endPrefixMapping...
+prefix: <xml>
+endPrefixMapping...
+prefix: <xmlns>
+characters...length is:5
+<
+    >
+startPrefixMapping...
+prefix: <xml> uri: <http://www.w3.org/XML/1998/namespace>
+startPrefixMapping...
+prefix: <xmlns> uri: <http://www.w3.org/2000/xmlns/>
+startElement...
+namespaceURI: <> localName: <> qName: <b:title> Number of Attributes: <1> Line# <10>
+characters...length is:18
+<Digital Typography>
+endElement...
+namespaceURI: <> localName: <> qName: <b:title>
+endPrefixMapping...
+prefix: <xml>
+endPrefixMapping...
+prefix: <xmlns>
+characters...length is:1
+< >
+characters...length is:5
+<
+    >
+startPrefixMapping...
+prefix: <xml> uri: <http://www.w3.org/XML/1998/namespace>
+startPrefixMapping...
+prefix: <xmlns> uri: <http://www.w3.org/2000/xmlns/>
+startElement...
+namespaceURI: <> localName: <> qName: <b:author> Number of Attributes: <0> Line# <11>
+characters...length is:12
+<Donald Knuth>
+endElement...
+namespaceURI: <> localName: <> qName: <b:author>
+endPrefixMapping...
+prefix: <xml>
+endPrefixMapping...
+prefix: <xmlns>
+characters...length is:5
+<
+    >
+processingInstruction...target:<netscape> data: <http://www.hotmail.com>
+characters...length is:3
+<
+  >
+endElement...
+namespaceURI: <> localName: <> qName: <body>
+endPrefixMapping...
+prefix: <xml>
+endPrefixMapping...
+prefix: <xmlns>
+characters...length is:2
+<
+
+>
+endElement...
+namespaceURI: <> localName: <> qName: <html>
+endPrefixMapping...
+prefix: <xml>
+endPrefixMapping...
+prefix: <xmlns>
+endDocument...
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/out/NSTableTFGF.out	Thu Oct 23 13:45:30 2014 -0700
@@ -0,0 +1,80 @@
+setDocumentLocator...
+startDocument...
+startPrefixMapping...
+prefix: <> uri: <http://www.w3.org/TR/REC-html40>
+startPrefixMapping...
+prefix: <b> uri: <urn:BooksAreUs.org:BookInfo>
+startElement...
+namespaceURI: <http://www.w3.org/TR/REC-html40> localName: <html> qName: <html> Number of Attributes: <0> Line# <3>
+characters...length is:3
+<
+  >
+startElement...
+namespaceURI: <http://www.w3.org/TR/REC-html40> localName: <head> qName: <head> Number of Attributes: <0> Line# <4>
+characters...length is:5
+<
+    >
+startElement...
+namespaceURI: <http://www.w3.org/TR/REC-html40> localName: <title> qName: <title> Number of Attributes: <0> Line# <5>
+characters...length is:10
+<Typography>
+endElement...
+namespaceURI: <http://www.w3.org/TR/REC-html40> localName: <title> qName: <title>
+characters...length is:3
+<
+  >
+endElement...
+namespaceURI: <http://www.w3.org/TR/REC-html40> localName: <head> qName: <head>
+characters...length is:4
+<
+
+  >
+startElement...
+namespaceURI: <http://www.w3.org/TR/REC-html40> localName: <body> qName: <body> Number of Attributes: <0> Line# <8>
+characters...length is:5
+<
+    >
+startElement...
+namespaceURI: <http://www.w3.org/TR/REC-html40> localName: <p> qName: <p> Number of Attributes: <0> Line# <9>
+characters...length is:77
+< Welcome to the world of typography! Here is a book that you may find useful.>
+endElement...
+namespaceURI: <http://www.w3.org/TR/REC-html40> localName: <p> qName: <p>
+characters...length is:5
+<
+    >
+startElement...
+namespaceURI: <urn:BooksAreUs.org:BookInfo> localName: <title> qName: <b:title> Number of Attributes: <1> Line# <10>
+characters...length is:18
+<Digital Typography>
+endElement...
+namespaceURI: <urn:BooksAreUs.org:BookInfo> localName: <title> qName: <b:title>
+characters...length is:5
+<
+    >
+startElement...
+namespaceURI: <urn:BooksAreUs.org:BookInfo> localName: <author> qName: <b:author> Number of Attributes: <0> Line# <11>
+characters...length is:12
+<Donald Knuth>
+endElement...
+namespaceURI: <urn:BooksAreUs.org:BookInfo> localName: <author> qName: <b:author>
+characters...length is:5
+<