Author: mukulg
Date: Sun Jan 24 12:49:50 2010
New Revision: 902557
URL: http://svn.apache.org/viewvc?rev=902557&view=rev
Log:
Enhancement to the jaxp.SourceValidator sample, to support XSD 1.1 (JIRA issue,
XERCESJ-1414).
Modified:
xerces/java/branches/xml-schema-1.1-dev/samples/jaxp/SourceValidator.java
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=902557&r1=902556&r2=902557&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
Sun Jan 24 12:49:50 2010
@@ -98,6 +98,9 @@
/** Default schema language (http://www.w3.org/2001/XMLSchema). */
protected static final String DEFAULT_SCHEMA_LANGUAGE =
XMLConstants.W3C_XML_SCHEMA_NS_URI;
+ /** XSD 1.1 schema language */
+ protected static final String XSD11_SCHEMA_LANGUAGE =
"http://www.w3.org/2001/XMLSchema/v1.1";
+
/** Default repetition (1). */
protected static final int DEFAULT_REPETITION = 1;
@@ -396,6 +399,12 @@
memoryUsage = option.equals("m");
continue;
}
+ if (option.equals("xsd11")) {
+ schemaLanguage = XSD11_SCHEMA_LANGUAGE;
+
System.setProperty("javax.xml.validation.SchemaFactory:http://www.w3.org/2001/XMLSchema/v1.1",
+
"org.apache.xerces.jaxp.validation.XMLSchema11Factory");
+ continue;
+ }
if (option.equals("h")) {
printUsage();
continue;
@@ -410,7 +419,7 @@
SourceValidator sourceValidator = new SourceValidator();
// Create SchemaFactory and configure
- SchemaFactory factory = SchemaFactory.newInstance(schemaLanguage);
+ SchemaFactory factory = SchemaFactory.newInstance(schemaLanguage);
factory.setErrorHandler(sourceValidator);
try {
@@ -595,6 +604,7 @@
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(" -xsd11 Turn on XSD 1.1 support");
System.err.println(" -h This help screen.");
System.err.println();
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]