changeset 653:c4cb73fc93db

8051540: Convert JAXP functional tests to jtreg(TestNG): SAX and Transform Reviewed-by: joehw Contributed-by: tristan.yan@oracle.com
author joehw
date Thu, 16 Oct 2014 15:51:12 -0700
parents 61b4c9acaa58
children 480aa80c1cb7
files test/TEST.ROOT test/javax/xml/jaxp/functional/TEST.properties test/javax/xml/jaxp/functional/javax/xml/transform/ptests/DOMResultTest01.java test/javax/xml/jaxp/functional/javax/xml/transform/ptests/ErrorListenerTest.java test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXSourceTest01.java test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest001.java test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest002.java test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest003.java test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest004.java test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest005.java test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest006.java test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest008.java test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest009.java test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest010.java test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest011.java test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest012.java test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest013.java test/javax/xml/jaxp/functional/javax/xml/transform/ptests/StreamResultTest01.java test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TfClearParamTest.java test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerExcpTest.java test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerFactoryTest.java test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerTest.java test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerTest02.java test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerTest03.java test/javax/xml/jaxp/functional/javax/xml/transform/ptests/URIResolverTest.java test/javax/xml/jaxp/functional/javax/xml/transform/ptests/othervm/TFCErrorTest.java test/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/TransformerFactoryTest.xml test/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/TransformerFactoryTest.xsl test/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/cities.xml test/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/cities.xsl test/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/citiesimport.xsl test/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/citiesinclude.xsl test/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/doctest.xsl test/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/invalid.xsl test/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/lexical.xml test/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/myFake.xml test/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/out/doctypeGF.out test/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/out/domresult01GF.out test/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/out/lexicalGF.out test/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/out/saxtf001GF.out test/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/out/saxtf002GF.out test/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/out/saxtf003GF.out test/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/out/saxtf005GF.out test/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/out/saxtf006GF.out test/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/out/saxtf008GF.out test/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/out/saxtf009GF.out test/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/out/saxtf010GF.out test/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/out/saxtf011GF.out test/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/out/saxtf012GF.out test/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/out/saxtf013GF.out test/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/out/tfactory01GF.out test/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/out/tfactory02GF.out test/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/out/transformer02GF.out test/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/out/transformer03GF.out test/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/publish2.xml test/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/temp/cities.xsl test/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/temp/colors.xml test/javax/xml/jaxp/functional/org/xml/sax/ptests/AttrImplTest.java test/javax/xml/jaxp/functional/org/xml/sax/ptests/AttributesNSTest.java test/javax/xml/jaxp/functional/org/xml/sax/ptests/AttributesTest.java test/javax/xml/jaxp/functional/org/xml/sax/ptests/ContentHandlerTest.java test/javax/xml/jaxp/functional/org/xml/sax/ptests/DefaultHandlerTest.java test/javax/xml/jaxp/functional/org/xml/sax/ptests/EHFatalTest.java test/javax/xml/jaxp/functional/org/xml/sax/ptests/MyAttrCHandler.java test/javax/xml/jaxp/functional/org/xml/sax/ptests/MyNSContentHandler.java test/javax/xml/jaxp/functional/org/xml/sax/ptests/NSSupportTest.java test/javax/xml/jaxp/functional/org/xml/sax/ptests/NSTableTest01.java test/javax/xml/jaxp/functional/org/xml/sax/ptests/ParserAdapterTest.java test/javax/xml/jaxp/functional/org/xml/sax/ptests/ResolverTest.java test/javax/xml/jaxp/functional/org/xml/sax/ptests/SAXParserNSTableTest.java test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLFilterCBTest.java test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLFilterTest.java test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderAdapterTest.java test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderFactoryTest.java test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderNSTableTest.java test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderTest.java test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/correct.xml test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/correct2.xml test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/family.xml test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/firstdtd.dtd test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/invalid.xml test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/namespace1.xml test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/ns4.xml test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/out/AttributesGF.out test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/out/AttributesNSGF.out test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/out/ContentGF.out test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/out/DTDHandlerGF.out test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/out/DefaultHandlerGF.out test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/out/EHFatalGF.out test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/out/EntityResolverGF.out test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/out/NSTableFTGF.out test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/out/NSTableTFGF.out test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/out/NSTableTTGF.out test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/out/XMLFilterGF.out test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/parsertest.xml test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/publish.xml test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/valid.xml test/javax/xml/jaxp/libs/javax/xml/transform/ptests/MyContentHandler.java test/javax/xml/jaxp/libs/javax/xml/transform/ptests/TransformerTestConst.java test/javax/xml/jaxp/libs/jaxp/library/JAXPTestUtilities.java test/javax/xml/jaxp/libs/org/xml/sax/ptests/SAXTestConst.java
diffstat 101 files changed, 8488 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/TEST.ROOT	Thu Oct 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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/org/xml/sax/ptests/AttrImplTest.java	Thu Oct 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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 16 15:51:12 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
+<
+    >
+processingInstruction...target:<netscape> data: <http://www.hotmail.com>
+characters...length is:3
+<
+  >
+endElement...
+namespaceURI: <http://www.w3.org/TR/REC-html40> localName: <body> qName: <body>
+characters...length is:2
+<
+
+>
+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/NSTableTTGF.out	Thu Oct 16 15:51:12 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: <2> 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
+<
+    >
+processingInstruction...target:<netscape> data: <http://www.hotmail.com>
+characters...length is:3
+<
+  >
+endElement...
+namespaceURI: <http://www.w3.org/TR/REC-html40> localName: <body> qName: <body>
+characters...length is:2
+<
+
+>
+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/XMLFilterGF.out	Thu Oct 16 15:51:12 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/parsertest.xml	Thu Oct 16 15:51:12 2014 -0700
@@ -0,0 +1,25 @@
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE document SYSTEM "firstdtd.dtd">
+<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/publish.xml	Thu Oct 16 15:51:12 2014 -0700
@@ -0,0 +1,17 @@
+<?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>170 West 74th St. NY NY 10023</address>
+		<voice>212-362-8900</voice>
+		<fax>212-874-8605</fax>
+		<dtdname>&familytree;</dtdname>
+	</publisher>
+</document>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/valid.xml	Thu Oct 16 15:51:12 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/libs/javax/xml/transform/ptests/MyContentHandler.java	Thu Oct 16 15:51:12 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 org.xml.sax.ContentHandler;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.Locator;
+import java.io.BufferedWriter;
+import java.io.FileWriter;
+import java.io.IOException;
+
+/**
+ * A customized ContentHandler. It writes whole XML file with extra tag on every
+ * XML elements.
+ */
+public class MyContentHandler implements ContentHandler {
+    /**
+     * FileWrite to write content to.
+     */
+    private final BufferedWriter bWriter;
+
+    /**
+     * Create FileWiter for the processing.
+     * @param fileName Output file name.
+     * @throws org.xml.sax.SAXException
+     */
+    public MyContentHandler(String fileName) throws SAXException {
+        try {
+            bWriter = new BufferedWriter(new FileWriter(fileName));
+        } catch (IOException ex) {
+            throw new SAXException("Open file error", ex);
+        }
+    }
+
+    /**
+     * Do nothing when set document locator.
+     */
+    @Override
+    public void setDocumentLocator (Locator locator) {
+    }
+
+    /**
+     * Open the output file when start to process the document. Write a
+     * startDocument tag to output File if opening file successfully.
+     * @throws SAXException if file writing failed.
+     */
+    @Override
+    public void startDocument () throws SAXException {
+        //Bug # 4448884 filed. setDocumentLocator method should be called
+        //first. The bug won't be fixed. So startDocument is the next method
+        println("startDocument");
+    }
+
+    /**
+     * Write a startDocument tag to output File after processing whole document.
+     * Follow with closing the output file.
+     * @throws SAXException if file writing failed.
+     */
+    @Override
+    public void endDocument() throws SAXException {
+        println("endDocument");
+
+        try {
+            bWriter.flush();
+            bWriter.close();
+        } catch (IOException ex) {
+            throw new SAXException("Close file error", ex);
+        }
+    }
+
+    /**
+     * Write a startPrefixMapping appending with prefix and URI to output File
+     * before entering the scope of a prefix-URI mapping.
+     * @param prefix the Namespace prefix being declared.
+     * @param uri the Namespace URI the prefix is mapped to.
+     * @throws SAXException if file writing failed.
+     */
+    @Override
+    public void startPrefixMapping (String prefix, String uri)
+                throws SAXException {
+        println("startPrefixMapping: " + prefix + ", " + uri);
+    }
+
+    /**
+     * Write a endPrefixMapping appending with prefix to output File after a
+     * prefix-URI mapping.
+     * @param prefix the Namespace prefix being declared.
+     * @throws SAXException if file writing failed.
+     */
+    @Override
+    public void endPrefixMapping (String prefix) throws SAXException {
+        println("endPrefixMapping: " + prefix);
+    }
+
+    /**
+     * Write a startElement appending with namespaceURI,localName,qName and
+     * iteration on attributes to output File when start processing element.
+     * @param namespaceURI the Namespace URI.
+     * @param localName the local name (without prefix).
+     * @param qName the qualified name (with prefix).
+     * @param atts the attributes attached to the element.
+     * @throws SAXException if file writing failed.
+     */
+    @Override
+    public void startElement (String namespaceURI, String localName,
+                                String qName, Attributes atts)
+                        throws SAXException {
+        String str = "startElement: " + namespaceURI + ", " + namespaceURI +
+                         ", " + qName;
+        int n = atts.getLength();
+        for(int i = 0; i < n; i++) {
+            str = str + ", " + atts.getQName(i);
+        }
+
+        println(str);
+    }
+
+    /**
+     * Write a startElement appending with namespaceURI,qName and to output File
+     * after processing element finished.
+     * @param namespaceURI the Namespace URI.
+     * @param localName the local name (without prefix).
+     * @param qName the qualified name (with prefix).
+     * @throws SAXException if file writing failed.
+     */
+    @Override
+    public void endElement (String namespaceURI, String localName,
+                                String qName) throws SAXException {
+        println("endElement: " + namespaceURI + ", " + namespaceURI + ", " + qName);
+    }
+
+
+    /**
+     * Write characters tag to file when receive character data.
+     * @param ch the characters from the XML document
+     * @param start the start position in the array
+     * @param length the number of characters to read from the array
+     * @throws SAXException if file writing failed.
+     */
+    @Override
+    public void characters (char ch[], int start, int length)
+                        throws SAXException {
+        println("characters");
+    }
+
+    /**
+     * Write ignorableWhitespace tag to file when receive notification of
+     * ignorable whitespace in element content.
+     * @param ch an array holds all ignorable whitespace.
+     * @param start start position of ignorable whitespace.
+     * @param length length of ignorable whitespace.
+     * @throws SAXException if file writing failed.
+     */
+    @Override
+    public void ignorableWhitespace (char ch[], int start, int length)
+                throws SAXException {
+        println("ignorableWhitespace");
+    }
+
+    /**
+     * Write processingInstruction tag when receive notification of a processing
+     * instruction.
+     * @param target the processing instruction target
+     * @param data the processing instruction data, or null if none was
+     *             supplied.  The data does not include any whitespace
+     *             separating it from the target.
+     * @throws SAXException if file writing failed.
+     */
+    @Override
+    public void processingInstruction (String target, String data)
+                throws SAXException {
+        println("processingInstruction: " + target + ", " + target);
+    }
+
+    /**
+     * Write the entity name to file when receive notification of a skipped entity.
+     * @param name entity name that skipped
+     * @throws SAXException if file writing failed.
+     */
+    @Override
+    public void skippedEntity (String name) throws SAXException {
+        println("skippedEntity: " + name);
+    }
+
+    /**
+     * Print a string output to file along with a new line.
+     * @param output string needed to be written to file.
+     * @throws SAXException if file writing failed.
+     */
+    private void println(String output) throws SAXException  {
+        try {
+            bWriter.write(output, 0, output.length());
+            bWriter.newLine();
+        } catch (IOException ex) {
+            throw new SAXException("bWriter error", ex);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/libs/javax/xml/transform/ptests/TransformerTestConst.java	Thu Oct 16 15:51:12 2014 -0700
@@ -0,0 +1,62 @@
+/*
+ * 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 static jaxp.library.JAXPTestUtilities.FILE_SEP;
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
+
+/**
+ * This is the Base test class provide basic support for JAXP functional test
+ */
+public class TransformerTestConst {
+    /**
+     * Current test directory.
+     */
+    public static final String CLASS_DIR
+            = System.getProperty("test.classes", ".") + FILE_SEP;
+
+    /**
+     * Package name that separates by slash.
+     */
+    public static final String PACKAGE_NAME = FILE_SEP +
+            TransformerTestConst.class.getPackage().getName().replaceAll("[.]", FILE_SEP);
+
+    /**
+     * Test base directory. Every package has its own test package directory.
+     */
+    public static final String BASE_DIR
+            = System.getProperty("test.src", USER_DIR).replaceAll("\\" + System.getProperty("file.separator"), "/")
+                + PACKAGE_NAME + FILE_SEP + "..";
+
+    /**
+     * Source XML file directory.
+     */
+    public static final String XML_DIR = BASE_DIR + FILE_SEP + "xmlfiles" + FILE_SEP;
+
+    /**
+     * Golden output file directory. We pre-define all expected output in golden
+     * output file. Test verifies whether the standard output is same as content
+     * of golden file.
+     */
+    public static final String GOLDEN_DIR = XML_DIR + FILE_SEP + "out" + FILE_SEP;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/libs/jaxp/library/JAXPTestUtilities.java	Thu Oct 16 15:51:12 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 jaxp.library;
+
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import static org.testng.Assert.fail;
+
+/**
+ * This is an interface provide basic support for JAXP functional test.
+ */
+public class JAXPTestUtilities {
+    /**
+     * Prefix for error message.
+     */
+    public static final String ERROR_MSG_HEADER = "Unexcepted exception thrown:";
+
+    /**
+     * Prefix for error message on clean up block.
+     */
+    public static final String ERROR_MSG_CLEANUP = "Clean up failed on %s";
+
+    /**
+     * Force using slash as File separator as we always use cygwin to test in
+     * Windows platform.
+     */
+    public static final String FILE_SEP = "/";
+
+    /**
+     * User home.
+     */
+    public static final String USER_DIR = System.getProperty("user.dir", ".");
+
+    /**
+     * TEMP file directory.
+     */
+    public static final String TEMP_DIR = System.getProperty("java.io.tmpdir", ".");
+
+    /**
+     * Compare contents of golden file with test output file line by line.
+     * return true if they're identical.
+     * @param goldfile Golden output file name
+     * @param outputfile Test output file name
+     * @return true if two files are identical.
+     *         false if two files are not identical.
+     * @throws IOException if an I/O error occurs reading from the file or a
+     *         malformed or unmappable byte sequence is read
+     */
+    public static boolean compareWithGold(String goldfile, String outputfile)
+            throws IOException {
+        return Files.readAllLines(Paths.get(goldfile)).
+                equals(Files.readAllLines(Paths.get(outputfile)));
+    }
+
+    /**
+     * Prints error message if an exception is thrown
+     * @param ex The exception is thrown by test.
+     */
+    public static void failUnexpected(Throwable ex) {
+        fail(ERROR_MSG_HEADER, ex);
+    }
+
+    /**
+     * Prints error message if an exception is thrown when clean up a file.
+     * @param ex The exception is thrown in cleaning up a file.
+     * @param name Cleaning up file name.
+     */
+    public static void failCleanup(IOException ex, String name) {
+        fail(String.format(ERROR_MSG_CLEANUP, name), ex);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/libs/org/xml/sax/ptests/SAXTestConst.java	Thu Oct 16 15:51:12 2014 -0700
@@ -0,0 +1,64 @@
+/*
+ * 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 jaxp.library.JAXPTestUtilities.FILE_SEP;
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
+
+/**
+ * This is the Base test class provide basic support for JAXP SAX functional
+ * test. These are JAXP SAX functional related properties that every test suite
+ * has their own TestBase class.
+ */
+public class SAXTestConst {
+    /**
+     * Current test directory.
+     */
+    public static final String CLASS_DIR
+            = System.getProperty("test.classes", ".") + FILE_SEP;
+
+    /**
+     * Package name that separates by slash.
+     */
+    public static final String PACKAGE_NAME = FILE_SEP +
+            SAXTestConst.class.getPackage().getName().replaceAll("[.]", FILE_SEP);
+
+    /**
+     * Test base directory. Every package has its own test package directory.
+     */
+    public static final String BASE_DIR
+            = System.getProperty("test.src", USER_DIR).replaceAll("\\" + System.getProperty("file.separator"), "/")
+                + PACKAGE_NAME + FILE_SEP + "..";
+
+    /**
+     * Source XML file directory.
+     */
+    public static final String XML_DIR = BASE_DIR + FILE_SEP + "xmlfiles" + FILE_SEP;
+
+    /**
+     * Golden output file directory. We pre-define all expected output in golden
+     * output file. Test verifies whether the standard output is same as content
+     * of golden file.
+     */
+    public static final String GOLDEN_DIR = XML_DIR + FILE_SEP + "out" + FILE_SEP;
+}