svn commit: r1198624 - /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/jaxp/validation/DOMValidatorHelper.java

2011-11-06 Thread mrglavas
Author: mrglavas
Date: Mon Nov  7 05:12:09 2011
New Revision: 1198624

URL: http://svn.apache.org/viewvc?rev=1198624&view=rev
Log:
Comments and PIs are expected to be present in the XDM tree for assertions. 
Make sure we pass them to the validator when schema version is 1.1. We can 
still bypass the validator when we're in XML Schema 1.0 mode.

Modified:

xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/jaxp/validation/DOMValidatorHelper.java

Modified: 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/jaxp/validation/DOMValidatorHelper.java
URL: 
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/jaxp/validation/DOMValidatorHelper.java?rev=1198624&r1=1198623&r2=1198624&view=diff
==
--- 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/jaxp/validation/DOMValidatorHelper.java
 (original)
+++ 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/jaxp/validation/DOMValidatorHelper.java
 Mon Nov  7 05:12:09 2011
@@ -96,6 +96,10 @@ final class DOMValidatorHelper implement
 private static final String VALIDATION_MANAGER =
 Constants.XERCES_PROPERTY_PREFIX + 
Constants.VALIDATION_MANAGER_PROPERTY;
 
+/** Property identifier: xml schema version. */
+private static final String XML_SCHEMA_VERSION =
+Constants.XERCES_PROPERTY_PREFIX + 
Constants.XML_SCHEMA_VERSION_PROPERTY;
+
 //
 // Data
 //
@@ -145,12 +149,15 @@ final class DOMValidatorHelper implement
 /** Current element. **/
 private Node fCurrentElement;
 
-/** Fields for start element, end element and characters. **/
+/** Fields for start element, end element, characters, comments and 
processing instructions. **/
 final QName fElementQName = new QName();
 final QName fAttributeQName = new QName();
 final XMLAttributesImpl fAttributes = new XMLAttributesImpl(); 
 final XMLString fTempString = new XMLString();
 
+/** Flag indicating whether the schema version is 1.1. */
+private final boolean fIsXSD11;
+
 public DOMValidatorHelper(XMLSchemaValidatorComponentManager 
componentManager) {
 fComponentManager = componentManager;
 fErrorReporter = (XMLErrorReporter) 
fComponentManager.getProperty(ERROR_REPORTER);
@@ -158,6 +165,7 @@ final class DOMValidatorHelper implement
 fSchemaValidator = (XMLSchemaValidator) 
fComponentManager.getProperty(SCHEMA_VALIDATOR);
 fSymbolTable = (SymbolTable) 
fComponentManager.getProperty(SYMBOL_TABLE);
 fValidationManager = (ValidationManager) 
fComponentManager.getProperty(VALIDATION_MANAGER);
+fIsXSD11 = 
Constants.W3C_XML_SCHEMA11_NS_URI.equals(fComponentManager.getProperty(XML_SCHEMA_VERSION));
 }
 
 /*
@@ -302,19 +310,23 @@ final class DOMValidatorHelper implement
 }
 break;
 case Node.PROCESSING_INSTRUCTION_NODE:
-/** 
- * The validator does nothing with processing instructions so 
bypass it.
- * Send the ProcessingInstruction node directly to the result 
builder.
- */
+// The XSD 1.0 validator does nothing with processing 
instructions so bypass it unless it's 1.1.
+if (fIsXSD11) {
+fillXMLString(fTempString, node.getNodeValue());
+fSchemaValidator.processingInstruction(node.getNodeName(), 
fTempString, null);
+}
+// Send the ProcessingInstruction node directly to the result 
builder.
 if (fDOMValidatorHandler != null) {
 
fDOMValidatorHandler.processingInstruction((ProcessingInstruction) node);
 }
 break;
 case Node.COMMENT_NODE:
-/** 
- * The validator does nothing with comments so bypass it.
- * Send the Comment node directly to the result builder.
- */
+// The XSD 1.0 validator does nothing with comments so bypass 
it unless it's 1.1.
+if (fIsXSD11) {
+fillXMLString(fTempString, node.getNodeValue());
+fSchemaValidator.comment(fTempString, null);
+}
+// Send the Comment node directly to the result builder.
 if (fDOMValidatorHandler != null) {
 fDOMValidatorHandler.comment((Comment) node);
 }
@@ -452,6 +464,19 @@ final class DOMValidatorHelper implement
 }
 }
 
+private void fillXMLString(XMLString toFill, String str) {
+final int length = str.length();
+final char[] strArray;
+if (length <= fCharBuffer.length) {
+str.getChars(0, length, fCharBuffer, 0);
+strArray = fCharBuffer;
+}
+else {
+st

svn commit: r1198620 - in /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/jaxp/validation: ValidatorHandlerImpl.java ValidatorImpl.java XMLSchemaValidatorComponentManager.java

2011-11-06 Thread mrglavas
Author: mrglavas
Date: Mon Nov  7 04:02:43 2011
New Revision: 1198620

URL: http://svn.apache.org/viewvc?rev=1198620&view=rev
Log:
Fixing a bug. The schema version property is supposed to be read-only. Users 
can only choose the version when they create the SchemaFactory. This ensures 
that the semantics of XML Schema 1.1 are applied consistently from schema 
loading through instance validation.

Modified:

xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/jaxp/validation/ValidatorHandlerImpl.java

xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/jaxp/validation/ValidatorImpl.java

xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/jaxp/validation/XMLSchemaValidatorComponentManager.java

Modified: 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/jaxp/validation/ValidatorHandlerImpl.java
URL: 
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/jaxp/validation/ValidatorHandlerImpl.java?rev=1198620&r1=1198619&r2=1198620&view=diff
==
--- 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/jaxp/validation/ValidatorHandlerImpl.java
 (original)
+++ 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/jaxp/validation/ValidatorHandlerImpl.java
 Mon Nov  7 04:02:43 2011
@@ -135,6 +135,10 @@ final class ValidatorHandlerImpl extends
 /** Property identifier: validation manager. */
 private static final String VALIDATION_MANAGER =
 Constants.XERCES_PROPERTY_PREFIX + 
Constants.VALIDATION_MANAGER_PROPERTY;
+
+/** Property identifier: xml schema version. */
+private static final String XML_SCHEMA_VERSION =
+Constants.XERCES_PROPERTY_PREFIX + 
Constants.XML_SCHEMA_VERSION_PROPERTY;
  
 //
 // Data
@@ -321,6 +325,11 @@ final class ValidatorHandlerImpl extends
 throw new 
NullPointerException(JAXPValidationMessageFormatter.formatMessage(fComponentManager.getLocale(),
 
 "ProperyNameNull", null));
 }
+if (XML_SCHEMA_VERSION.equals(name)) {
+throw new SAXNotSupportedException(
+
SAXMessageFormatter.formatMessage(fComponentManager.getLocale(), 
+"property-read-only", new Object [] {name}));
+}
 try {
 fComponentManager.setProperty(name, object);
 }

Modified: 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/jaxp/validation/ValidatorImpl.java
URL: 
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/jaxp/validation/ValidatorImpl.java?rev=1198620&r1=1198619&r2=1198620&view=diff
==
--- 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/jaxp/validation/ValidatorImpl.java
 (original)
+++ 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/jaxp/validation/ValidatorImpl.java
 Mon Nov  7 04:02:43 2011
@@ -64,6 +64,10 @@ final class ValidatorImpl extends Valida
 private static final String CURRENT_ELEMENT_NODE =
 Constants.XERCES_PROPERTY_PREFIX + 
Constants.CURRENT_ELEMENT_NODE_PROPERTY;
 
+/** Property identifier: xml schema version. */
+private static final String XML_SCHEMA_VERSION =
+Constants.XERCES_PROPERTY_PREFIX + 
Constants.XML_SCHEMA_VERSION_PROPERTY;
+
 //
 // Data
 //
@@ -268,7 +272,7 @@ final class ValidatorImpl extends Valida
 throw new 
NullPointerException(JAXPValidationMessageFormatter.formatMessage(fComponentManager.getLocale(),
 
 "ProperyNameNull", null));
 }
-if (CURRENT_ELEMENT_NODE.equals(name)) {
+if (CURRENT_ELEMENT_NODE.equals(name) || 
XML_SCHEMA_VERSION.equals(name)) {
 throw new SAXNotSupportedException(
 
SAXMessageFormatter.formatMessage(fComponentManager.getLocale(), 
 "property-read-only", new Object [] {name}));

Modified: 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/jaxp/validation/XMLSchemaValidatorComponentManager.java
URL: 
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/jaxp/validation/XMLSchemaValidatorComponentManager.java?rev=1198620&r1=1198619&r2=1198620&view=diff
==
--- 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/jaxp/validation/XMLSchemaValidatorComponentManager.java
 (original)
+++ 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/jaxp/validation/XMLSchemaValidatorComponentManager.java
 Mon Nov  7 04:02:43 2011
@@ -173,6 +173,9 @@ final class XMLSchemaValidatorComponentM
  */
 private boolean fUseGrammarPoolOnly;
 
+/** Whether the XML Schema is 1.1 or not */
+private final String fXSDVersion;
+
 /** Lookup map for compone

svn commit: r1198610 - /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/jaxp/validation/XMLSchemaValidatorComponentManager.java

2011-11-06 Thread mrglavas
Author: mrglavas
Date: Mon Nov  7 03:26:12 2011
New Revision: 1198610

URL: http://svn.apache.org/viewvc?rev=1198610&view=rev
Log:
Consistency. All other static fields in this class are final.

Modified:

xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/jaxp/validation/XMLSchemaValidatorComponentManager.java

Modified: 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/jaxp/validation/XMLSchemaValidatorComponentManager.java
URL: 
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/jaxp/validation/XMLSchemaValidatorComponentManager.java?rev=1198610&r1=1198609&r2=1198610&view=diff
==
--- 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/jaxp/validation/XMLSchemaValidatorComponentManager.java
 (original)
+++ 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/jaxp/validation/XMLSchemaValidatorComponentManager.java
 Mon Nov  7 03:26:12 2011
@@ -154,7 +154,7 @@ final class XMLSchemaValidatorComponentM
 Constants.XERCES_PROPERTY_PREFIX + Constants.LOCALE_PROPERTY;
 
 /** Property identifier: xml schema version. */
-protected static final String XML_SCHEMA_VERSION =
+private static final String XML_SCHEMA_VERSION =
 Constants.XERCES_PROPERTY_PREFIX + 
Constants.XML_SCHEMA_VERSION_PROPERTY;
 
 //



-
To unsubscribe, e-mail: commits-unsubscr...@xerces.apache.org
For additional commands, e-mail: commits-h...@xerces.apache.org



svn commit: r1198396 - in /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl: msg/XMLSchemaMessages.properties xs/AbstractPsychoPathXPath2Impl.java xs/SchemaSymbols.java xs/traversers

2011-11-06 Thread mukulg
Author: mukulg
Date: Sun Nov  6 16:12:05 2011
New Revision: 1198396

URL: http://svn.apache.org/viewvc?rev=1198396&view=rev
Log:
schema 1.1 commit:
similar to the assertions behavior when, the XPath expression contains tokens 
'/' or '//' we used to raise warning for the schema (since an assert XDM tree 
is rooted at a parentless element), i've implemented the same behavior for CTA 
while working in XPath full mode (where that's also the case; the CTA XDM tree 
is also rooted at a parentless element).

there are also few minor refactoring code base changes.

Modified:

xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties

xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/AbstractPsychoPathXPath2Impl.java

xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/SchemaSymbols.java

xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDTypeAlternativeTraverser.java

Modified: 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties
URL: 
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties?rev=1198396&r1=1198395&r2=1198396&view=diff
==
--- 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties
 (original)
+++ 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties
 Sun Nov  6 16:12:05 2011
@@ -112,7 +112,7 @@
 cvc-assertions-valid-union-elem = cvc-assertions-valid-union-elem: 
Value ''{0}'' is not facet-valid with respect to the specified assertions, on 
type ''{2}'' on element ''{1}''.
 cvc-assertions-valid-union-attr = cvc-assertions-valid-union-attr: 
Value ''{0}'' is not facet-valid with respect to the specified assertions, on 
type ''{3}'' on attribute ''{2}'/@'{1}''. 
 cvc-xpath.3.13.4.2a = cvc-xpath.3.13.4.2a: XPST0003 - Assertion XPath 
expression (''{0}'') on the schema type ''{1}'' couldn''t compile successfully.
-cvc-xpath.3.13.4.2b = cvc-xpath.3.13.4.2b: An assert XPath expression 
such as (''{0}'') beginning with / or //, on the schema type ''{1}'', cannot 
yield a valid node (since an assert tree is rooted at a parentless element).
+cvc-xpath.3.13.4.2b = cvc-xpath.3.13.4.2b: An assert XPath expression 
such as (''{0}'') containing / or //, on the schema type ''{1}'', cannot yield 
a valid result (since an assert tree is rooted at a parentless element).
 
 #schema valid (3.X.3)
 
@@ -349,6 +349,7 @@
 c-general-xpath = c-general-xpath: The expression ''{0}'' is not valid 
with respect to the XPath subset supported by XML Schema.
 c-general-xpath-ns = c-general-xpath-ns: A namespace prefix in XPath 
expression ''{0}'' was not bound to a namespace.
 c-cta-xpath = c-cta-xpath: The XPath expression ''{0}'' couldn''t 
compile successfully in ''{1}'' mode, during CTA evaluation.
+c-cta-xpath-b = c-cta-xpath-b: The CTA XPath expression such as 
(''{0}'') containing / or //, while in ''{1}'' mode, cannot yield a valid 
result (since a CTA tree is rooted at a parentless element).
 c-cta-xpath-serr = c-cta-xpath-serr: The XPath expression ''{0}'' 
couldn''t compile successfully in ''{1}'' mode, during CTA evaluation. A static 
error ''{2}'' occured in the XPath expression.  
 c-selector-xpath = c-selector-xpath: The selector value = ''{0}'' is 
not valid; selector xpaths cannot contain attributes.
 EmptyTargetNamespace = EmptyTargetNamespace: In schema document 
''{0}'', the value of the ''targetNamespace'' attribute cannot be an empty 
string.

Modified: 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/AbstractPsychoPathXPath2Impl.java
URL: 
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/AbstractPsychoPathXPath2Impl.java?rev=1198396&r1=1198395&r2=1198396&view=diff
==
--- 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/AbstractPsychoPathXPath2Impl.java
 (original)
+++ 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/AbstractPsychoPathXPath2Impl.java
 Sun Nov  6 16:12:05 2011
@@ -162,8 +162,8 @@ public class AbstractPsychoPathXPath2Imp
 try {
 xpathObject = xpathParser.parse("boolean(" + xpathStr + ")", true);
 } catch (XPathParserException ex) {
-// error compiling XPath expression
-if 
(SchemaSymbols.ASSERT_XPATHEXPR_COMPILE_ERR_MESG_1.equals(ex.getMessage())) {   

+// XPath parser exception
+if 
(SchemaSymbols.XS11_XPATHEXPR_COMPILE_WRN_MESG_1.equals(ex.getMessage())) { 
  
 fSchemaH