8051560: Convert JAXP function tests: Astro tests
authorjoehw
Tue, 21 Apr 2015 15:28:47 -0700
changeset 30001 8898b172fdb5
parent 30000 bc1a5095caed
child 30002 db70d6ebfa97
8051560: Convert JAXP function tests: Astro tests Reviewed-by: lancea, joehw Contributed-by: frank.yuan@oracle.com
jaxp/test/javax/xml/jaxp/functional/test/astro/AstroTest.java
jaxp/test/javax/xml/jaxp/functional/test/astro/DocumentLSTest.java
jaxp/test/javax/xml/jaxp/functional/test/astro/NamespaceContextTest.java
jaxp/test/javax/xml/jaxp/functional/test/astro/SAX201Test.java
jaxp/test/javax/xml/jaxp/functional/test/astro/SchemaValidationTest.java
jaxp/test/javax/xml/jaxp/functional/test/astro/XPathAPITest.java
jaxp/test/javax/xml/jaxp/functional/test/astro/xmlfiles/catalog.xml
jaxp/test/javax/xml/jaxp/functional/test/astro/xmlfiles/catalog.xml.bak
jaxp/test/javax/xml/jaxp/functional/test/astro/xmlfiles/catalog.xsd
jaxp/test/javax/xml/jaxp/functional/test/astro/xmlfiles/gold/query1.out
jaxp/test/javax/xml/jaxp/functional/test/astro/xmlfiles/gold/query2.out
jaxp/test/javax/xml/jaxp/functional/test/astro/xmlfiles/gold/query3.out
jaxp/test/javax/xml/jaxp/functional/test/astro/xmlfiles/gold/query4.out
jaxp/test/javax/xml/jaxp/functional/test/astro/xmlfiles/xsl/dec-ent.xsl
jaxp/test/javax/xml/jaxp/functional/test/astro/xmlfiles/xsl/dec.xsl
jaxp/test/javax/xml/jaxp/functional/test/astro/xmlfiles/xsl/dec_frag.xsl
jaxp/test/javax/xml/jaxp/functional/test/astro/xmlfiles/xsl/html.xsl
jaxp/test/javax/xml/jaxp/functional/test/astro/xmlfiles/xsl/ra-ent.xsl
jaxp/test/javax/xml/jaxp/functional/test/astro/xmlfiles/xsl/ra-uri.xsl
jaxp/test/javax/xml/jaxp/functional/test/astro/xmlfiles/xsl/ra.xsl
jaxp/test/javax/xml/jaxp/functional/test/astro/xmlfiles/xsl/ra_frag.xsl
jaxp/test/javax/xml/jaxp/functional/test/astro/xmlfiles/xsl/radec.xsl
jaxp/test/javax/xml/jaxp/functional/test/astro/xmlfiles/xsl/stellartype.xsl
jaxp/test/javax/xml/jaxp/functional/test/astro/xmlfiles/xsl/toptemplate.xsl
jaxp/test/javax/xml/jaxp/functional/test/astro/xmlfiles/xsl/toptemplateinc.xsl
jaxp/test/javax/xml/jaxp/libs/test/astro/AbstractFilterFactory.java
jaxp/test/javax/xml/jaxp/libs/test/astro/AstroConstants.java
jaxp/test/javax/xml/jaxp/libs/test/astro/AstroProcessor.java
jaxp/test/javax/xml/jaxp/libs/test/astro/DOMFilterFactoryImpl.java
jaxp/test/javax/xml/jaxp/libs/test/astro/DOML3InputSourceFactoryImpl.java
jaxp/test/javax/xml/jaxp/libs/test/astro/FilterFactory.java
jaxp/test/javax/xml/jaxp/libs/test/astro/InputSourceFactory.java
jaxp/test/javax/xml/jaxp/libs/test/astro/InputSourceFactoryImpl.java
jaxp/test/javax/xml/jaxp/libs/test/astro/SAXFilterFactoryImpl.java
jaxp/test/javax/xml/jaxp/libs/test/astro/SourceFilterFactory.java
jaxp/test/javax/xml/jaxp/libs/test/astro/StreamFilterFactoryImpl.java
jaxp/test/javax/xml/jaxp/libs/test/astro/TemplatesFilterFactoryImpl.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/astro/AstroTest.java	Tue Apr 21 15:28:47 2015 -0700
@@ -0,0 +1,142 @@
+/*
+ * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package test.astro;
+
+import static java.lang.String.valueOf;
+import static org.testng.Assert.assertEquals;
+import static test.astro.AstroConstants.ASTROCAT;
+import static test.astro.AstroConstants.GOLDEN_DIR;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.List;
+
+import javax.xml.transform.sax.TransformerHandler;
+
+import jaxp.library.JAXPFileBaseTest;
+
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+/*
+ * @summary run astro application, test xslt
+ *
+ * There are vast amounts of textual astronomical data, typically user is
+ * interested in a small subset, which is the result from carrying out a query.
+ * A query can be composed of one or more filters, for example, the user could
+ * query the database for all stars of visual magnitude down to 6.5 that lie
+ * between right ascensions 0 h to 2 h, and between declinations of 45 to 90 degrees.
+ *
+ * Astro application uses JAXP to query astronomical data saved in an XML dataset.
+ * A FilterFactory implementation creates filter(A filter is an instance of a JAXP
+ * TransformerHandler) from an XSL stylesheet.
+ * A InputSourceFactory implementation creates a new sax input source from an XML file.
+ * AstroProcessor leverages InputSourceFactory to parse catalog.xml, which saves
+ * textual astronomical data, and then creates filters with specified parameters
+ * from FilterFactory, all of the filters are chained together, AstroProcessor
+ * appends the HTML filter at the end of filter chain, and hooks up the chain to
+ * the input source, finally processes and outputs to the user specified output file.
+ *
+ * AstroTest drives AstroProcessor to run the specified queries(total 4 in setup),
+ * and then compares the output with the golden files to determine PASS or FAIL.
+ * It provides variant implementations of FilterFactory and InputSourceFactory to
+ * AstroProcessor to test different JAXP classes and features.
+ *
+ */
+public class AstroTest extends JAXPFileBaseTest {
+    private FiltersAndGolden[] data;
+
+    @BeforeClass
+    public void setup() throws Exception {
+        data = new FiltersAndGolden[4];
+        data[0] = new FiltersAndGolden(getGoldenFileContent(1), astro -> astro.getRAFilter(0.106, 0.108));
+        data[1] = new FiltersAndGolden(getGoldenFileContent(2), astro -> astro.getStellarTypeFilter("K0IIIbCN-0.5"));
+        data[2] = new FiltersAndGolden(getGoldenFileContent(3), astro -> astro.getStellarTypeFilter("G"), astro -> astro.getDecFilter(-5.0, 60.0));
+        data[3] = new FiltersAndGolden(getGoldenFileContent(4), astro -> astro.getRADECFilter(0.084, 0.096, -5.75, 14.0));
+    }
+
+    /*
+     * Provide permutations of InputSourceFactory and FilterFactory for test.
+     */
+    @DataProvider(name = "factories")
+    public Object[][] getQueryFactories() {
+        return new Object[][] {
+                { StreamFilterFactoryImpl.class, InputSourceFactoryImpl.class },
+                { SAXFilterFactoryImpl.class, InputSourceFactoryImpl.class },
+                { DOMFilterFactoryImpl.class, InputSourceFactoryImpl.class },
+                { TemplatesFilterFactoryImpl.class, InputSourceFactoryImpl.class },
+                { StreamFilterFactoryImpl.class, DOML3InputSourceFactoryImpl.class } };
+    }
+
+    @Test(dataProvider = "factories")
+    public void test(Class<FilterFactory> fFactClass, Class<InputSourceFactory> isFactClass) throws Exception {
+        System.out.println(fFactClass.getName() +" : " + isFactClass.getName());
+        AstroProcessor astro = new AstroProcessor(fFactClass, ASTROCAT, isFactClass);
+
+        for (int i = 0; i < data.length; i++) {
+            runProcess(astro, valueOf(i + 1), data[i].getGolden(), data[i].getFilters());
+        }
+    }
+
+    private void runProcess(AstroProcessor astro, String processNum, List<String> goldenfileContent, FilterCreator... filterCreators) throws Exception {
+        System.out.println("run process " + processNum);
+        TransformerHandler[] filters = new TransformerHandler[filterCreators.length];
+        for (int i = 0; i < filterCreators.length; i++)
+            filters[i] = filterCreators[i].createFilter(astro);
+
+        String outputfile = Files.createTempFile(Paths.get("").toAbsolutePath(), "query" + processNum + ".out.", null).toString();
+        System.out.println("output file: " + outputfile);
+        astro.process(outputfile, filters);
+        assertEquals(Files.readAllLines(Paths.get(outputfile)), goldenfileContent);
+    }
+
+    private List<String>  getGoldenFileContent(int num) throws IOException {
+        return Files.readAllLines(Paths.get(GOLDEN_DIR + "query" + num + ".out"));
+    }
+
+    @FunctionalInterface
+    private interface FilterCreator {
+        TransformerHandler createFilter(AstroProcessor astro) throws Exception;
+    }
+
+    private static class FiltersAndGolden {
+        private FilterCreator[] filters;
+        private List<String> golden;
+
+        FiltersAndGolden(List<String> golden, FilterCreator... filters) {
+            this.filters = filters;
+            this.golden = golden;
+        }
+
+        FilterCreator[] getFilters() {
+            return filters;
+        }
+
+        List<String> getGolden() {
+            return golden;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/astro/DocumentLSTest.java	Tue Apr 21 15:28:47 2015 -0700
@@ -0,0 +1,180 @@
+/*
+ * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package test.astro;
+
+import static jaxp.library.JAXPTestUtilities.filenameToURL;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertNull;
+import static org.testng.Assert.assertTrue;
+import static org.w3c.dom.ls.DOMImplementationLS.MODE_SYNCHRONOUS;
+import static test.astro.AstroConstants.ASTROCAT;
+
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.Writer;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import jaxp.library.JAXPFileBaseTest;
+
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.ls.DOMImplementationLS;
+import org.w3c.dom.ls.LSInput;
+import org.w3c.dom.ls.LSOutput;
+import org.w3c.dom.ls.LSParser;
+import org.w3c.dom.ls.LSSerializer;
+
+/*
+ * @summary org.w3c.dom.ls tests
+ */
+public class DocumentLSTest extends JAXPFileBaseTest {
+    /*
+     * Test creating an empty Document
+     */
+    @Test
+    public void testNewDocument() throws ParserConfigurationException {
+        Document doc = getDocumentBuilder().newDocument();
+        assertNull(doc.getDocumentElement());
+    }
+
+    /*
+     * Test creating an LSInput instance, and parsing ByteStream
+     */
+    @Test
+    public void testLSInputParsingByteStream() throws Exception {
+        DOMImplementationLS impl = (DOMImplementationLS) getDocumentBuilder().getDOMImplementation();
+        LSParser domParser = impl.createLSParser(MODE_SYNCHRONOUS, null);
+        LSInput src = impl.createLSInput();
+
+        try (InputStream is = new FileInputStream(ASTROCAT)) {
+            src.setByteStream(is);
+            assertNotNull(src.getByteStream());
+            // set certified accessor methods
+            boolean origCertified = src.getCertifiedText();
+            src.setCertifiedText(true);
+            assertTrue(src.getCertifiedText());
+            src.setCertifiedText(origCertified); // set back to orig
+
+            src.setSystemId(filenameToURL(ASTROCAT));
+
+            Document doc = domParser.parse(src);
+            Element result = doc.getDocumentElement();
+            assertEquals(result.getTagName(), "stardb");
+        }
+    }
+
+    /*
+     * Test creating an LSInput instance, and parsing String
+     */
+    @Test
+    public void testLSInputParsingString() throws Exception {
+        DOMImplementationLS impl = (DOMImplementationLS) getDocumentBuilder().getDOMImplementation();
+        String xml = "<?xml version='1.0'?><test>runDocumentLS_Q6</test>";
+
+        LSParser domParser = impl.createLSParser(MODE_SYNCHRONOUS, null);
+        LSSerializer domSerializer = impl.createLSSerializer();
+        // turn off xml decl in serialized string for comparison
+        domSerializer.getDomConfig().setParameter("xml-declaration", Boolean.FALSE);
+        LSInput src = impl.createLSInput();
+        src.setStringData(xml);
+        assertEquals(src.getStringData(), xml);
+
+        Document doc = domParser.parse(src);
+        String result = domSerializer.writeToString(doc);
+
+        assertEquals(result, "<test>runDocumentLS_Q6</test>");
+    }
+
+    /*
+     * Test writing with an LSOutput instance
+     */
+    @Test
+    public void testLSOutput() throws Exception {
+        DocumentBuilder db = getDocumentBuilder();
+        // Create the Document using the supplied builder...
+        Document doc = db.parse(ASTROCAT);
+
+        DOMImplementationLS impl = null;
+
+        impl = (DOMImplementationLS) db.getDOMImplementation();
+        LSSerializer domSerializer = impl.createLSSerializer();
+        MyDOMOutput mydomoutput = new MyDOMOutput();
+        try (OutputStream os = new FileOutputStream("test.out")) {
+            mydomoutput.setByteStream(os);
+            mydomoutput.setEncoding("UTF-8");
+            assertTrue(domSerializer.write(doc, mydomoutput));
+        }
+    }
+
+    private static class MyDOMOutput implements LSOutput {
+        private OutputStream bytestream = null;
+        private String encoding = null;
+        private String sysId = null;
+        private Writer writer = null;
+
+        public OutputStream getByteStream() {
+            return bytestream;
+        }
+
+        public Writer getCharacterStream() {
+            return writer;
+        }
+
+        public String getEncoding() {
+            return encoding;
+        }
+
+        public String getSystemId() {
+            return sysId;
+        }
+
+        public void setByteStream(OutputStream bs) {
+            bytestream = bs;
+        }
+
+        public void setCharacterStream(Writer cs) {
+            writer = cs;
+        }
+
+        public void setEncoding(String enc) {
+            encoding = enc;
+        }
+
+        public void setSystemId(String sysId) {
+            this.sysId = sysId;
+        }
+    }
+
+    private DocumentBuilder getDocumentBuilder() throws ParserConfigurationException {
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setNamespaceAware(true);
+        return dbf.newDocumentBuilder();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/astro/NamespaceContextTest.java	Tue Apr 21 15:28:47 2015 -0700
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package test.astro;
+
+import static javax.xml.XMLConstants.DEFAULT_NS_PREFIX;
+import static javax.xml.XMLConstants.NULL_NS_URI;
+import static org.testng.Assert.assertEquals;
+
+import javax.xml.namespace.QName;
+
+import jaxp.library.JAXPBaseTest;
+
+import org.testng.annotations.Test;
+
+/*
+ * @summary javax.xml.namespace.QName tests
+ */
+public class NamespaceContextTest extends JAXPBaseTest {
+    private static final String PREFIX = "astro";
+    private static final String LOCAL_PART = "stardb";
+    private static final String NS_URI = "http://www.astro.com";
+
+    /*
+     * Test QName(String, String, String) and accessors.
+     */
+    @Test
+    public void testQNameConstructor() {
+        QName qname = new QName(NS_URI, LOCAL_PART, PREFIX);
+        assertEquals(qname.getNamespaceURI(), NS_URI);
+        assertEquals(qname.getLocalPart(), LOCAL_PART);
+        assertEquals(qname.getPrefix(), PREFIX);
+    }
+
+    /*
+     * Construct QName(String localpart), then test for default ns_uri and
+     * prefix constant.
+     */
+    @Test
+    public void testDefaultFields() {
+        QName qname = new QName(LOCAL_PART); // just the local part specified
+        assertEquals(qname.getNamespaceURI(), NULL_NS_URI);
+        assertEquals(qname.getLocalPart(), LOCAL_PART);
+        assertEquals(qname.getPrefix(), DEFAULT_NS_PREFIX);
+    }
+
+    /*
+     * Construct QName(String ns,String localpart), then test for default prefix
+     * constant.
+     */
+    @Test
+    public void testDefaultPrefix() {
+        QName qname = new QName(NS_URI, LOCAL_PART); // no pref
+        assertEquals(qname.getNamespaceURI(), NS_URI);
+        assertEquals(qname.getLocalPart(), LOCAL_PART);
+        assertEquals(qname.getPrefix(), DEFAULT_NS_PREFIX);
+    }
+
+    /*
+     * Round trip testing of QName to String, String to QName and test for
+     * equality.
+     */
+    @Test
+    public void testQNameString() {
+        QName qname = new QName(NS_URI, LOCAL_PART, PREFIX);
+        assertEquals(QName.valueOf(qname.toString()), qname);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/astro/SAX201Test.java	Tue Apr 21 15:28:47 2015 -0700
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package test.astro;
+
+import javax.xml.parsers.SAXParserFactory;
+
+import jaxp.library.JAXPBaseTest;
+
+import org.testng.annotations.Test;
+import org.xml.sax.XMLReader;
+
+/*
+ * @summary verify SAX 2.0.1 allows to use null in setters
+ */
+public class SAX201Test extends JAXPBaseTest {
+    @Test
+    public void test() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        spf.setNamespaceAware(true);
+        XMLReader reader = spf.newSAXParser().getXMLReader();
+        reader.setErrorHandler(null); // SAX 2.0.1 allows
+        reader.setContentHandler(null); // SAX 2.0.1 allows
+        reader.setEntityResolver(null); // SAX 2.0.1 allows
+        reader.setDTDHandler(null); // SAX 2.0.1 allows
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/astro/SchemaValidationTest.java	Tue Apr 21 15:28:47 2015 -0700
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package test.astro;
+
+import static javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI;
+import static test.astro.AstroConstants.ASTROCAT;
+import static test.astro.AstroConstants.JAXP_SCHEMA_LANGUAGE;
+import static test.astro.AstroConstants.JAXP_SCHEMA_SOURCE;
+
+import java.io.File;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import jaxp.library.JAXPFileBaseTest;
+
+import org.testng.annotations.Test;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+
+/*
+ * @summary test parser sets schema related properties to do validation
+ */
+public class SchemaValidationTest extends JAXPFileBaseTest {
+    /*
+     * Only set the schemaLanguage, without setting schemaSource. It should
+     * work.
+     */
+    @Test
+    public void testSchemaValidation() throws Exception {
+        SAXParser sp = getValidatingParser();
+        sp.setProperty(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA_NS_URI);
+        sp.parse(new File(ASTROCAT), new DefaultHandler());
+    }
+
+    /*
+     * Test SAXException shall be thrown if schemaSource is set but
+     * schemaLanguage is not set.
+     */
+    @Test(expectedExceptions = SAXException.class)
+    public void testSchemaValidationNeg() throws Exception {
+        SAXParser sp = getValidatingParser();
+        sp.setProperty(JAXP_SCHEMA_SOURCE, "catalog.xsd");
+        sp.parse(new File(ASTROCAT), new DefaultHandler());
+    }
+
+    private SAXParser getValidatingParser() throws ParserConfigurationException, SAXException {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        spf.setNamespaceAware(true);
+        spf.setValidating(true);
+        return spf.newSAXParser();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/astro/XPathAPITest.java	Tue Apr 21 15:28:47 2015 -0700
@@ -0,0 +1,169 @@
+/*
+ * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package test.astro;
+
+import static javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI;
+import static javax.xml.xpath.XPathConstants.DOM_OBJECT_MODEL;
+import static javax.xml.xpath.XPathConstants.NODESET;
+import static jaxp.library.JAXPTestUtilities.filenameToURL;
+import static org.testng.Assert.assertEquals;
+import static test.astro.AstroConstants.ASTROCAT;
+import static test.astro.AstroConstants.JAXP_SCHEMA_LANGUAGE;
+import static test.astro.AstroConstants.JAXP_SCHEMA_SOURCE;
+
+import java.net.MalformedURLException;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathExpression;
+import javax.xml.xpath.XPathExpressionException;
+import javax.xml.xpath.XPathFactory;
+import javax.xml.xpath.XPathVariableResolver;
+
+import jaxp.library.JAXPFileBaseTest;
+
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.w3c.dom.NodeList;
+import org.xml.sax.InputSource;
+
+/*
+ * @summary test XPath API
+ */
+@Test(singleThreaded = true)
+public class XPathAPITest extends JAXPFileBaseTest {
+    private static final String STARDB_STAR_3_CONSTELLATION = "//astro:stardb/astro:star[3]/astro:constellation";
+    private static final String STARDB_STAR = "//astro:stardb/astro:star";
+    private Document doc;
+    private XPathFactory xpf;
+    private NamespaceContext nsContext;
+
+    @BeforeClass
+    public void setup() throws Exception {
+        DocumentBuilderFactory df = DocumentBuilderFactory.newInstance();
+        df.setNamespaceAware(true);
+        df.setValidating(true);
+        df.setAttribute(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA_NS_URI);
+        df.setAttribute(JAXP_SCHEMA_SOURCE, "catalog.xsd");
+        DocumentBuilder bldr = df.newDocumentBuilder();
+        doc = bldr.parse(ASTROCAT);
+
+        xpf = XPathFactory.newInstance(DOM_OBJECT_MODEL);
+
+        nsContext = new MyNamespaceContext();
+    }
+
+    @DataProvider(name = "nodelist-evaluator")
+    public Object[][] getNodeListEvaluator() throws MalformedURLException {
+        return new Object[][] { { (XPathEvaluator) expression -> getXPath().evaluate(expression, doc.getDocumentElement(), NODESET) },
+                { (XPathEvaluator) expression -> getXPath().evaluate(expression, createXMLInputSource(), NODESET) },
+                { (XPathEvaluator) expression -> getXPathExpression(expression).evaluate(doc.getDocumentElement(), NODESET) },
+                { (XPathEvaluator) expression -> getXPathExpression(expression).evaluate(createXMLInputSource(), NODESET) } };
+    }
+
+    /*
+     * Test xpath expression evaluations method that returns type indicated by
+     * QName
+     */
+    @Test(dataProvider = "nodelist-evaluator")
+    public void testEvaluateNodeList(XPathEvaluator evaluator) throws Exception {
+        NodeList o = (NodeList) evaluator.evaluate(STARDB_STAR);
+        assertEquals(o.getLength(), 10);
+    }
+
+    @DataProvider(name = "string-evaluator")
+    public Object[][] getStringEvaluator() throws MalformedURLException {
+        return new Object[][] { { (XPathEvaluator) expression -> getXPath().evaluate(expression, doc.getDocumentElement()) },
+                { (XPathEvaluator) expression -> getXPath().evaluate(expression, createXMLInputSource()) },
+                { (XPathEvaluator) expression -> getXPathExpression(expression).evaluate(doc.getDocumentElement()) },
+                { (XPathEvaluator) expression -> getXPathExpression(expression).evaluate(createXMLInputSource()) } };
+    }
+
+    /*
+     * Test xpath expression evaluations method that returns String
+     */
+    @Test(dataProvider = "string-evaluator")
+    public void testEvaluateString(XPathEvaluator evaluator) throws Exception {
+        assertEquals(evaluator.evaluate(STARDB_STAR_3_CONSTELLATION), "Psc");
+    }
+
+    @Test
+    public void testXPathVariableResolver() throws Exception {
+        XPath xpath = getXPath();
+        xpath.setXPathVariableResolver(new MyXPathVariableResolver());
+        assertEquals(xpath.evaluate("//astro:stardb/astro:star[astro:hr=$id]/astro:constellation", doc.getDocumentElement()), "Peg");
+
+    }
+
+    private static class MyXPathVariableResolver implements XPathVariableResolver {
+        public Object resolveVariable(QName vname) {
+            return "4"; // resolve $id as 4, xpath will locate to star[hr=4]
+        }
+    }
+
+    /*
+     * Implementation of a NamespaceContext interface for the Xpath api tests.
+     * Used in xpath.setNamespaceContext(...)
+     */
+    private static class MyNamespaceContext implements NamespaceContext {
+        public String getNamespaceURI(String prefix) {
+            return "astro".equals(prefix) ? "http://www.astro.com/astro" : "";
+        }
+
+        public String getPrefix(String nsURI) {
+            return "http://www.astro.com/astro".equals(nsURI) ? "astro" : "";
+        }
+
+        public Iterator getPrefixes(String nsURI) {
+            ArrayList list = new ArrayList();
+            list.add("astro");
+            return list.iterator();
+        }
+    }
+
+    @FunctionalInterface
+    private interface XPathEvaluator {
+        Object evaluate(String expression) throws XPathExpressionException;
+    }
+
+    private XPath getXPath() {
+        XPath xpath = xpf.newXPath();
+        xpath.setNamespaceContext(nsContext);
+        return xpath;
+    }
+
+    private XPathExpression getXPathExpression(String expression) throws XPathExpressionException {
+        return getXPath().compile(expression);
+    }
+
+    private InputSource createXMLInputSource() {
+        return new InputSource(filenameToURL(ASTROCAT));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/astro/xmlfiles/catalog.xml	Tue Apr 21 15:28:47 2015 -0700
@@ -0,0 +1,17 @@
+<?xml version="1.1" encoding="UTF-8"?>
+<stardb xmlns="http://www.astro.com/astro" xmlns:astro="http://www.astro.com/astro" xsi:schemaLocation="http://www.astro.com/astro catalog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+   <_test01></_test01>
+   <test-02 xmlns:xsi=""></test-02>
+   <test.03></test.03>
+   <_test-04>T%e!s#t$</_test-04>
+   <star><hr>1</hr><constellation/><fullname/><ra><h>00</h><m>05</m><s>09.9</s><dv>0.08608333333333333</dv></ra><dec><sgn/><d>45</d><m>13</m><s>45</s><dv>45.22916666666667</dv></dec><glng>114.44</glng><glat>-16.88</glat><vmag>6.70</vmag><spec>A1Vn</spec></star>
+   <star><hr>2</hr><constellation/><fullname/><ra><h>00</h><m>05</m><s>03.8</s><dv>0.08438888888888889</dv></ra><dec><sgn>-</sgn><d>00</d><m>30</m><s>11</s><dv>-0.5030555555555556</dv></dec><glng>98.33</glng><glat>-61.14</glat><vmag>6.29</vmag><spec>gG9</spec></star>
+   <star><hr>3</hr><constellation>Psc</constellation><fullname>33    Psc</fullname><ra><h>00</h><m>05</m><s>20.1</s><dv>0.08891666666666666</dv></ra><dec><sgn>-</sgn><d>05</d><m>42</m><s>27</s><dv>-5.7075000000000005</dv></dec><glng>93.75</glng><glat>-65.93</glat><vmag>4.61</vmag><spec>K0IIIbCN-0.5</spec></star>
+   <star><hr>4</hr><constellation>Peg</constellation><fullname>86    Peg</fullname><ra><h>00</h><m>05</m><s>42.0</s><dv>0.095</dv></ra><dec><sgn/><d>13</d><m>23</m><s>46</s><dv>13.39611111111111</dv></dec><glng>106.19</glng><glat>-47.98</glat><vmag>5.51</vmag><spec>G5III</spec></star>
+   <star><hr>5</hr><constellation/><fullname/><ra><h>00</h><m>06</m><s>16.0</s><dv>0.10444444444444445</dv></ra><dec><sgn/><d>58</d><m>26</m><s>12</s><dv>58.43666666666666</dv></dec><glng>117.03</glng><glat>-03.92</glat><vmag>5.96</vmag><spec>G5V</spec></star>
+   <star><hr>6</hr><constellation/><fullname/><ra><h>00</h><m>06</m><s>19.0</s><dv>0.10527777777777779</dv></ra><dec><sgn>-</sgn><d>49</d><m>04</m><s>30</s><dv>-49.075</dv></dec><glng>321.61</glng><glat>-66.38</glat><vmag>5.70</vmag><spec>G1IV</spec></star>
+   <star><hr>7</hr><constellation>Cas</constellation><fullname>10    Cas</fullname><ra><h>00</h><m>06</m><s>26.5</s><dv>0.10736111111111112</dv></ra><dec><sgn/><d>64</d><m>11</m><s>46</s><dv>64.19611111111111</dv></dec><glng>118.06</glng><glat>1.75</glat><vmag>5.59</vmag><spec>B9III</spec></star>
+   <star><hr>8</hr><constellation/><fullname/><ra><h>00</h><m>06</m><s>36.8</s><dv>0.11022222222222222</dv></ra><dec><sgn/><d>29</d><m>01</m><s>17</s><dv>29.02138888888889</dv></dec><glng>111.26</glng><glat>-32.83</glat><vmag>6.13</vmag><spec>K0V</spec></star>
+   <star><hr>9</hr><constellation/><fullname/><ra><h>00</h><m>06</m><s>50.1</s><dv>0.11391666666666667</dv></ra><dec><sgn>-</sgn><d>23</d><m>06</m><s>27</s><dv>-23.1075</dv></dec><glng>52.21</glng><glat>-79.14</glat><vmag>6.18</vmag><spec>A7V</spec></star>
+   <star><hr>10</hr><constellation/><fullname/><ra><h>00</h><m>07</m><s>18.2</s><dv>0.12172222222222222</dv></ra><dec><sgn>-</sgn><d>17</d><m>23</m><s>11</s><dv>-17.386388888888888</dv></dec><glng>74.36</glng><glat>-75.90</glat><vmag>6.19</vmag><spec>A6Vn</spec></star>
+</stardb>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/astro/xmlfiles/catalog.xml.bak	Tue Apr 21 15:28:47 2015 -0700
@@ -0,0 +1,2 @@
+<?xml version="1.1" encoding="UTF-8"?>
+<stardb xmlns="http://www.astro.com/astro" xmlns:astro="http://www.astro.com/astro" xsi:schemaLocation="http://www.astro.com/astro catalog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><_test01></_test01><test-02 xmlns:xsi=""></test-02><test.03></test.03><_test-04>T%e!s#t$</_test-04><star><hr>1</hr><constellation/><fullname/><ra><h>00</h><m>05</m><s>09.9</s><dv>0.08608333333333333</dv></ra><dec><sgn/><d>45</d><m>13</m><s>45</s><dv>45.22916666666667</dv></dec><glng>114.44</glng><glat>-16.88</glat><vmag>6.70</vmag><spec>A1Vn</spec></star><star><hr>2</hr><constellation/><fullname/><ra><h>00</h><m>05</m><s>03.8</s><dv>0.08438888888888889</dv></ra><dec><sgn>-</sgn><d>00</d><m>30</m><s>11</s><dv>-0.5030555555555556</dv></dec><glng>98.33</glng><glat>-61.14</glat><vmag>6.29</vmag><spec>gG9</spec></star><star><hr>3</hr><constellation>Psc</constellation><fullname>33    Psc</fullname><ra><h>00</h><m>05</m><s>20.1</s><dv>0.08891666666666666</dv></ra><dec><sgn>-</sgn><d>05</d><m>42</m><s>27</s><dv>-5.7075000000000005</dv></dec><glng>93.75</glng><glat>-65.93</glat><vmag>4.61</vmag><spec>K0IIIbCN-0.5</spec></star><star><hr>4</hr><constellation>Peg</constellation><fullname>86    Peg</fullname><ra><h>00</h><m>05</m><s>42.0</s><dv>0.095</dv></ra><dec><sgn/><d>13</d><m>23</m><s>46</s><dv>13.39611111111111</dv></dec><glng>106.19</glng><glat>-47.98</glat><vmag>5.51</vmag><spec>G5III</spec></star><star><hr>5</hr><constellation/><fullname/><ra><h>00</h><m>06</m><s>16.0</s><dv>0.10444444444444445</dv></ra><dec><sgn/><d>58</d><m>26</m><s>12</s><dv>58.43666666666666</dv></dec><glng>117.03</glng><glat>-03.92</glat><vmag>5.96</vmag><spec>G5V</spec></star><star><hr>6</hr><constellation/><fullname/><ra><h>00</h><m>06</m><s>19.0</s><dv>0.10527777777777779</dv></ra><dec><sgn>-</sgn><d>49</d><m>04</m><s>30</s><dv>-49.075</dv></dec><glng>321.61</glng><glat>-66.38</glat><vmag>5.70</vmag><spec>G1IV</spec></star><star><hr>7</hr><constellation>Cas</constellation><fullname>10    Cas</fullname><ra><h>00</h><m>06</m><s>26.5</s><dv>0.10736111111111112</dv></ra><dec><sgn/><d>64</d><m>11</m><s>46</s><dv>64.19611111111111</dv></dec><glng>118.06</glng><glat>1.75</glat><vmag>5.59</vmag><spec>B9III</spec></star><star><hr>8</hr><constellation/><fullname/><ra><h>00</h><m>06</m><s>36.8</s><dv>0.11022222222222222</dv></ra><dec><sgn/><d>29</d><m>01</m><s>17</s><dv>29.02138888888889</dv></dec><glng>111.26</glng><glat>-32.83</glat><vmag>6.13</vmag><spec>K0V</spec></star><star><hr>9</hr><constellation/><fullname/><ra><h>00</h><m>06</m><s>50.1</s><dv>0.11391666666666667</dv></ra><dec><sgn>-</sgn><d>23</d><m>06</m><s>27</s><dv>-23.1075</dv></dec><glng>52.21</glng><glat>-79.14</glat><vmag>6.18</vmag><spec>A7V</spec></star><star><hr>10</hr><constellation/><fullname/><ra><h>00</h><m>07</m><s>18.2</s><dv>0.12172222222222222</dv></ra><dec><sgn>-</sgn><d>17</d><m>23</m><s>11</s><dv>-17.386388888888888</dv></dec><glng>74.36</glng><glat>-75.90</glat><vmag>6.19</vmag><spec>A6Vn</spec></star></stardb>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/astro/xmlfiles/catalog.xsd	Tue Apr 21 15:28:47 2015 -0700
@@ -0,0 +1,122 @@
+<xs:schema 
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    targetNamespace="http://www.astro.com/astro" 
+    xmlns:astro="http://www.astro.com/astro"
+    elementFormDefault="qualified"
+    attributeFormDefault="qualified"
+>
+    <!-- Star Identification String Type  -->
+    <xs:simpleType name="staridType">
+	<xs:restriction base="xs:string">
+	    <xs:maxLength value="4"/>
+	</xs:restriction>
+    </xs:simpleType>
+
+    <!-- Hour Type -->
+    <xs:simpleType name="hourType">
+	<xs:restriction base="xs:decimal">
+	    <xs:minInclusive value="0.0"/>
+	    <xs:maxInclusive value="24.0"/>
+	</xs:restriction>
+    </xs:simpleType>
+
+    <!-- Minute Type -->
+    <xs:simpleType name="minuteType">
+	<xs:restriction base="xs:decimal">
+	    <xs:minInclusive value="0.0"/>
+	    <xs:maxInclusive value="60.0"/>
+	</xs:restriction>
+    </xs:simpleType>
+
+    <!-- Second Type -->
+    <xs:simpleType name="secondType">
+	<xs:restriction base="xs:decimal">
+	    <xs:minInclusive value="0.0"/>
+	    <xs:maxInclusive value="60.0"/>
+	</xs:restriction>
+    </xs:simpleType>
+
+    <xs:simpleType name="decimalValueType">
+	<xs:restriction base="xs:decimal">
+	</xs:restriction>
+    </xs:simpleType> 
+
+    <xs:simpleType name="degType">
+	<xs:restriction base="xs:decimal">
+	    <xs:minInclusive value="-90.0"/>
+	    <xs:maxInclusive value="90.0"/>
+	</xs:restriction>
+    </xs:simpleType> 
+
+    <xs:simpleType name="vmagType">
+	<xs:restriction base="xs:decimal">
+	    <xs:minInclusive value="-3.0"/>
+	    <xs:maxInclusive value="12.0"/>
+	</xs:restriction>
+    </xs:simpleType> 
+
+
+    <xs:simpleType name="signType">
+	<xs:restriction base="xs:string">
+	    <xs:enumeration value="+"/>
+	    <xs:enumeration value="-"/>
+	    <xs:enumeration value=""/>
+	</xs:restriction>
+    </xs:simpleType> 
+
+    <xs:complexType name="raType">
+	<xs:sequence>
+	    <xs:element name="h"  type="astro:hourType"/>
+	    <xs:element name="m"  type="astro:minuteType"/>
+	    <xs:element name="s"  type="astro:secondType"/>
+	    <xs:element name="dv" type="astro:decimalValueType"/>
+	</xs:sequence>
+    </xs:complexType>
+
+    <xs:complexType name="decType">
+	<xs:sequence>
+	    <xs:element name="sgn" type="astro:signType"/>
+	    <xs:element name="d"   type="astro:degType"/>
+	    <xs:element name="m"   type="astro:minuteType"/>
+	    <xs:element name="s"   type="astro:secondType"/>
+	    <xs:element name="dv"  type="astro:decimalValueType"/>
+	</xs:sequence>
+    </xs:complexType>
+
+
+    <xs:complexType name="starType">
+	<xs:sequence>
+	    <xs:element name="hr"            type="astro:staridType"/>
+	    <xs:element name="constellation" type="xs:string"/>
+	    <xs:element name="fullname"      type="xs:string"/>
+	    <xs:element name="ra"            type="astro:raType"/>
+	    <xs:element name="dec"           type="astro:decType"/>
+	    <xs:element name="glng"          type="xs:decimal"/>
+	    <xs:element name="glat"          type="xs:decimal"/>
+	    <xs:element name="vmag"          type="astro:vmagType"/>
+	    <xs:element name="spec"          type="xs:string"/>
+	</xs:sequence>
+    </xs:complexType>
+
+
+    <!-- The real part of the catalog starts here -->
+    <xs:element name="stardb">
+       <xs:complexType>
+          <xs:sequence>
+
+	     <!-- for testing purposes -->
+	     <xs:element name="_test01" type="xs:string"
+		minOccurs="0" maxOccurs="1"/>
+	     <xs:element name="test-02" type="xs:string"/>
+	     <xs:element name="test.03" type="xs:string"/>
+	     <xs:element name="_test-04" type="xs:string"/>
+
+	     <!-- astro data elements -->
+             <xs:element name="star" type="astro:starType"
+	        minOccurs="0" maxOccurs="unbounded"/>
+          </xs:sequence>
+       </xs:complexType>
+    </xs:element>
+    <!-- The real part of the catalog ends here -->
+
+</xs:schema>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/astro/xmlfiles/gold/query1.out	Tue Apr 21 15:28:47 2015 -0700
@@ -0,0 +1,15 @@
+<html xmlns:astro="http://www.astro.com/astro">
+<h1>Bright Star Catalog Extract</h1>
+<body>
+<b>Star Id: </b>7<br>
+<b>Constellation: </b>Cas<br>
+<b>Description: </b>10    Cas<br>
+<b>RA J2000: </b>00:06:26.5<br>
+<b>DEC J2000: </b>64:11:46<br>
+<b>Visual Magnitude: </b>5.59<br>
+<b>Spectral Type: </b>B9III<br>
+<b>Galactic Longitude: </b>118.06<br>
+<b>Galactic Latitude: </b>1.75<br>
+<hr>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/astro/xmlfiles/gold/query2.out	Tue Apr 21 15:28:47 2015 -0700
@@ -0,0 +1,15 @@
+<html xmlns:astro="http://www.astro.com/astro">
+<h1>Bright Star Catalog Extract</h1>
+<body>
+<b>Star Id: </b>3<br>
+<b>Constellation: </b>Psc<br>
+<b>Description: </b>33    Psc<br>
+<b>RA J2000: </b>00:05:20.1<br>
+<b>DEC J2000: </b>05:42:27<br>
+<b>Visual Magnitude: </b>4.61<br>
+<b>Spectral Type: </b>K0IIIbCN-0.5<br>
+<b>Galactic Longitude: </b>93.75<br>
+<b>Galactic Latitude: </b>-65.93<br>
+<hr>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/astro/xmlfiles/gold/query3.out	Tue Apr 21 15:28:47 2015 -0700
@@ -0,0 +1,39 @@
+<html xmlns:astro="http://www.astro.com/astro">
+<h1>Bright Star Catalog Extract</h1>
+<body>
+<b>Star Id: </b>2<br>
+<b>Constellation: </b>
+<br>
+<b>Description: </b>
+<br>
+<b>RA J2000: </b>00:05:03.8<br>
+<b>DEC J2000: </b>00:30:11<br>
+<b>Visual Magnitude: </b>6.29<br>
+<b>Spectral Type: </b>gG9<br>
+<b>Galactic Longitude: </b>98.33<br>
+<b>Galactic Latitude: </b>-61.14<br>
+<hr>
+<b>Star Id: </b>4<br>
+<b>Constellation: </b>Peg<br>
+<b>Description: </b>86    Peg<br>
+<b>RA J2000: </b>00:05:42.0<br>
+<b>DEC J2000: </b>13:23:46<br>
+<b>Visual Magnitude: </b>5.51<br>
+<b>Spectral Type: </b>G5III<br>
+<b>Galactic Longitude: </b>106.19<br>
+<b>Galactic Latitude: </b>-47.98<br>
+<hr>
+<b>Star Id: </b>5<br>
+<b>Constellation: </b>
+<br>
+<b>Description: </b>
+<br>
+<b>RA J2000: </b>00:06:16.0<br>
+<b>DEC J2000: </b>58:26:12<br>
+<b>Visual Magnitude: </b>5.96<br>
+<b>Spectral Type: </b>G5V<br>
+<b>Galactic Longitude: </b>117.03<br>
+<b>Galactic Latitude: </b>-03.92<br>
+<hr>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/astro/xmlfiles/gold/query4.out	Tue Apr 21 15:28:47 2015 -0700
@@ -0,0 +1,37 @@
+<html xmlns:astro="http://www.astro.com/astro">
+<h1>Bright Star Catalog Extract</h1>
+<body>
+<b>Star Id: </b>2<br>
+<b>Constellation: </b>
+<br>
+<b>Description: </b>
+<br>
+<b>RA J2000: </b>00:05:03.8<br>
+<b>DEC J2000: </b>00:30:11<br>
+<b>Visual Magnitude: </b>6.29<br>
+<b>Spectral Type: </b>gG9<br>
+<b>Galactic Longitude: </b>98.33<br>
+<b>Galactic Latitude: </b>-61.14<br>
+<hr>
+<b>Star Id: </b>3<br>
+<b>Constellation: </b>Psc<br>
+<b>Description: </b>33    Psc<br>
+<b>RA J2000: </b>00:05:20.1<br>
+<b>DEC J2000: </b>05:42:27<br>
+<b>Visual Magnitude: </b>4.61<br>
+<b>Spectral Type: </b>K0IIIbCN-0.5<br>
+<b>Galactic Longitude: </b>93.75<br>
+<b>Galactic Latitude: </b>-65.93<br>
+<hr>
+<b>Star Id: </b>4<br>
+<b>Constellation: </b>Peg<br>
+<b>Description: </b>86    Peg<br>
+<b>RA J2000: </b>00:05:42.0<br>
+<b>DEC J2000: </b>13:23:46<br>
+<b>Visual Magnitude: </b>5.51<br>
+<b>Spectral Type: </b>G5III<br>
+<b>Galactic Longitude: </b>106.19<br>
+<b>Galactic Latitude: </b>-47.98<br>
+<hr>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/astro/xmlfiles/xsl/dec-ent.xsl	Tue Apr 21 15:28:47 2015 -0700
@@ -0,0 +1,36 @@
+<!-- This is the external entity version of dec.xsl 
+     in which the top level template has been removed
+     and referenced as an external entity
+--> 
+     
+<!DOCTYPE xsl:transform [
+  <!ENTITY toplevel SYSTEM "http://astro.com/stylesheets/toptemplate">
+]>
+
+<xsl:transform
+  xmlns:astro="http://www.astro.com/astro"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+
+	<xsl:output method="xml"/>
+	
+	<!-- dec between 00:00:00 and 01:00:00 --> 
+	<xsl:param name="dec_min_deg" select="0.0"/>
+	<xsl:param name="dec_max_deg" select="1.0"/>
+	
+	<!-- introduce the external entity -->
+	&toplevel;          
+	
+	<xsl:template match="astro:star">
+	   <xsl:if test="(
+	                  (number(astro:dec/astro:dv) &gt;= $dec_min_deg) and
+	                  (number(astro:dec/astro:dv) &lt;= $dec_max_deg))" >
+	          <xsl:copy-of select="."/>
+	   </xsl:if>
+	</xsl:template>
+	
+	<xsl:template match="astro:_test-04">
+	    <!-- discard text contents -->
+	</xsl:template>
+
+</xsl:transform>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/astro/xmlfiles/xsl/dec.xsl	Tue Apr 21 15:28:47 2015 -0700
@@ -0,0 +1,32 @@
+<xsl:transform
+  xmlns:astro="http://www.astro.com/astro"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+
+	<xsl:output method="xml"/>
+	
+	<!-- dec between 00:00:00 and 01:00:00 --> 
+	<xsl:param name="dec_min_deg" select="0.0"/>
+	<xsl:param name="dec_max_deg" select="1.0"/>
+	
+	<xsl:template match="astro:stardb">
+	   <stardb xmlns="http://www.astro.com/astro"
+	      xsi:schemaLocation="http://www.astro.com/astro catalog.xsd"
+	      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+	          <xsl:apply-templates/>
+	   </stardb>
+	</xsl:template>
+	
+	<xsl:template match="astro:star">
+	   <xsl:if test="(
+	                  (number(astro:dec/astro:dv) &gt;= $dec_min_deg) and
+	                  (number(astro:dec/astro:dv) &lt;= $dec_max_deg))" >
+	          <xsl:copy-of select="."/>
+	   </xsl:if>
+	</xsl:template>
+	
+	<xsl:template match="astro:_test-04">
+	    <!-- discard text contents -->
+	</xsl:template>
+
+</xsl:transform>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/astro/xmlfiles/xsl/dec_frag.xsl	Tue Apr 21 15:28:47 2015 -0700
@@ -0,0 +1,26 @@
+<xsl:transform
+  xmlns:astro="http://www.astro.com/astro"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+
+	<!-- dec_frag.xsl = fragment used in radec.xsl --> 
+	
+	<xsl:output method="xml"/>
+	
+	<xsl:param name="dec_min_deg" select="-5.75"/>
+	<xsl:param name="dec_max_deg" select="14.0"/>
+	
+	
+	<xsl:template match="astro:star" mode="RA_PASSED" >
+	   <xsl:if test="(
+	                  (number(astro:dec/astro:dv) &gt;= $dec_min_deg) and
+	                  (number(astro:dec/astro:dv) &lt;= $dec_max_deg))" >
+	          <xsl:copy-of select="."/>
+	   </xsl:if>
+	</xsl:template>
+	
+	<xsl:template match="astro:_test-04">
+	    <!-- discard text contents -->
+	</xsl:template>
+
+</xsl:transform>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/astro/xmlfiles/xsl/html.xsl	Tue Apr 21 15:28:47 2015 -0700
@@ -0,0 +1,38 @@
+<xsl:transform
+  xmlns=""
+  xmlns:astro="http://www.astro.com/astro"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+  
+	<xsl:strip-space elements="*"/>
+	
+	<xsl:output method="html"/>
+	
+	<xsl:template match="astro:stardb">
+	   <html>
+	   <h1>Bright Star Catalog Extract</h1>
+	   <body>
+	      <xsl:apply-templates/>
+	   </body>
+	   </html>
+	</xsl:template>
+	
+	<xsl:template match="astro:star">
+	   <b>Star Id: </b><xsl:value-of select="astro:hr"/><br/>
+	   <b>Constellation: </b><xsl:value-of select="astro:constellation"/><br/>
+	   <b>Description: </b><xsl:value-of select="astro:fullname"/><br/>
+	   <b>RA J2000: </b><xsl:value-of select="astro:ra/astro:h"/><xsl:text>:</xsl:text><xsl:value-of select="astro:ra/astro:m"/><xsl:text>:</xsl:text><xsl:value-of select="astro:ra/astro:s"/><br/>
+	   <b>DEC J2000: </b><xsl:value-of select="astro:ra/astro:sgn"/><xsl:value-of select="astro:dec/astro:d"/><xsl:text>:</xsl:text><xsl:value-of select="astro:dec/astro:m"/><xsl:text>:</xsl:text><xsl:value-of select="astro:dec/astro:s"/><br/>
+	   <b>Visual Magnitude: </b><xsl:value-of select="astro:vmag"/><br/>
+	   <b>Spectral Type: </b><xsl:value-of select="astro:spec"/><br/>
+	   <b>Galactic Longitude: </b><xsl:value-of select="astro:glng"/><br/>
+	   <b>Galactic Latitude: </b><xsl:value-of select="astro:glat"/><br/>
+	   <hr></hr>
+	</xsl:template>
+	
+	
+	<xsl:template match="astro:_test-04">
+	    <!-- discard text contents -->
+	</xsl:template>
+
+</xsl:transform>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/astro/xmlfiles/xsl/ra-ent.xsl	Tue Apr 21 15:28:47 2015 -0700
@@ -0,0 +1,29 @@
+<!DOCTYPE xsl:transform [
+  <!ENTITY toplevel SYSTEM "http://astro.com/stylesheets/toptemplate">
+]>
+<xsl:transform
+  xmlns:astro="http://www.astro.com/astro"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+
+	<xsl:output method="xml"/>
+	
+	<!-- ra between 00:00:00 and 01:00:00 --> 
+	<xsl:param name="ra_min_hr" select="0.106"/>
+	<xsl:param name="ra_max_hr" select="0.108"/>
+	
+	&toplevel;
+	
+	<xsl:template match="astro:star">
+	   <xsl:if test="(
+	                  (number(astro:ra/astro:dv) &gt;= $ra_min_hr) and
+	                  (number(astro:ra/astro:dv) &lt;= $ra_max_hr))" >
+	          <xsl:copy-of select="."/>
+	   </xsl:if>
+	</xsl:template>
+	
+	<xsl:template match="astro:_test-04">
+	    <!-- discard text contents -->
+	</xsl:template>
+
+</xsl:transform>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/astro/xmlfiles/xsl/ra-uri.xsl	Tue Apr 21 15:28:47 2015 -0700
@@ -0,0 +1,27 @@
+<xsl:transform
+  xmlns:astro="http://www.astro.com/astro"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+
+	<xsl:output method="xml"/>
+	
+	<!-- ra between 00:00:00 and 01:00:00 --> 
+	<xsl:param name="ra_min_hr" select="0.106"/>
+	<xsl:param name="ra_max_hr" select="0.108"/>
+	
+	<!-- will use the uri resolver to resolve to  'toptemplate.xsl' -->
+	<xsl:include href="http://astro.com/stylesheets/topleveltemplate"/>
+	
+	<xsl:template match="astro:star">
+	   <xsl:if test="(
+	                  (number(astro:ra/astro:dv) &gt;= $ra_min_hr) and
+	                  (number(astro:ra/astro:dv) &lt;= $ra_max_hr))" >
+	          <xsl:copy-of select="."/>
+	   </xsl:if>
+	</xsl:template>
+	
+	<xsl:template match="astro:_test-04">
+	    <!-- discard text contents -->
+	</xsl:template>
+
+</xsl:transform>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/astro/xmlfiles/xsl/ra.xsl	Tue Apr 21 15:28:47 2015 -0700
@@ -0,0 +1,32 @@
+<xsl:transform
+  xmlns:astro="http://www.astro.com/astro"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+
+	<xsl:output method="xml"/>
+	
+	<!-- ra between 00:00:00 and 01:00:00 --> 
+	<xsl:param name="ra_min_hr" select="0.106"/>
+	<xsl:param name="ra_max_hr" select="0.108"/>
+	
+	<xsl:template match="astro:stardb">
+	      <stardb xmlns="http://www.astro.com/astro"
+	      xsi:schemaLocation="http://www.astro.com/astro catalog.xsd"
+	      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+	          <xsl:apply-templates/>
+	      </stardb>
+	</xsl:template>
+	
+	<xsl:template match="astro:star">
+	   <xsl:if test="(
+	                  (number(astro:ra/astro:dv) &gt;= $ra_min_hr) and
+	                  (number(astro:ra/astro:dv) &lt;= $ra_max_hr))" >
+	          <xsl:copy-of select="."/>
+	   </xsl:if>
+	</xsl:template>
+	
+	<xsl:template match="astro:_test-04">
+	    <!-- discard text contents -->
+	</xsl:template>
+
+</xsl:transform>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/astro/xmlfiles/xsl/ra_frag.xsl	Tue Apr 21 15:28:47 2015 -0700
@@ -0,0 +1,26 @@
+<xsl:transform
+  xmlns:astro="http://www.astro.com/astro"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+
+	<!-- ra_frag = fragment used in radec.xsl -->
+	
+	<xsl:output method="xml"/>
+	
+	<xsl:param name="ra_min_hr" select="0.084"/>
+	<xsl:param name="ra_max_hr" select="0.096"/>
+	
+	
+	<xsl:template match="astro:star">
+	   <xsl:if test="(
+	                  (number(astro:ra/astro:dv) &gt;= $ra_min_hr) and
+	                  (number(astro:ra/astro:dv) &lt;= $ra_max_hr))" >
+	          <xsl:apply-templates select="." mode="RA_PASSED"/> 
+	   </xsl:if>
+	</xsl:template>
+	
+	<xsl:template match="astro:_test-04">
+	    <!-- discard text contents -->
+	</xsl:template>
+
+</xsl:transform>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/astro/xmlfiles/xsl/radec.xsl	Tue Apr 21 15:28:47 2015 -0700
@@ -0,0 +1,28 @@
+<xsl:transform
+  xmlns:astro="http://www.astro.com/astro"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+
+	<!-- radec.xsl = filters on both RA and DEC using modes -->
+	
+	<xsl:output method="xml"/>
+	
+	<!-- include the fragments for ra and dec filtering -->
+	
+	<xsl:include href="ra_frag.xsl"/>
+	<xsl:include href="dec_frag.xsl"/>
+	
+	<xsl:template match="astro:stardb">
+	      <stardb xmlns="http://www.astro.com/astro"
+	      xsi:schemaLocation="http://www.astro.com/astro catalog.xsd"
+	      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
+	          <xsl:apply-templates/>
+	      </stardb>
+	</xsl:template>
+	
+	<xsl:template match="astro:_test-04">
+	    <!-- discard text contents -->
+	</xsl:template>
+
+
+</xsl:transform>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/astro/xmlfiles/xsl/stellartype.xsl	Tue Apr 21 15:28:47 2015 -0700
@@ -0,0 +1,29 @@
+<xsl:transform
+  xmlns:astro="http://www.astro.com/astro"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+
+	<xsl:output method="xml"/>
+	
+	<!-- search stars of a particular type --> 
+	<xsl:param name="type" select="G"/>
+	
+	<xsl:template match="astro:stardb">
+	   <stardb xmlns="http://www.astro.com/astro"
+	      xsi:schemaLocation="http://www.astro.com/astro catalog.xsd"
+	      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
+	          <xsl:apply-templates/>
+	   </stardb>
+	</xsl:template>
+	
+	<xsl:template match="astro:star">
+	   <xsl:if test="(contains(astro:spec,$type))" >
+	          <xsl:copy-of select="."/>
+	   </xsl:if>
+	</xsl:template>
+	
+	<xsl:template match="astro:_test-04">
+	    <!-- discard text contents -->
+	</xsl:template>
+
+</xsl:transform>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/astro/xmlfiles/xsl/toptemplate.xsl	Tue Apr 21 15:28:47 2015 -0700
@@ -0,0 +1,17 @@
+
+<!--
+<xsl:transform
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+-->
+
+<xsl:template match="astro:stardb">
+      <stardb xmlns="http://www.astro.com/astro"
+      xsi:schemaLocation="http://www.astro.com/astro catalog.xsd"
+      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
+          <xsl:apply-templates/>
+      </stardb>
+</xsl:template>
+
+<!--
+</xsl:transform>
+-->
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/test/astro/xmlfiles/xsl/toptemplateinc.xsl	Tue Apr 21 15:28:47 2015 -0700
@@ -0,0 +1,24 @@
+<xsl:transform
+  xmlns:astro="http://www.astro.com/astro"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+
+	<!--
+	 - toptemplateinc.xsl = toptemplate used in an xsl:include element
+	 -        which demands that this is a complete stylesheet.
+	 -        The related toptemplate.xsl is not a complete stylesheet
+	 -        as it is used in ext entity references.  
+	-->
+	
+	<xsl:template match="astro:stardb">
+	      <stardb xmlns="http://www.astro.com/astro"
+	      xsi:schemaLocation="http://www.astro.com/astro catalog.xsd"
+	      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
+	          <xsl:apply-templates/>
+	      </stardb>
+	</xsl:template>
+	
+	<xsl:template match="astro:_test-04">
+	    <!-- discard text contents -->
+	</xsl:template>
+
+</xsl:transform>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/libs/test/astro/AbstractFilterFactory.java	Tue Apr 21 15:28:47 2015 -0700
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package test.astro;
+
+import static test.astro.AstroConstants.HTMLXSL;
+
+import java.io.IOException;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.sax.TransformerHandler;
+
+import org.xml.sax.SAXException;
+
+public abstract class AbstractFilterFactory implements FilterFactory {
+    @Override
+    public TransformerHandler newRAFilter(double min, double max) throws TransformerConfigurationException, SAXException, ParserConfigurationException,
+            IOException {
+        TransformerHandler retval = getTransformerHandler(getRAXsl());
+        Transformer xformer = retval.getTransformer();
+        xformer.setParameter("ra_min_hr", String.valueOf(min));
+        xformer.setParameter("ra_max_hr", String.valueOf(max));
+        return retval;
+    }
+
+    @Override
+    public TransformerHandler newDECFilter(double min, double max) throws TransformerConfigurationException, SAXException, ParserConfigurationException,
+            IOException {
+        TransformerHandler retval = getTransformerHandler(getDECXsl());
+        Transformer xformer = retval.getTransformer();
+        xformer.setParameter("dec_min_deg", String.valueOf(min));
+        xformer.setParameter("dec_max_deg", String.valueOf(max));
+        return retval;
+    }
+
+    @Override
+    public TransformerHandler newRADECFilter(double rmin, double rmax, double dmin, double dmax) throws TransformerConfigurationException, SAXException,
+            ParserConfigurationException, IOException {
+        TransformerHandler retval = getTransformerHandler(getRADECXsl());
+        Transformer xformer = retval.getTransformer();
+        xformer.setParameter("ra_min_hr", String.valueOf(rmin));
+        xformer.setParameter("ra_max_hr", String.valueOf(rmax));
+        xformer.setParameter("dec_min_deg", String.valueOf(dmin));
+        xformer.setParameter("dec_max_deg", String.valueOf(dmax));
+        return retval;
+    }
+
+    @Override
+    public TransformerHandler newStellarTypeFilter(String type) throws TransformerConfigurationException, SAXException, ParserConfigurationException,
+            IOException {
+        TransformerHandler retval = getTransformerHandler(getStellarXsl());
+        Transformer xformer = retval.getTransformer();
+        xformer.setParameter("type", type);
+        return retval;
+    }
+
+    @Override
+    public TransformerHandler newHTMLOutput() throws TransformerConfigurationException, SAXException, ParserConfigurationException, IOException {
+        return getTransformerHandler(HTMLXSL);
+    }
+
+    abstract protected TransformerHandler getTransformerHandler(String xslFileName) throws SAXException, ParserConfigurationException,
+            TransformerConfigurationException, IOException;
+
+    abstract protected String getRAXsl();
+
+    abstract protected String getDECXsl();
+
+    abstract protected String getRADECXsl();
+
+    abstract protected String getStellarXsl();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/libs/test/astro/AstroConstants.java	Tue Apr 21 15:28:47 2015 -0700
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package test.astro;
+
+import static java.io.File.separator;
+import static jaxp.library.JAXPTestUtilities.getPathByClassName;
+
+public class AstroConstants {
+    // Query parameters :
+
+    public static final double RA_MIN = 0.0; // hours
+    public static final double RA_MAX = 24.0; // hours
+    public static final double DEC_MIN = -90.000; // degrees
+    public static final double DEC_MAX = 90.000; // degrees
+
+    // Stylesheet source paths:
+
+    public static final String XSLPATH = getPathByClassName(AstroConstants.class, "xmlfiles" + separator + "xsl");
+    public static final String RAXSL = XSLPATH + "ra.xsl";
+    public static final String DECXSL = XSLPATH + "dec.xsl";
+    public static final String RADECXSL = XSLPATH + "radec.xsl";
+    public static final String STYPEXSL = XSLPATH + "stellartype.xsl";
+    public static final String HTMLXSL = XSLPATH + "html.xsl";
+
+    public static final String RAENTXSL = XSLPATH + "ra-ent.xsl";
+    public static final String DECENTXSL = XSLPATH + "dec-ent.xsl";
+    public static final String RAURIXSL = XSLPATH + "ra-uri.xsl";
+    public static final String TOPTEMPLXSL = XSLPATH + "toptemplate.xsl";
+    public static final String TOPTEMPLINCXSL = XSLPATH + "toptemplateinc.xsl";
+
+    // Catalog references
+
+    public static final String ASTROCAT = getPathByClassName(AstroConstants.class, "xmlfiles") + "catalog.xml";
+
+
+    public static final String GOLDEN_DIR = getPathByClassName(AstroConstants.class, "xmlfiles" + separator + "gold");
+    public static final String JAXP_SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+    public static final String JAXP_SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/libs/test/astro/AstroProcessor.java	Tue Apr 21 15:28:47 2015 -0700
@@ -0,0 +1,279 @@
+/*
+ * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package test.astro;
+
+import static javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI;
+import static test.astro.AstroConstants.DEC_MAX;
+import static test.astro.AstroConstants.DEC_MIN;
+import static test.astro.AstroConstants.JAXP_SCHEMA_LANGUAGE;
+import static test.astro.AstroConstants.JAXP_SCHEMA_SOURCE;
+import static test.astro.AstroConstants.RA_MAX;
+import static test.astro.AstroConstants.RA_MIN;
+
+import java.io.File;
+import java.io.IOException;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.sax.SAXResult;
+import javax.xml.transform.sax.TransformerHandler;
+import javax.xml.transform.stream.StreamResult;
+
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+import org.xml.sax.XMLReader;
+
+/*
+ * AstroProcessor is to carry out the user's query with filters and produce a table of
+ * star records that match the criterion, and finally output with HTML format.
+ */
+public class AstroProcessor {
+    private String catalogFileName;
+
+    private FilterFactory ffact;
+    private InputSourceFactory isfact;
+
+    private SAXParserFactory spf;
+
+    /*
+     * Constructor for the Main astro class.
+     *
+     * @param fFactClass the class of the FilterFactory implementation
+     *
+     * @param catalogfilename the name of the XML input document (database)
+     *
+     * @param isFactClass the class of the Input Source Factory implementation
+     */
+    public AstroProcessor(Class<FilterFactory> fFactClass, String catalogFileName, Class<InputSourceFactory> isFactClass) throws Exception {
+        // create the Filter Factory instance...
+
+        ffact = fFactClass.newInstance();
+
+        // create the Input Source Instance
+
+        isfact = isFactClass.newInstance();
+
+        spf = SAXParserFactory.newInstance();
+        spf.setNamespaceAware(true);
+        spf.setValidating(true);
+
+        // All XML Readers are required to recognize these two:
+        spf.setFeature("http://xml.org/sax/features/namespaces", true);
+        spf.setFeature("http://xml.org/sax/features/namespace-prefixes", true);
+
+        // Other features...
+        spf.setFeature("http://xml.org/sax/features/validation", true);
+        spf.setFeature("http://apache.org/xml/features/validation/schema", true);
+        spf.setFeature("http://apache.org/xml/features/validation/schema-full-checking", true);
+
+        this.catalogFileName = catalogFileName;
+    }
+
+    /*
+     * Sets the star stellar type query.
+     *
+     * @param arg stellar type string, can be a substring.
+     */
+    public TransformerHandler getStellarTypeFilter(String arg) throws TransformerConfigurationException, SAXException, ParserConfigurationException,
+            IOException {
+        String stellarType = null;
+        if (arg != null && arg.length() != 0) {
+            stellarType = arg; // set value of query
+        } else {
+            throw new IllegalArgumentException("\n  Stellar type string of length zero found.");
+        }
+
+        return ffact.newStellarTypeFilter(stellarType);
+    }
+
+    /*
+     * Sets the right ascension parameters for a query. Parameters are validated
+     * to be in the range of 0h and 24h inclusive.
+     *
+     * @param min minimum right ascension in hours.
+     *
+     * @param max maximum right ascension in hours.
+     */
+    public TransformerHandler getRAFilter(double min, double max) throws TransformerConfigurationException, SAXException, ParserConfigurationException,
+            IOException {
+        double raMin = RA_MIN; // hours
+        double raMax = RA_MAX; // hours
+        if (min < max) {
+            if ((min >= RA_MIN && min <= RA_MAX) && (max >= RA_MIN && max <= RA_MAX)) {
+                raMin = min; // set value of query
+                raMax = max; // set value of query
+
+            }
+        } else {
+            throw new IllegalArgumentException("min must be less than max.\n" + "min=" + min + ", max=" + max);
+        }
+
+        return ffact.newRAFilter(raMin, raMax);
+    }
+
+    /*
+     * Sets the right ascension and dec parameters for a query. Parameters are
+     * validated to be in the range of ra 0h and 24h and dec -90 to +90
+     * inclusive.
+     *
+     * @param rmin minimum right ascension in hours.
+     *
+     * @param rmax maximum right ascension in hours.
+     *
+     * @param dmin minimum declination in degs.
+     *
+     * @param dmax maximum declination in degs.
+     */
+    public TransformerHandler getRADECFilter(double rmin, double rmax, double dmin, double dmax) throws TransformerConfigurationException, SAXException,
+            ParserConfigurationException, IOException {
+        double raMin = RA_MIN; // hours
+        double raMax = RA_MAX; // hours
+        double decMin = DEC_MIN; // degrees
+        double decMax = DEC_MAX; // degrees
+        if (rmin < rmax && dmin < dmax) {
+            if ((rmin >= RA_MIN && rmin <= RA_MAX) && (rmax >= RA_MIN && rmax <= RA_MAX)) {
+                raMin = rmin; // set value of query
+                raMax = rmax; // set value of query
+            }
+            if ((dmin >= DEC_MIN && dmin <= DEC_MAX) && (dmax >= DEC_MIN && dmax <= DEC_MAX)) {
+                decMin = dmin; // set value of query
+                decMax = dmax; // set value of query
+            }
+
+        } else {
+            throw new IllegalArgumentException("min must be less than max.\n" + "rmin=" + rmin + ", rmax=" + rmax + ", dmin=" + dmin + ", dmax=" + dmax);
+        }
+
+        return ffact.newRADECFilter(raMin, raMax, decMin, decMax);
+    }
+
+    /*
+     * Sets the declination parameters for a query. Parameters are validated to
+     * be in the range of -90 and +90 degrees inclusive.
+     *
+     * @param min minimum declination in degrees.
+     *
+     * @param max maximum declination in degrees.
+     */
+    public TransformerHandler getDecFilter(double min, double max) throws TransformerConfigurationException, SAXException, ParserConfigurationException,
+            IOException {
+        double decMin = DEC_MIN; // degrees
+        double decMax = DEC_MAX; // degrees
+        if (min < max) {
+            if ((min >= DEC_MIN && min <= DEC_MAX) && (max >= DEC_MIN && max <= DEC_MAX)) {
+                decMin = min; // set value of query
+                decMax = max; // set value of query
+            }
+        } else {
+            throw new IllegalArgumentException("min must be less than max.\n" + "min=" + min + ", max=" + max);
+        }
+
+        return ffact.newDECFilter(decMin, decMax);
+    }
+
+    /*
+     * Runs the filter process against the astronomical database.
+     *
+     * @throws Exception
+     */
+    public void process(String outputfile, TransformerHandler... filters) throws Exception {
+        XMLReader catparser = getXMLReader();
+
+        File catalogfile = new File(catalogFileName);
+        InputSource catsrc = isfact.newInputSource(catalogfile.getPath());
+
+        TransformerHandler outfilter = ffact.newHTMLOutput();
+        // create an array from the Vector of filters...
+
+        // hook the filters up to each other, there may be zero filters
+        int nfilters = filters.length;
+        if (nfilters != 0) {
+            TransformerHandler prev = null;
+            for (int i = 0; i < filters.length; i++) {
+                TransformerHandler curr = filters[i];
+                if (prev != null) {
+                    prev.setResult(new SAXResult(curr));
+                }
+                prev = curr;
+            }
+            // hook up the last filter to the output filter
+            prev.setResult(new SAXResult(outfilter));
+            // hook up the catalog parser to the first filter...
+            catparser.setContentHandler(filters[0]);
+        } else {
+            // There are no query filters,
+            // hook up the catalog parser directly to output filter...
+            catparser.setContentHandler(outfilter);
+        }
+        // hook up the output filter to the output file or std out
+        if (outputfile != null) {
+            outfilter.setResult(new StreamResult(outputfile));
+        } else {
+            outfilter.setResult(new StreamResult(System.out));
+        }
+
+        catparser.parse(catsrc);
+    }
+
+    private XMLReader getXMLReader() throws Exception {
+        SAXParser parser = spf.newSAXParser();
+        parser.setProperty(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA_NS_URI);
+        parser.setProperty(JAXP_SCHEMA_SOURCE, "catalog.xsd");
+        XMLReader catparser = parser.getXMLReader();
+        catparser.setErrorHandler(new CatalogErrorHandler());
+        return catparser;
+    }
+
+    /*
+     * Error Handler for the parsing of the XML astronomical catalog.
+     */
+    private static class CatalogErrorHandler implements ErrorHandler {
+        private String getParseExceptionInfo(SAXParseException spe) {
+            String systemId = spe.getSystemId();
+            if (systemId == null) {
+                systemId = "null";
+            }
+            String info = "Catalog URI=" + systemId + " Line=" + spe.getLineNumber() + ": " + spe.getMessage();
+            return info;
+        }
+
+        public void warning(SAXParseException spe) throws SAXException {
+            String message = "Warning: " + getParseExceptionInfo(spe);
+            throw new SAXException(message);
+        }
+
+        public void error(SAXParseException spe) throws SAXException {
+            String message = "Error: " + getParseExceptionInfo(spe);
+            throw new SAXException(message);
+        }
+
+        public void fatalError(SAXParseException spe) throws SAXException {
+            String message = "Fatal Error: " + getParseExceptionInfo(spe);
+            throw new SAXException(message);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/libs/test/astro/DOMFilterFactoryImpl.java	Tue Apr 21 15:28:47 2015 -0700
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package test.astro;
+
+import static jaxp.library.JAXPTestUtilities.filenameToURL;
+import static test.astro.AstroConstants.DECXSL;
+import static test.astro.AstroConstants.RAXSL;
+import static test.astro.AstroConstants.STYPEXSL;
+
+import java.io.IOException;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.Source;
+import javax.xml.transform.dom.DOMSource;
+
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
+
+/*
+ * Implementation of the filter factory interface that utilizes DOM
+ * sources rather than Stream or SAX sources. This factory utilizes a
+ * DocumentBuilder to read in the stylesheets and create the DOM used
+ * to create the filters for the query pipeline.
+ *
+ */
+public class DOMFilterFactoryImpl extends SourceFilterFactory {
+    @Override
+    protected Source getSource(String xslFileName) throws SAXException, ParserConfigurationException, IOException {
+        Document document = getStylesheetDOM(xslFileName);
+        return new DOMSource(document);
+    }
+
+
+    @Override
+    protected String getRAXsl() {
+        return RAXSL;
+    }
+
+    @Override
+    protected String getDECXsl() {
+        return DECXSL;
+    }
+
+    @Override
+    protected String getRADECXsl() {
+        return DECXSL;
+    }
+
+    @Override
+    protected String getStellarXsl() {
+        return STYPEXSL;
+    }
+
+    private Document getStylesheetDOM(String xslfilename) throws SAXException, IOException, ParserConfigurationException {
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setNamespaceAware(true);
+        return dbf.newDocumentBuilder().parse(filenameToURL(xslfilename));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/libs/test/astro/DOML3InputSourceFactoryImpl.java	Tue Apr 21 15:28:47 2015 -0700
@@ -0,0 +1,172 @@
+/*
+ * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package test.astro;
+
+import static jaxp.library.JAXPTestUtilities.filenameToURL;
+import static org.w3c.dom.ls.DOMImplementationLS.MODE_SYNCHRONOUS;
+import static org.w3c.dom.traversal.NodeFilter.SHOW_ELEMENT;
+
+import java.io.ByteArrayInputStream;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.w3c.dom.DOMConfiguration;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.ls.DOMImplementationLS;
+import org.w3c.dom.ls.LSInput;
+import org.w3c.dom.ls.LSParser;
+import org.w3c.dom.ls.LSParserFilter;
+import org.w3c.dom.ls.LSSerializer;
+import org.w3c.dom.ls.LSSerializerFilter;
+import org.xml.sax.InputSource;
+
+/*
+ * A specialized implementation of an Input Source factory that utilizes
+ * DOM Level 3 implementations to build a Document (DOM) from the
+ * astro input file (XML) and then will serialize the DOM. The serialized DOM
+ * of the astro input file is then used to create the sax InputSource
+ * and set it's system id. It is then returned to the caller.
+ *
+ */
+public class DOML3InputSourceFactoryImpl implements InputSourceFactory {
+    public InputSource newInputSource(String filename) throws Exception {
+        // Create DOMImplementationLS, and DOM L3 LSParser
+        DocumentBuilderFactory fact = DocumentBuilderFactory.newInstance();
+        DocumentBuilder bldr = fact.newDocumentBuilder();
+        DOMImplementationLS impl = (DOMImplementationLS) bldr.getDOMImplementation();
+        LSParser domparser = impl.createLSParser(MODE_SYNCHRONOUS, null);
+        domparser.setFilter(new MyDOMBuilderFilter());
+
+        // Parse the xml document to create the DOM Document using
+        // the DOM L3 LSParser and a LSInput (formerly LSInputSource)
+        Document doc = null;
+        LSInput src = impl.createLSInput();
+        // register the input file with the input source...
+        String systemId = filenameToURL(filename);
+        src.setSystemId(systemId);
+        try (Reader reader = new FileReader(filename)) {
+            src.setCharacterStream(reader);
+            src.setEncoding("UTF-8");
+            doc = domparser.parse(src);
+        }
+
+        // Use DOM L3 LSSerializer (previously called a DOMWriter)
+        // to serialize the xml doc DOM to a file stream.
+        String tmpCatalog = Files.createTempFile(Paths.get("").toAbsolutePath(), "catalog.xml", null).toString();
+
+        LSSerializer domserializer = impl.createLSSerializer();
+        domserializer.setFilter(new MyDOMWriterFilter());
+        domserializer.getNewLine();
+        DOMConfiguration config = domserializer.getDomConfig();
+        config.setParameter("xml-declaration", Boolean.TRUE);
+        String result = domserializer.writeToString(doc);
+        try (FileWriter os = new FileWriter(tmpCatalog, false)) {
+            os.write(result);
+            os.flush();
+        }
+
+        // Return the Input Source created from the Serialized DOM L3 Document.
+        InputSource catsrc = new InputSource(new InputStreamReader(new ByteArrayInputStream(Files.readAllBytes(Paths.get(tmpCatalog)))));
+        catsrc.setSystemId(systemId);
+        return catsrc;
+    }
+
+    /*
+     * Implementation of a DOM L3 DOM Builder Filter. The filter is capable of
+     * examining nodes as they are available during the parse. This
+     * implementation both rejects (filters) and modifies particular nodes
+     * during the parse of the document. As such, the document in memory will
+     * become a subset of the document on the stream in accordance with the DOM
+     * Level 3 Load and Save Specification, v1.0, sect. 1.3 Load Interfaces.
+     */
+    private static class MyDOMBuilderFilter implements LSParserFilter {
+
+        /*
+         * Filter the DOM. Define element(s) and their children that should be
+         * efficiently skipped thereby filtering them out of the stream.
+         */
+        @Override
+        public short startElement(Element e) {
+            return "_test01".equals(e.getTagName()) ? FILTER_REJECT : FILTER_ACCEPT;
+        }
+
+        /*
+         * Modify the DOM 'in situ'. Find a particular Node and change the Node
+         * value of its child, allow other nodes to pass through unchanged.
+         */
+        @Override
+        public short acceptNode(Node n) {
+            String localname = n.getLocalName();
+            if (localname.equals("_test-04")) {
+                Node child = n.getFirstChild();
+                String text = child.getNodeValue();
+                if (text.equals("T%e!s#t$")) {
+                    child.setNodeValue("T%E!S#T$");
+                }
+            }
+            return FILTER_ACCEPT;
+        }
+
+        /*
+         * Tells the DOMBuilder what types of nodes to show to the filter.
+         */
+        @Override
+        public int getWhatToShow() {
+            return SHOW_ELEMENT;
+        }
+    }
+
+    /*
+     * Implementation of a DOM Serializer Filter (previously called a DOM Writer
+     * Filter) which is a specialization of the NodeFilter interface.
+     */
+    private static class MyDOMWriterFilter implements LSSerializerFilter {
+        public MyDOMWriterFilter() {
+        }
+
+        /*
+         * Must implement method from NodeFilter interface
+         */
+        @Override
+        public short acceptNode(Node node) {
+            return FILTER_ACCEPT;
+        }
+
+        /*
+         * Tells the DOMBuilder what types of nodes to show to the filter.
+         */
+        @Override
+        public int getWhatToShow() {
+            return SHOW_ELEMENT;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/libs/test/astro/FilterFactory.java	Tue Apr 21 15:28:47 2015 -0700
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package test.astro;
+
+import java.io.IOException;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.sax.TransformerHandler;
+import javax.xml.transform.TransformerConfigurationException;
+
+import org.xml.sax.SAXException;
+
+/*
+ * Defines the interface for all concrete implementations of a Filter
+ * Factory.
+ */
+public interface FilterFactory {
+    /*
+     * Allows only the stars between right ascension (R.A.) of min and max to
+     * pass. Filters out all stars that are not in that range of right
+     * ascension. Units of right ascension are hours (h), range of parameters is
+     * 0h to 24h.
+     *
+     * @param min minimum R.A.
+     *
+     * @param max maxmimum R.A.
+     */
+    TransformerHandler newRAFilter(double min, double max) throws TransformerConfigurationException, SAXException, ParserConfigurationException, IOException;
+
+    /*
+     * Allows only the stars between declination (DEC) of min and max to pass.
+     * Filters out all stars that are not in that range of declination. Units of
+     * declination are degrees (degs), range of parameters is -90 and +90 degs.
+     *
+     * @param min minimum DEC
+     *
+     * @param max maxmimum DEC
+     */
+    TransformerHandler newDECFilter(double min, double max) throws TransformerConfigurationException, SAXException, ParserConfigurationException, IOException;
+
+    /*
+     * Combines the usage of newRAFilter and newDECFilter into one.
+     *
+     * @param rmin minimum R.A.
+     *
+     * @param rmax maxmimum R.A.
+     *
+     * @param dmin minimum DEC
+     *
+     * @param dmax maxmimum DEC
+     */
+    TransformerHandler newRADECFilter(double rmin, double rmax, double dmin, double dmax) throws TransformerConfigurationException, SAXException,
+            ParserConfigurationException, IOException;
+
+    TransformerHandler newStellarTypeFilter(String type) throws TransformerConfigurationException, SAXException, ParserConfigurationException, IOException;
+
+    TransformerHandler newHTMLOutput() throws TransformerConfigurationException, SAXException, ParserConfigurationException, IOException;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/libs/test/astro/InputSourceFactory.java	Tue Apr 21 15:28:47 2015 -0700
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package test.astro;
+
+import org.xml.sax.InputSource;
+
+/*
+ * Interface for all input source factory objects. The default implementation
+ * 'InputSourceFactoryImpl' is provided as a straight forward factory
+ * class that creates a new sax input source from a filename.
+ *
+ */
+public interface InputSourceFactory {
+    /*
+     * Creates a new sax InputSource object from a filename.
+     * Also sets the system id of the input source.
+     * @param file filename of the XML input to create the input source.
+     */
+    InputSource newInputSource(String file) throws Exception;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/libs/test/astro/InputSourceFactoryImpl.java	Tue Apr 21 15:28:47 2015 -0700
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package test.astro;
+
+import static jaxp.library.JAXPTestUtilities.filenameToURL;
+
+import org.xml.sax.InputSource;
+
+/*
+ * Default implementation of a input source factory. This is the most
+ * straight forward way to create a sax input source and set it's
+ * system id.
+ *
+ */
+public class InputSourceFactoryImpl implements InputSourceFactory {
+    public InputSourceFactoryImpl() {
+    }
+
+    public InputSource newInputSource(String filename) {
+        InputSource catSrc = new InputSource(filename);
+        catSrc.setSystemId(filenameToURL(filename));
+        return catSrc;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/libs/test/astro/SAXFilterFactoryImpl.java	Tue Apr 21 15:28:47 2015 -0700
@@ -0,0 +1,119 @@
+/*
+ * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package test.astro;
+
+import static jaxp.library.JAXPTestUtilities.filenameToURL;
+import static test.astro.AstroConstants.DECENTXSL;
+import static test.astro.AstroConstants.DECXSL;
+import static test.astro.AstroConstants.RAENTXSL;
+import static test.astro.AstroConstants.STYPEXSL;
+import static test.astro.AstroConstants.TOPTEMPLXSL;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.transform.Source;
+import javax.xml.transform.sax.SAXSource;
+
+import org.xml.sax.EntityResolver;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+
+/*
+ * Implementation of the filter factory interface that utilizes SAX
+ * sources rather than Stream sources. This factory utilizes a
+ * SAX parser factory and XMLReader to read in the stylesheets used
+ * to create the filters for the query pipeline.
+ * The XMLReader has been equipped with an entity resolver
+ * SAXFilterFactoryEntityResolver, it is used to resolve external
+ * entities in two specialized stylesheets, ra-ent.xsl (derived from
+ * ra.xsl) and dec-ent.xsl (derived from dec.xsl).
+ *
+ */
+public class SAXFilterFactoryImpl extends SourceFilterFactory {
+    private EntityResolver entityResolver;
+
+    public SAXFilterFactoryImpl() {
+        super();
+        entityResolver = new SAXFilterFactoryEntityResolver();
+    }
+
+    @Override
+    protected Source getSource(String xslFileName) throws SAXException, ParserConfigurationException {
+        SAXSource saxsource = new SAXSource(new InputSource(filenameToURL(xslFileName)));
+        saxsource.setXMLReader(getXMLReader());
+        return saxsource;
+    }
+
+    @Override
+    protected String getRAXsl() {
+        return RAENTXSL;
+    }
+
+    @Override
+    protected String getDECXsl() {
+        return DECENTXSL;
+    }
+
+    @Override
+    protected String getRADECXsl() {
+        return DECXSL;
+    }
+
+    @Override
+    protected String getStellarXsl() {
+        return STYPEXSL;
+    }
+
+    /*
+     * Entity resolver implementation that is used in the SAXFilterFactory
+     * implementation for handling external entities that appear in two
+     * specialized stylesheets, 'ra-ent.xsl' and 'dec-ent.xsl'. Both of these
+     * stylesheets contain an external entity reference to the top level
+     * stylesheet template, which is stored in a separate file,
+     * 'toptemplate.xsl'.
+     */
+    private static class SAXFilterFactoryEntityResolver implements EntityResolver {
+        public InputSource resolveEntity(String publicid, String sysId) {
+            if (sysId.equals("http://astro.com/stylesheets/toptemplate")) {
+                InputSource retval = new InputSource(TOPTEMPLXSL);
+                retval.setSystemId(filenameToURL(TOPTEMPLXSL));
+                return retval;
+            } else {
+                return null; // use default behavior
+            }
+        }
+    }
+
+    private XMLReader getXMLReader() throws SAXException, ParserConfigurationException {
+        SAXParserFactory pfactory = SAXParserFactory.newInstance();
+        pfactory.setNamespaceAware(true);
+        // pfactory.setValidating(true);
+        XMLReader xmlreader = pfactory.newSAXParser().getXMLReader();
+        // entity resolver is used in stylesheets ra-ent.xsl,
+        // dec-ent.xsl. Other stylehsheets will not use it
+        // since they do not contain ext entities.
+        xmlreader.setEntityResolver(entityResolver);
+        return xmlreader;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/libs/test/astro/SourceFilterFactory.java	Tue Apr 21 15:28:47 2015 -0700
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package test.astro;
+
+import java.io.IOException;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.Source;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.sax.SAXTransformerFactory;
+import javax.xml.transform.sax.TransformerHandler;
+
+import org.xml.sax.SAXException;
+
+public abstract class SourceFilterFactory extends AbstractFilterFactory {
+    @Override
+    protected TransformerHandler getTransformerHandler(String xslFileName) throws SAXException, ParserConfigurationException,
+            TransformerConfigurationException, IOException {
+        return getFactory().newTransformerHandler(getSource(xslFileName));
+    }
+
+    abstract protected Source getSource(String xslFileName) throws SAXException, ParserConfigurationException, IOException;
+
+    private SAXTransformerFactory getFactory() {
+        return (SAXTransformerFactory) TransformerFactory.newInstance();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/libs/test/astro/StreamFilterFactoryImpl.java	Tue Apr 21 15:28:47 2015 -0700
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package test.astro;
+
+import static jaxp.library.JAXPTestUtilities.filenameToURL;
+import static test.astro.AstroConstants.DECXSL;
+import static test.astro.AstroConstants.RADECXSL;
+import static test.astro.AstroConstants.RAXSL;
+import static test.astro.AstroConstants.STYPEXSL;
+
+import javax.xml.transform.Source;
+import javax.xml.transform.stream.StreamSource;
+
+public class StreamFilterFactoryImpl extends SourceFilterFactory {
+    @Override
+    protected Source getSource(String xslFileName) {
+        return new StreamSource(filenameToURL(xslFileName));
+    }
+
+    @Override
+    protected String getRAXsl() {
+        return RAXSL;
+    }
+
+    @Override
+    protected String getDECXsl() {
+        return DECXSL;
+    }
+
+    @Override
+    protected String getRADECXsl() {
+        return RADECXSL;
+    }
+
+    @Override
+    protected String getStellarXsl() {
+        return STYPEXSL;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/libs/test/astro/TemplatesFilterFactoryImpl.java	Tue Apr 21 15:28:47 2015 -0700
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package test.astro;
+
+import static jaxp.library.JAXPTestUtilities.filenameToURL;
+import static test.astro.AstroConstants.DECXSL;
+import static test.astro.AstroConstants.RAURIXSL;
+import static test.astro.AstroConstants.STYPEXSL;
+import static test.astro.AstroConstants.TOPTEMPLINCXSL;
+
+import java.io.IOException;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.transform.Source;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.URIResolver;
+import javax.xml.transform.sax.SAXTransformerFactory;
+import javax.xml.transform.sax.TemplatesHandler;
+import javax.xml.transform.sax.TransformerHandler;
+import javax.xml.transform.stream.StreamSource;
+
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+
+/*
+ * Implementation of the filter factory interface that utilizes
+ * a TemplatesHandler and creates Templates from the stylesheets.
+ * The Templates objects are then used to create a TransformerHandler
+ * a.k.a Filter which is returned to the caller.
+ * This factory uses a Uri resolver which is registered with the
+ * Transformer factory.
+ *
+ */
+public class TemplatesFilterFactoryImpl extends AbstractFilterFactory {
+    private final URIResolver uriResolver = new TemplatesFilterFactoryURIResolver();
+
+    @Override
+    protected String getRAXsl() {
+        return RAURIXSL;
+    }
+
+    @Override
+    protected String getDECXsl() {
+        return DECXSL;
+    }
+
+    @Override
+    protected String getRADECXsl() {
+        return DECXSL;
+    }
+
+    @Override
+    protected String getStellarXsl() {
+        return STYPEXSL;
+    }
+
+    @Override
+    protected TransformerHandler getTransformerHandler(String xslFileName) throws SAXException, ParserConfigurationException,
+            TransformerConfigurationException, IOException {
+        SAXTransformerFactory factory = (SAXTransformerFactory) TransformerFactory.newInstance();
+        factory.setURIResolver(uriResolver);
+
+        TemplatesHandler templatesHandler = factory.newTemplatesHandler();
+
+        SAXParserFactory pFactory = SAXParserFactory.newInstance();
+        pFactory.setNamespaceAware(true);
+
+        XMLReader xmlreader = pFactory.newSAXParser().getXMLReader();
+
+        // create the stylesheet input source
+        InputSource xslSrc = new InputSource(xslFileName);
+
+        xslSrc.setSystemId(filenameToURL(xslFileName));
+        // hook up the templates handler as the xsl content handler
+        xmlreader.setContentHandler(templatesHandler);
+        // call parse on the xsl input source
+
+        xmlreader.parse(xslSrc);
+
+        // extract the Templates object created from the xsl input source
+        return factory.newTransformerHandler(templatesHandler.getTemplates());
+    }
+
+    /*
+     * Uri resolver used to resolve stylesheet used by the Templates filter
+     * factory.
+     */
+    private static class TemplatesFilterFactoryURIResolver implements URIResolver {
+        public Source resolve(String href, String base) throws TransformerException {
+            if ("http://astro.com/stylesheets/topleveltemplate".equals(href)) {
+                StreamSource ss = new StreamSource(TOPTEMPLINCXSL);
+                ss.setSystemId(filenameToURL(TOPTEMPLINCXSL));
+                return ss;
+            } else {
+                return null;
+            }
+        }
+    }
+}