Merge
authorlana
Thu, 18 Jun 2015 10:25:10 -0700
changeset 31207 3a7fb5940d2f
parent 31203 5e8684bd4f05 (current diff)
parent 31206 cfbd14bd78d6 (diff)
child 31208 664a0dfdd245
Merge
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/compiler/FunctionTable.java	Thu Jun 18 01:43:12 2015 -0700
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/compiler/FunctionTable.java	Thu Jun 18 10:25:10 2015 -0700
@@ -1,21 +1,23 @@
 /*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
  */
-/*
- * Copyright 1999-2005 The Apache Software Foundation.
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
  *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
  */
 /*
  * $Id: FunctionTable.java,v 1.3 2005/09/28 13:49:34 pvedula Exp $
@@ -135,6 +137,9 @@
   /** The 'unparsed-entity-uri()' id (XSLT). */
   public static final int FUNC_UNPARSED_ENTITY_URI = 36;
 
+  /** The 'here()' id (XML Signature). */
+  public static final int FUNC_HERE = 37;
+
   // Proprietary
 
   /** The 'document-location()' id (Proprietary). */
@@ -162,7 +167,7 @@
    * Number of built in functions.  Be sure to update this as
    * built-in functions are added.
    */
-  private static final int NUM_BUILT_IN_FUNCS = 37;
+  private static final int NUM_BUILT_IN_FUNCS = 38;
 
   /**
    * Number of built-in functions that may be added.
@@ -229,6 +234,8 @@
       com.sun.org.apache.xpath.internal.functions.FuncDoclocation.class;
     m_functions[FUNC_UNPARSED_ENTITY_URI] =
       com.sun.org.apache.xpath.internal.functions.FuncUnparsedEntityURI.class;
+    m_functions[FUNC_HERE] =
+      com.sun.org.apache.xpath.internal.functions.FuncHere.class;
   }
 
   static{
@@ -302,6 +309,8 @@
                           new Integer(FunctionTable.FUNC_UNPARSED_ENTITY_URI));
           m_functionID.put(Keywords.FUNC_DOCLOCATION_STRING,
                           new Integer(FunctionTable.FUNC_DOCLOCATION));
+          m_functionID.put(Keywords.FUNC_HERE_STRING,
+                          new Integer(FunctionTable.FUNC_HERE));
   }
 
   public FunctionTable(){
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/compiler/Keywords.java	Thu Jun 18 01:43:12 2015 -0700
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/compiler/Keywords.java	Thu Jun 18 10:25:10 2015 -0700
@@ -1,21 +1,23 @@
 /*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
  */
-/*
- * Copyright 1999-2005 The Apache Software Foundation.
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
  *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
  */
 /*
  * $Id: Keywords.java,v 1.2.4.1 2005/09/14 19:46:01 jeffsuttor Exp $
@@ -210,6 +212,9 @@
   public static final String FUNC_UNPARSED_ENTITY_URI_STRING =
     "unparsed-entity-uri";
 
+  /** here function string (XML Signature). */
+  public static final String FUNC_HERE_STRING = "here";
+
   // Proprietary, built in functions
 
   /** current function string (Proprietary). */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/functions/FuncHere.java	Thu Jun 18 10:25:10 2015 -0700
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ */
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.sun.org.apache.xpath.internal.functions;
+
+import javax.xml.transform.TransformerException;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import com.sun.org.apache.xml.internal.dtm.DTM;
+import com.sun.org.apache.xpath.internal.NodeSetDTM;
+import com.sun.org.apache.xpath.internal.XPathContext;
+import com.sun.org.apache.xpath.internal.objects.XNodeSet;
+import com.sun.org.apache.xpath.internal.objects.XObject;
+import com.sun.org.apache.xpath.internal.res.XPATHErrorResources;
+
+/**
+ * Execute the XML Signature here() function.
+ */
+public final class FuncHere extends Function {
+
+    private static final long serialVersionUID = 4328660760070034592L;
+
+    @Override
+    public XObject execute(XPathContext xctxt) throws TransformerException {
+        Node xpathOwnerNode = (Node)xctxt.getOwnerObject();
+        if (xpathOwnerNode == null) {
+            return null;
+        }
+
+        int xpathOwnerNodeDTM = xctxt.getDTMHandleFromNode(xpathOwnerNode);
+        int currentNode = xctxt.getCurrentNode();
+        DTM dtm = xctxt.getDTM(currentNode);
+        int docContext = dtm.getDocument();
+
+        if (docContext == DTM.NULL) {
+            error(xctxt, XPATHErrorResources.ER_CONTEXT_HAS_NO_OWNERDOC, null);
+        }
+
+        // check whether currentNode and the node containing the XPath
+        // expression are in the same document
+        Document currentDoc = getOwnerDocument(dtm.getNode(currentNode));
+        Document xpathOwnerDoc = getOwnerDocument(xpathOwnerNode);
+
+        if (currentDoc != xpathOwnerDoc) {
+            throw new TransformerException("Owner documents differ");
+        }
+
+        XNodeSet nodes = new XNodeSet(xctxt.getDTMManager());
+        NodeSetDTM nodeSet = nodes.mutableNodeset();
+
+        int hereNode = DTM.NULL;
+
+        switch (dtm.getNodeType(xpathOwnerNodeDTM)) {
+
+            case Node.ATTRIBUTE_NODE:
+            case Node.PROCESSING_INSTRUCTION_NODE: {
+                // returns a node-set containing the attribute /  processing
+                // instruction node
+                hereNode = xpathOwnerNodeDTM;
+                nodeSet.addNode(hereNode);
+                break;
+            }
+            case Node.TEXT_NODE : {
+                // returns a node-set containing the parent element of the
+                // text node that directly bears the XPath expression
+                hereNode = dtm.getParent(xpathOwnerNodeDTM);
+                nodeSet.addNode(hereNode);
+                break;
+            }
+            default :
+                break;
+        }
+
+        /** $todo$ Do I have to do this detach() call? */
+        nodeSet.detach();
+
+        return nodes;
+    }
+
+    private static Document getOwnerDocument(Node node) {
+        if (node.getNodeType() == Node.DOCUMENT_NODE) {
+            return (Document)node;
+        }
+        return node.getOwnerDocument();
+    }
+
+    @Override
+    public void fixupVariables(java.util.Vector vars, int globalsSize) { }
+}
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DocumentBuilderFactoryTest.java	Thu Jun 18 01:43:12 2015 -0700
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DocumentBuilderFactoryTest.java	Thu Jun 18 10:25:10 2015 -0700
@@ -23,28 +23,32 @@
 
 package javax.xml.parsers.ptests;
 
+import static javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI;
+import static javax.xml.parsers.ptests.ParserTestConst.GOLDEN_DIR;
+import static javax.xml.parsers.ptests.ParserTestConst.XML_DIR;
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
+import static jaxp.library.JAXPTestUtilities.compareWithGold;
+import static jaxp.library.JAXPTestUtilities.filenameToURL;
 import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
 import static org.testng.Assert.assertNotNull;
 import static org.testng.Assert.assertNull;
+import static org.testng.Assert.assertTrue;
 
 import java.io.BufferedReader;
+import java.io.Closeable;
 import java.io.File;
 import java.io.FileInputStream;
+import java.io.FileNotFoundException;
 import java.io.FilePermission;
 import java.io.FileReader;
 
-import static javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI;
-
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.FactoryConfigurationError;
 import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.parsers.SAXParser;
 import javax.xml.parsers.SAXParserFactory;
-
-import static javax.xml.parsers.ptests.ParserTestConst.GOLDEN_DIR;
-import static javax.xml.parsers.ptests.ParserTestConst.XML_DIR;
-
 import javax.xml.transform.Transformer;
 import javax.xml.transform.TransformerFactory;
 import javax.xml.transform.dom.DOMSource;
@@ -52,10 +56,6 @@
 
 import jaxp.library.JAXPDataProvider;
 import jaxp.library.JAXPFileBaseTest;
-import static jaxp.library.JAXPTestUtilities.USER_DIR;
-import static jaxp.library.JAXPTestUtilities.compareWithGold;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
 
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
@@ -67,6 +67,7 @@
 import org.xml.sax.helpers.DefaultHandler;
 
 /**
+ * @bug 8080907
  * This checks the methods of DocumentBuilderFactoryImpl.
  */
 public class DocumentBuilderFactoryTest extends JAXPFileBaseTest {
@@ -134,28 +135,11 @@
         assertFalse(eh.isErrorOccured());
     }
 
-    /**
-     * Test the default functionality of schema support method. In
-     * this case the schema source property is set.
-     * @throws Exception If any errors occur.
-     */
-    @Test
-    public void testCheckSchemaSupport2() throws Exception {
-        try (FileInputStream fis = new FileInputStream(new File(
-                XML_DIR, "test.xsd"))) {
-            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-            dbf.setValidating(true);
-            dbf.setNamespaceAware(true);
-            dbf.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaLanguage",
-                    W3C_XML_SCHEMA_NS_URI);
-            dbf.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaSource",
-                    new InputSource(fis));
-            MyErrorHandler eh = MyErrorHandler.newInstance();
-            DocumentBuilder db = dbf.newDocumentBuilder();
-            db.setErrorHandler(eh);
-            db.parse(new File(XML_DIR, "test1.xml"));
-            assertFalse(eh.isErrorOccured());
-        }
+    @DataProvider(name = "schema-source")
+    public Object[][] getSchemaSource() throws FileNotFoundException {
+        return new Object[][] {
+                { new FileInputStream(new File(XML_DIR, "test.xsd")) },
+                { new InputSource(filenameToURL(XML_DIR + "test.xsd")) } };
     }
 
     /**
@@ -163,22 +147,50 @@
      * this case the schema source property is set.
      * @throws Exception If any errors occur.
      */
-    @Test
-    public void testCheckSchemaSupport3() throws Exception {
-        try (FileInputStream fis = new FileInputStream(new File(
-                XML_DIR, "test.xsd"))) {
+    @Test(dataProvider = "schema-source")
+    public void testCheckSchemaSupport2(Object schemaSource) throws Exception {
+        try {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setValidating(true);
+            dbf.setNamespaceAware(true);
+            dbf.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaLanguage",
+                    W3C_XML_SCHEMA_NS_URI);
+            dbf.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaSource", schemaSource);
+            MyErrorHandler eh = MyErrorHandler.newInstance();
+            DocumentBuilder db = dbf.newDocumentBuilder();
+            db.setErrorHandler(eh);
+            db.parse(new File(XML_DIR, "test1.xml"));
+            assertFalse(eh.isErrorOccured());
+        } finally {
+            if (schemaSource instanceof Closeable) {
+                ((Closeable) schemaSource).close();
+            }
+        }
+
+    }
+
+    /**
+     * Test the default functionality of schema support method. In
+     * this case the schema source property is set.
+     * @throws Exception If any errors occur.
+     */
+    @Test(dataProvider = "schema-source")
+    public void testCheckSchemaSupport3(Object schemaSource) throws Exception {
+        try {
             SAXParserFactory spf = SAXParserFactory.newInstance();
-            spf.setNamespaceAware(true);
             spf.setValidating(true);
             spf.setNamespaceAware(true);
             SAXParser sp = spf.newSAXParser();
             sp.setProperty("http://java.sun.com/xml/jaxp/properties/schemaLanguage",
                     W3C_XML_SCHEMA_NS_URI);
-            sp.setProperty("http://java.sun.com/xml/jaxp/properties/schemaSource",
-                    new InputSource(fis));
+            sp.setProperty("http://java.sun.com/xml/jaxp/properties/schemaSource", schemaSource);
             DefaultHandler dh = new DefaultHandler();
             // Not expect any unrecoverable error here.
             sp.parse(new File(XML_DIR, "test1.xml"), dh);
+        } finally {
+            if (schemaSource instanceof Closeable) {
+                ((Closeable) schemaSource).close();
+            }
         }
     }
 
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/validation/ptests/SchemaFactoryTest.java	Thu Jun 18 01:43:12 2015 -0700
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/validation/ptests/SchemaFactoryTest.java	Thu Jun 18 10:25:10 2015 -0700
@@ -27,6 +27,7 @@
 import static org.testng.Assert.assertNotNull;
 import static org.testng.Assert.assertNull;
 import static org.testng.Assert.assertSame;
+import static org.testng.Assert.assertTrue;
 
 import java.io.ByteArrayInputStream;
 import java.io.File;
@@ -39,9 +40,12 @@
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
 import javax.xml.transform.Source;
 import javax.xml.transform.dom.DOMSource;
 import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.stax.StAXSource;
 import javax.xml.transform.stream.StreamSource;
 import javax.xml.validation.Schema;
 import javax.xml.validation.SchemaFactory;
@@ -60,6 +64,7 @@
 import org.xml.sax.SAXParseException;
 
 /*
+ * @bug 8080907
  * @summary Class containing the test cases for SchemaFactory
  */
 @Test(singleThreaded = true)
@@ -68,8 +73,9 @@
     @BeforeClass
     public void setup() throws SAXException, IOException, ParserConfigurationException {
         sf = newSchemaFactory();
+        assertNotNull(sf);
 
-        assertNotNull(sf);
+        ifac = XMLInputFactory.newInstance();
 
         xsd1 = Files.readAllBytes(Paths.get(XML_DIR + "test.xsd"));
         xsd2 = Files.readAllBytes(Paths.get(XML_DIR + "test1.xsd"));
@@ -152,11 +158,13 @@
     }
 
     @DataProvider(name = "valid-source")
-    public Object[][] getValidSource() {
+    public Object[][] getValidSource() throws XMLStreamException {
         return new Object[][] {
                 { streamSource(xsd1) },
                 { saxSource(xsd1) },
-                { domSource(xsdDoc1) } };
+                { domSource(xsdDoc1) },
+                { staxStreamSource(xsd1) },
+                { staxEventSource(xsd1) } };
 
     }
 
@@ -299,6 +307,34 @@
         sf.setFeature(null, true);
     }
 
+    @DataProvider(name = "source-feature")
+    public Object[][] getSourceFeature() {
+        return new Object[][] {
+                { StreamSource.FEATURE },
+                { SAXSource.FEATURE },
+                { DOMSource.FEATURE },
+                { DOMSource.FEATURE } };
+
+    }
+
+    /*
+     * Return true for each of the JAXP Source features to indicate that this
+     * SchemaFactory supports all of the built-in JAXP Source types.
+     */
+    @Test(dataProvider = "source-feature")
+    public void testSourceFeatureGet(String sourceFeature) throws Exception {
+        assertTrue(newSchemaFactory().getFeature(sourceFeature));
+    }
+
+    /*
+     * JAXP Source features are read-only because this SchemaFactory always
+     * supports all JAXP Source types.
+     */
+    @Test(dataProvider = "source-feature", expectedExceptions = SAXNotSupportedException.class)
+    public void testSourceFeatureSet(String sourceFeature) throws Exception {
+        newSchemaFactory().setFeature(sourceFeature, false);
+    }
+
     @Test(expectedExceptions = IllegalArgumentException.class)
     public void testInvalidSchemaLanguage() {
         final String INVALID_SCHEMA_LANGUAGE = "http://relaxng.org/ns/structure/1.0";
@@ -337,6 +373,15 @@
         return new DOMSource(xsdDoc);
     }
 
+    private Source staxStreamSource(byte[] xsd) throws XMLStreamException {
+        return new StAXSource(ifac.createXMLStreamReader(newInputStream(xsd)));
+    }
+
+    private Source staxEventSource(byte[] xsd) throws XMLStreamException {
+        return new StAXSource(ifac.createXMLEventReader(newInputStream(xsd)));
+    }
+
+
     private SchemaFactory newSchemaFactory() {
         return SchemaFactory.newInstance(W3C_XML_SCHEMA_NS_URI);
     }
@@ -346,6 +391,7 @@
     private static final String SCHEMA_FACTORY_CLASSNAME = "com.sun.org.apache.xerces.internal.jaxp.validation.XMLSchemaFactory";
 
     private SchemaFactory sf;
+    private XMLInputFactory ifac;
     private byte[] xsd1;
     private byte[] xsd2;
     private Document xsdDoc1;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/AnyElementTest.java	Thu Jun 18 10:25:10 2015 -0700
@@ -0,0 +1,79 @@
+/*
+ * 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 javax.xml.validation;
+
+/*
+ * @bug 8080907
+ * @summary Test processContents attribute of any element
+ */
+import static javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI;
+
+import java.net.URISyntaxException;
+
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+public class AnyElementTest {
+    @BeforeClass
+    public void setup() throws URISyntaxException, SAXException {
+        validator = SchemaFactory.newInstance(W3C_XML_SCHEMA_NS_URI).newSchema(new StreamSource(getUri("ProcessContents.xsd"))).newValidator();
+    }
+
+    /*
+     * processContents attribute - Specifies how the XML processor should handle
+     * validation against the elements specified by this any element. Can be set
+     * to one of the following:
+     * strict - the XML processor must obtain the schema for the required
+     * namespaces and validate the elements (this is default)
+     * lax - same as strict, but if the schema cannot be obtained, no errors
+     * will occur
+     * skip - The XML processor does not attempt to validate any elements from
+     * the specified namespaces
+     */
+    @Test
+    public void testProcessContents() throws Exception {
+        validator.validate(new StreamSource(getUri("ProcessContents-ok.xml")));
+    }
+
+    /*
+     * When processContents="lax", validation will be performed when the element
+     * is declared in the schema.
+     */
+    @Test(expectedExceptions = SAXParseException.class)
+    public void testProcessContentsLax() throws Exception {
+        validator.validate(new StreamSource(getUri("ProcessContents-lax-error.xml")));
+    }
+
+    /*
+     * Get the URI of the file, which is in the same path as this class
+     */
+    private String getUri(String fileName) throws URISyntaxException {
+        return this.getClass().getResource(fileName).toURI().toASCIIString();
+    }
+
+    private Validator validator;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/ProcessContents-lax-error.xml	Thu Jun 18 10:25:10 2015 -0700
@@ -0,0 +1,4 @@
+<?xml version="1.0"?>
+<my_lax>
+   <my_int>25.5</my_int>
+</my_lax>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/ProcessContents-ok.xml	Thu Jun 18 10:25:10 2015 -0700
@@ -0,0 +1,21 @@
+<?xml version="1.0"?>
+<my_strict>
+   <my_int>255</my_int>
+   <my_skip>
+      <my_int>2.55</my_int>
+      <un_define/>
+      <my_lax>
+         <my_int>25.5</my_int>
+      </my_lax>
+      <my_strict>
+         <un_define>TTT</un_define>
+      </my_strict>
+   </my_skip>   
+   <my_lax>
+         <my_int>2555</my_int>
+         <un_define>TTT</un_define>
+         <my_strict>
+            <my_int>20</my_int>
+         </my_strict>
+   </my_lax>
+</my_strict>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/ProcessContents.xsd	Thu Jun 18 10:25:10 2015 -0700
@@ -0,0 +1,34 @@
+<?xml version="1.0"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
+
+<xs:element name="my_lax">
+   <xs:complexType>
+      <xs:sequence>
+         <xs:any processContents="lax" maxOccurs="unbounded"/>			  
+      </xs:sequence>
+   </xs:complexType>
+</xs:element>
+
+<xs:element name="my_skip">
+   <xs:complexType>
+      <xs:sequence>
+         <xs:any processContents="skip" maxOccurs="unbounded"/>			  
+      </xs:sequence>
+   </xs:complexType>
+</xs:element>
+
+<xs:element name="my_strict">
+   <xs:complexType>
+      <xs:sequence>
+         <xs:any maxOccurs="unbounded"/> <!-- by default, processContents="strict" -->
+      </xs:sequence>
+   </xs:complexType>
+</xs:element>
+
+<xs:element name="my_int">
+   <xs:simpleType>
+         <xs:restriction base="xs:int"/>
+   </xs:simpleType>
+</xs:element>
+
+</xs:schema>
\ No newline at end of file