svn commit: r1199108 - /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/jaxp/validation/StAXValidatorHelper.java
Author: mrglavas Date: Tue Nov 8 05:03:03 2011 New Revision: 1199108 URL: http://svn.apache.org/viewvc?rev=1199108&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 the 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/StAXValidatorHelper.java Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/jaxp/validation/StAXValidatorHelper.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/jaxp/validation/StAXValidatorHelper.java?rev=1199108&r1=1199107&r2=1199108&view=diff == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/jaxp/validation/StAXValidatorHelper.java (original) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/jaxp/validation/StAXValidatorHelper.java Tue Nov 8 05:03:03 2011 @@ -93,6 +93,10 @@ final class StAXValidatorHelper implemen 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 // @@ -148,13 +152,16 @@ final class StAXValidatorHelper implemen /** Current event. **/ private XMLEvent fCurrentEvent = null; -/** 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 ArrayList fDeclaredPrefixes = new ArrayList(); final XMLString fTempString = new XMLString(); final XMLStringBuffer fStringBuffer = new XMLStringBuffer(); + +/** Flag indicating whether the schema version is 1.1. */ +private final boolean fIsXSD11; public StAXValidatorHelper(XMLSchemaValidatorComponentManager componentManager) { fComponentManager = componentManager; @@ -164,6 +171,7 @@ final class StAXValidatorHelper implemen fValidationManager = (ValidationManager) fComponentManager.getProperty(VALIDATION_MANAGER); fNamespaceContext = new JAXPNamespaceContextWrapper(fSymbolTable); fNamespaceContext.setDeclaredPrefixes(fDeclaredPrefixes); +fIsXSD11 = Constants.W3C_XML_SCHEMA11_NS_URI.equals(fComponentManager.getProperty(XML_SCHEMA_VERSION)); } /* @@ -395,11 +403,30 @@ final class StAXValidatorHelper implemen } break; case XMLStreamConstants.PROCESSING_INSTRUCTION: +// The XSD 1.0 validator does nothing with processing instructions so bypass it unless it's 1.1. +if (fIsXSD11) { +String data = reader.getPIData(); +if (data != null) { +fTempString.setValues(data.toCharArray(), 0, data.length()); +} +else { +fTempString.setValues(new char[0], 0, 0); +} + fSchemaValidator.processingInstruction(reader.getPITarget(), fTempString, null); +} +// Send the processing instruction event directly to the StAXDocumentHandler. if (fStAXValidatorHandler != null) { fStAXValidatorHandler.processingInstruction(reader); } break; case XMLStreamConstants.COMMENT: +// The XSD 1.0 validator does nothing with comments so bypass it unless it's 1.1. +if (fIsXSD11) { + fTempString.setValues(reader.getTextCharacters(), +reader.getTextStart(), reader.getTextLength()); +fSchemaValidator.comment(fTempString, null); +} +// Send the comment event directly to the StAXDocumentHandler. if (fStAXValidatorHandler != null) { fStAXValidatorHandler.comment(reader); } @@ -549,11 +576,25 @@ final class StAXValidatorHelper implemen }
svn commit: r1198750 - /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/jaxp/validation/ValidatorHandlerImpl.java
Author: mrglavas Date: Mon Nov 7 14:31:27 2011 New Revision: 1198750 URL: http://svn.apache.org/viewvc?rev=1198750&view=rev Log: Updating a comment. Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/jaxp/validation/ValidatorHandlerImpl.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=1198750&r1=1198749&r2=1198750&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 14:31:27 2011 @@ -174,7 +174,7 @@ final class ValidatorHandlerImpl extends /** Flag used to track whether XML names and Namespace URIs have been internalized. */ private boolean fStringsInternalized = false; -/** Fields for start element, end element and characters. */ +/** Fields for start element, end element, characters, comments and processing instructions. **/ private final QName fElementQName = new QName(); private final QName fAttributeQName = new QName(); private final XMLAttributesImpl fAttributes = new XMLAttributesImpl(); - To unsubscribe, e-mail: commits-unsubscr...@xerces.apache.org For additional commands, e-mail: commits-h...@xerces.apache.org
[Xerces Wiki] Update of "xmlschema11TestSuiteReports" by Mukul Gandhi
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Xerces Wiki" for change notification. The "xmlschema11TestSuiteReports" page has been changed by Mukul Gandhi: http://wiki.apache.org/xerces/xmlschema11TestSuiteReports?action=diff&rev1=50&rev2=51 Comment: updating aggregate test results after latest changes to code base '''__XERCES XML Schema 1.1 test-suite results__''' - Xerces SVN Revision: 1195303 + Xerces SVN Revision: 1198720 (1) __Xerces running IBM XML Schema 1.1 Tests__ @@ -19, +19 @@ ''Summary'': ||Total Tests ||Tests passed ||Success % || - ||1286 ||1280 ||99.53 || + ||1286 ||1281 ||99.61 || @@ -28, +28 @@ '''Overall Test Suite run status:''' ||Total Tests ||Tests passed ||Success % || - ||2205 ||2199 ||99.73 || + ||2205 ||2200 ||99.77 || - To unsubscribe, e-mail: commits-unsubscr...@xerces.apache.org For additional commands, e-mail: commits-h...@xerces.apache.org
[Xerces Wiki] Update of "xmlschema11SaxonicaTests" by Mukul Gandhi
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Xerces Wiki" for change notification. The "xmlschema11SaxonicaTests" page has been changed by Mukul Gandhi: http://wiki.apache.org/xerces/xmlschema11SaxonicaTests?action=diff&rev1=43&rev2=44 Comment: updating saxon test results after latest changes to code base || || ||<:>assert023|| || || || || ||<:>74.|| || ||<:>assert023.xsd|| ||<: #ccff99>valid||<: #ccff99>valid|| ||<:>75.|| || || ||<:>assert023.v1.xml||<: #ccff99>valid||<: #ccff99>valid|| - ||<:>76.|| || || ||<:>assert023.n1.xml||<: #ffcc99>invalid||<: #ffcc99>valid|| + ||<:>76.|| || || ||<:>assert023.n1.xml||<: #ccff99>invalid||<: #ccff99>invalid|| || || ||<:>assert-simple001|| || || || || ||<:>77.|| || ||<:>assert-simple001.xsd|| ||<: #ccff99>valid||<: #ccff99>valid|| ||<:>78.|| || || ||<:>assert-simple001.v1.xml||<: #ccff99>valid||<: #ccff99>valid|| - To unsubscribe, e-mail: commits-unsubscr...@xerces.apache.org For additional commands, e-mail: commits-h...@xerces.apache.org
svn commit: r1198720 - /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/jaxp/validation/ValidatorHandlerImpl.java
Author: mrglavas Date: Mon Nov 7 13:14:30 2011 New Revision: 1198720 URL: http://svn.apache.org/viewvc?rev=1198720&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/ValidatorHandlerImpl.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=1198720&r1=1198719&r2=1198720&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 13:14:30 2011 @@ -90,7 +90,7 @@ import org.xml.sax.ext.LexicalHandler; * @version $Id$ */ final class ValidatorHandlerImpl extends ValidatorHandler implements -DTDHandler, EntityState, PSVIProvider, ValidatorHelper, XMLDocumentHandler { +DTDHandler, EntityState, LexicalHandler, PSVIProvider, ValidatorHelper, XMLDocumentHandler { // feature identifiers @@ -181,11 +181,15 @@ final class ValidatorHandlerImpl extends private final AttributesProxy fAttrAdapter = new AttributesProxy(fAttributes); private final XMLString fTempString = new XMLString(); +/** Flag indicating whether the schema version is 1.1. */ +private final boolean fIsXSD11; + // // User Objects // private ContentHandler fContentHandler = null; +private LexicalHandler fLexicalHandler = null; /* * Constructors @@ -206,6 +210,7 @@ final class ValidatorHandlerImpl extends 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)); } /* @@ -389,16 +394,7 @@ final class ValidatorHandlerImpl extends public void comment(XMLString text, Augmentations augs) throws XNIException {} public void processingInstruction(String target, XMLString data, -Augmentations augs) throws XNIException { -if (fContentHandler != null) { -try { -fContentHandler.processingInstruction(target, data.toString()); -} -catch (SAXException e) { -throw new XNIException(e); -} -} -} +Augmentations augs) throws XNIException {} public void startElement(QName element, XMLAttributes attributes, Augmentations augs) throws XNIException { @@ -652,11 +648,17 @@ final class ValidatorHandlerImpl extends public void processingInstruction(String target, String data) throws SAXException { -/** - * Processing instructions do not participate in schema validation, - * so just forward the event to the application's content - * handler. - */ +// The XSD 1.0 validator does nothing with processing instructions so bypass it unless it's 1.1. +if (fIsXSD11) { +if (data != null) { +fTempString.setValues(data.toCharArray(), 0, data.length()); +} +else { +fTempString.setValues(new char[0], 0, 0); +} +fSchemaValidator.processingInstruction(target, fTempString, null); +} +// Send the processing instruction event directly to the application's ContentHandler. if (fContentHandler != null) { fContentHandler.processingInstruction(target, data); } @@ -686,6 +688,59 @@ final class ValidatorHandlerImpl extends } /* + * LexicalHandler methods + */ + +public void comment(char[] ch, int start, int length) throws SAXException { +// The XSD 1.0 validator does nothing with comments so bypass it unless it's 1.1. +if (fIsXSD11) { +fTempString.setValues(ch, start, length); +fSchemaValidator.comment(fTempString, null); +} +// Send the comment event directly to the application's LexicalHandler. +if (fLexicalHandler != null) { +fLexicalHandler.comment(ch, start, length); +} +} + +public void endCDATA() throws SAXException { +if (fLexicalHandler != null) { +fLexicalHandler.endCDATA(); +} +} + +
svn commit: r1198718 - in /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs: XMLAssertPsychopathXPath2Impl.java XMLSchemaValidator.java XSDAssertionValidator.java assertion/XMLAss
Author: mukulg Date: Mon Nov 7 13:02:34 2011 New Revision: 1198718 URL: http://svn.apache.org/viewvc?rev=1198718&view=rev Log: adding support for comment and PI nodes for XML Schema 1.1 assert XDM trees. this was possible after yesterday's enhancement by Michael Glavassevich adding support for this in earlier stages of XSD validation pipeline. Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLAssertPsychopathXPath2Impl.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSDAssertionValidator.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/assertion/XMLAssertAdapter.java xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/assertion/XMLAssertHandler.java Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLAssertPsychopathXPath2Impl.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLAssertPsychopathXPath2Impl.java?rev=1198718&r1=1198717&r2=1198718&view=diff == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLAssertPsychopathXPath2Impl.java (original) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLAssertPsychopathXPath2Impl.java Mon Nov 7 13:02:34 2011 @@ -76,7 +76,7 @@ import org.w3c.dom.Element; public class XMLAssertPsychopathXPath2Impl extends XMLAssertAdapter { // class fields declarations - + // XSModel instance representing the schema information needed by PsychoPath XPath 2.0 engine private XSModel fSchemaXSmodel = null; @@ -251,6 +251,28 @@ public class XMLAssertPsychopathXPath2Im } // endElement +/* (non-Javadoc) + * @see org.apache.xerces.impl.xs.assertion.XMLAssertAdapter#comment(org.apache.xerces.xni.XMLString) + */ +public void comment(XMLString text) { +// add a comment node to the assertions, DOM tree +if (fCurrentAssertDomNode != null) { + fCurrentAssertDomNode.appendChild(fAssertDocument.createComment(new String(text.ch, text.offset, text.length))); +} +} // comment + + +/* (non-Javadoc) + * @see org.apache.xerces.impl.xs.assertion.XMLAssertAdapter#processingInstruction(java.lang.String, org.apache.xerces.xni.XMLString) + */ +public void processingInstruction(String target, XMLString data) { +// add a PI node to the assertions, DOM tree +if (fCurrentAssertDomNode != null) { + fCurrentAssertDomNode.appendChild(fAssertDocument.createProcessingInstruction(target, new String(data.ch, data.offset, data.length))); +} +} // processingInstruction + + /* * set value of [failed assertions] PSVI property. */ Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java?rev=1198718&r1=1198717&r2=1198718&view=diff == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java (original) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java Mon Nov 7 13:02:34 2011 @@ -1145,6 +1145,10 @@ public class XMLSchemaValidator */ public void comment(XMLString text, Augmentations augs) throws XNIException { +if (fSchemaVersion == Constants.SCHEMA_VERSION_1_1) { +fAssertionValidator.comment(text); +} + // call handlers if (fDocumentHandler != null) { fDocumentHandler.comment(text, augs); @@ -1171,6 +1175,10 @@ public class XMLSchemaValidator */ public void processingInstruction(String target, XMLString data, Augmentations augs) throws XNIException { + +if (fSchemaVersion == Constants.SCHEMA_VERSION_1_1) { +fAssertionValidator.processingInstruction(target, data); +} // call handlers if (fDocumentHandler != null) { Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSDAssertionValidator.java URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSDAssertionValidator.java?rev=1198718&r1=1198717&r2=1198718&view=diff == --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSDAssertionValidator.java (original) +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSDAssertionValidato