You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by mu...@apache.org on 2012/01/11 09:17:21 UTC
svn commit: r1229926 - in /xerces/java/branches/xml-schema-1.1-dev:
docs/samples-jaxp.xml samples/jaxp/SourceValidator.java
Author: mukulg
Date: Wed Jan 11 08:17:21 2012
New Revision: 1229926
URL: http://svn.apache.org/viewvc?rev=1229926&view=rev
Log:
adding following two new options to jaxp.SourceValidator sample,
a) -fx : for enabling full XPath2 support for XSD 1.1 CTA evaluations
b) -acp : for enabling comments and PIs to be recognized during XSD 1.1 <assert> processing
I hope these additions to this sample are useful. Updating corresponding docs as well for these changes.
Modified:
xerces/java/branches/xml-schema-1.1-dev/docs/samples-jaxp.xml
xerces/java/branches/xml-schema-1.1-dev/samples/jaxp/SourceValidator.java
Modified: xerces/java/branches/xml-schema-1.1-dev/docs/samples-jaxp.xml
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/docs/samples-jaxp.xml?rev=1229926&r1=1229925&r2=1229926&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/docs/samples-jaxp.xml (original)
+++ xerces/java/branches/xml-schema-1.1-dev/docs/samples-jaxp.xml Wed Jan 11 08:17:21 2012
@@ -119,6 +119,14 @@
</tr>
<tr><td>-m | -M</td><td>Turn on/off memory usage report.</td></tr>
<tr><td>-xsd11</td><td>Turn on/off XSD 1.1 support.</td></tr>
+ <tr>
+ <td>-fx</td>
+ <td>Turn on/off full XPath 2.0 checks with CTA when working with XSD 1.1.</td>
+ </tr>
+ <tr>
+ <td>-acp</td>
+ <td>Turn on/off assert comments and PI processing when working with XSD 1.1.</td>
+ </tr>
<tr><td>-h</td><td>Display help screen.</td></tr>
</table>
</s3>
Modified: xerces/java/branches/xml-schema-1.1-dev/samples/jaxp/SourceValidator.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/samples/jaxp/SourceValidator.java?rev=1229926&r1=1229925&r2=1229926&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/samples/jaxp/SourceValidator.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/samples/jaxp/SourceValidator.java Wed Jan 11 08:17:21 2012
@@ -88,6 +88,12 @@ public class SourceValidator
/** Generate synthetic schema annotations feature id (http://apache.org/xml/features/generate-synthetic-annotations). */
protected static final String GENERATE_SYNTHETIC_ANNOTATIONS_ID = "http://apache.org/xml/features/generate-synthetic-annotations";
+ /** XSD 1.1 CTA full XPath checking feature id (http://apache.org/xml/features/validation/cta-full-xpath-checking). */
+ protected static final String XS11_CTA_FULL_XPATH_CHECKING_ID = "http://apache.org/xml/features/validation/cta-full-xpath-checking";
+
+ /** XSD 1.1 assert comments and PI checking feature id (http://apache.org/xml/features/validation/assert-comments-and-pi-checking). */
+ protected static final String XS11_ASSERT_COMMENT_PI_CHECKING_ID = "http://apache.org/xml/features/validation/assert-comments-and-pi-checking";
+
// property ids
/** StAX support for reporting line and column numbers property id (javax.xml.stream.isSupportingLocationCoordinates). */
@@ -119,6 +125,12 @@ public class SourceValidator
/** Default generate synthetic schema annotations (false). */
protected static final boolean DEFAULT_GENERATE_SYNTHETIC_ANNOTATIONS = false;
+ /** Default XSD 1.1 CTA full XPath 2.0 checking (false). */
+ protected static final boolean DEFAULT_XS11_CTA_XPATH_FULL_CHECKING = false;
+
+ /** Default XSD 1.1 assert comments and PI checking (false). */
+ protected static final boolean DEFAULT_XS11_ASSERT_COMMENT_PI_CHECKING = false;
+
/** Default memory usage report (false). */
protected static final boolean DEFAULT_MEMORY_USAGE = false;
@@ -310,6 +322,8 @@ public class SourceValidator
boolean honourAllSchemaLocations = DEFAULT_HONOUR_ALL_SCHEMA_LOCATIONS;
boolean validateAnnotations = DEFAULT_VALIDATE_ANNOTATIONS;
boolean generateSyntheticAnnotations = DEFAULT_GENERATE_SYNTHETIC_ANNOTATIONS;
+ boolean xs11CtaFullxpathchecking = DEFAULT_XS11_CTA_XPATH_FULL_CHECKING;
+ boolean xs11AssertCommentsAndPIchecking = DEFAULT_XS11_ASSERT_COMMENT_PI_CHECKING;
boolean memoryUsage = DEFAULT_MEMORY_USAGE;
// process arguments
@@ -399,6 +413,14 @@ public class SourceValidator
generateSyntheticAnnotations = option.equals("ga");
continue;
}
+ if (option.equalsIgnoreCase("fx")) {
+ xs11CtaFullxpathchecking = option.equals("fx");
+ continue;
+ }
+ if (option.equalsIgnoreCase("acp")) {
+ xs11AssertCommentsAndPIchecking = option.equals("acp");
+ continue;
+ }
if (option.equalsIgnoreCase("m")) {
memoryUsage = option.equals("m");
continue;
@@ -457,6 +479,18 @@ public class SourceValidator
System.err.println("warning: SchemaFactory does not support feature ("+GENERATE_SYNTHETIC_ANNOTATIONS_ID+")");
}
+ if (XSD11_SCHEMA_LANGUAGE.equals(schemaLanguage)) {
+ try {
+ factory.setFeature(XS11_CTA_FULL_XPATH_CHECKING_ID, xs11CtaFullxpathchecking);
+ }
+ catch (SAXNotRecognizedException e) {
+ System.err.println("warning: SchemaFactory does not recognize feature ("+XS11_CTA_FULL_XPATH_CHECKING_ID+")");
+ }
+ catch (SAXNotSupportedException e) {
+ System.err.println("warning: SchemaFactory does not support feature ("+XS11_CTA_FULL_XPATH_CHECKING_ID+")");
+ }
+ }
+
// Build Schema from sources
Schema schema;
if (schemas != null && schemas.size() > 0) {
@@ -511,7 +545,19 @@ public class SourceValidator
catch (SAXNotSupportedException e) {
System.err.println("warning: Validator does not support feature ("+GENERATE_SYNTHETIC_ANNOTATIONS_ID+")");
}
-
+
+ if (XSD11_SCHEMA_LANGUAGE.equals(schemaLanguage)) {
+ try {
+ validator.setFeature(XS11_ASSERT_COMMENT_PI_CHECKING_ID, xs11AssertCommentsAndPIchecking);
+ }
+ catch (SAXNotRecognizedException e) {
+ System.err.println("warning: Validator does not recognize feature ("+XS11_ASSERT_COMMENT_PI_CHECKING_ID+")");
+ }
+ catch (SAXNotSupportedException e) {
+ System.err.println("warning: Validator does not support feature ("+XS11_ASSERT_COMMENT_PI_CHECKING_ID+")");
+ }
+ }
+
// Validate instance documents
if (instances != null && instances.size() > 0) {
final int length = instances.size();
@@ -593,16 +639,20 @@ public class SourceValidator
System.err.println(" -a uri ... Provide a list of schema documents");
System.err.println(" -i uri ... Provide a list of instance documents to validate");
System.err.println(" -vs source Select validation source (sax|dom|stax|stream)");
- System.err.println(" -f | -F Turn on/off Schema full checking.");
+ System.err.println(" -f | -F Turn on/off Schema full checking.");
System.err.println(" NOTE: Not supported by all schema factories and validators.");
- System.err.println(" -hs | -HS Turn on/off honouring of all schema locations.");
+ System.err.println(" -hs | -HS Turn on/off honouring of all schema locations.");
System.err.println(" NOTE: Not supported by all schema factories and validators.");
- System.err.println(" -va | -VA Turn on/off validation of schema annotations.");
+ System.err.println(" -va | -VA Turn on/off validation of schema annotations.");
System.err.println(" NOTE: Not supported by all schema factories and validators.");
- System.err.println(" -ga | -GA Turn on/off generation of synthetic schema annotations.");
+ System.err.println(" -ga | -GA Turn on/off generation of synthetic schema annotations.");
System.err.println(" NOTE: Not supported by all schema factories and validators.");
- System.err.println(" -m | -M Turn on/off memory usage report");
+ System.err.println(" -m | -M Turn on/off memory usage report");
System.err.println(" -xsd11 Turn on/off XSD 1.1 support.");
+ System.err.println(" -fx Turn on/off full XPath 2.0 checks with CTA when working");
+ System.err.println(" with XSD 1.1.");
+ System.err.println(" -acp Turn on/off assert comments and PI processing when working");
+ System.err.println(" with XSD 1.1.");
System.err.println(" -h This help screen.");
System.err.println();
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org