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/XSDAssertionValidator.java
Mon Nov 7 13:02:34 2011
@@ -142,6 +142,26 @@ public class XSDAssertionValidator {
/*
+ * Assertions processing interface during the XNI event, 'comment' in
XMLSchemaValidator.
+ */
+ public void comment(XMLString text) {
+ if (fAssertionProcessor != null) {
+ fAssertionProcessor.comment(text);
+ }
+ } // comment
+
+
+ /*
+ * Assertions processing interface during the XNI event,
'processingInstruction' in XMLSchemaValidator.
+ */
+ public void processingInstruction(String target, XMLString data) {
+ if (fAssertionProcessor != null) {
+ fAssertionProcessor.processingInstruction(target, data);
+ }
+ } // processingInstruction
+
+
+ /*
* Accumulate a list of assertions (get from the underlying XSModel
instance) to be processed
* for the current context. Return the assertions list.
*/
Modified:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/assertion/XMLAssertAdapter.java
URL:
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/assertion/XMLAssertAdapter.java?rev=1198718&r1=1198717&r2=1198718&view=diff
==============================================================================
---
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/assertion/XMLAssertAdapter.java
(original)
+++
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/assertion/XMLAssertAdapter.java
Mon Nov 7 13:02:34 2011
@@ -53,6 +53,16 @@ public class XMLAssertAdapter extends XS
}
+ public void comment(XMLString text) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void processingInstruction(String target, XMLString data) {
+ // TODO Auto-generated method stub
+
+ }
+
/**
* Allows the user to set specific properties on the underlying
implementation.
* @param name name of property
@@ -97,4 +107,4 @@ public class XMLAssertAdapter extends XS
return null;
}
-}
+} // class XMLAssertAdapter
Modified:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/assertion/XMLAssertHandler.java
URL:
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/assertion/XMLAssertHandler.java?rev=1198718&r1=1198717&r2=1198718&view=diff
==============================================================================
---
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/assertion/XMLAssertHandler.java
(original)
+++
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/assertion/XMLAssertHandler.java
Mon Nov 7 13:02:34 2011
@@ -38,7 +38,7 @@ import org.apache.xerces.xni.XMLString;
public interface XMLAssertHandler extends XSAssertionXPath2Value {
/*
- * A callback method triggered during startElement method call in,
XMLSchemaValidator
+ * A callback method triggered during "startElement" method call in,
XMLSchemaValidator
*
* @param element
* XML element
@@ -50,7 +50,7 @@ public interface XMLAssertHandler extend
public void startElement(QName element, XMLAttributes attributes,
Augmentations augs) throws Exception;
/*
- * A callback method triggered during endElement method call in,
XMLSchemaValidator
+ * A callback method triggered during "endElement" method call in,
XMLSchemaValidator
*
* @param element
* XML element
@@ -60,12 +60,30 @@ public interface XMLAssertHandler extend
public void endElement(QName element, Augmentations augs) throws Exception;
/*
- * A callback method triggered during characters method call in,
XMLSchemaValidator
+ * A callback method triggered during "characters" method call in,
XMLSchemaValidator
*
* @param text
* Text data received during the call
*/
public void characters(XMLString text);
+
+ /*
+ * A callback method triggered during "comment" method call in,
XMLSchemaValidator
+ *
+ * @param text
+ * The text in the comment
+ */
+ public void comment(XMLString text);
+
+ /*
+ * A callback method triggered during "processingInstruction" method call
in, XMLSchemaValidator
+ *
+ * @param target
+ * The target
+ * @param data
+ * The data or null if none specified
+ */
+ public void processingInstruction(String target, XMLString data);
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]