You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by kn...@apache.org on 2010/05/27 23:35:07 UTC
svn commit: r949005 - /xerces/java/trunk/docs/faq-xs.xml
Author: knoaman
Date: Thu May 27 21:35:07 2010
New Revision: 949005
URL: http://svn.apache.org/viewvc?rev=949005&view=rev
Log:
Update FAQ to explain how validate against XML Schema 1.1
Modified:
xerces/java/trunk/docs/faq-xs.xml
Modified: xerces/java/trunk/docs/faq-xs.xml
URL: http://svn.apache.org/viewvc/xerces/java/trunk/docs/faq-xs.xml?rev=949005&r1=949004&r2=949005&view=diff
==============================================================================
--- xerces/java/trunk/docs/faq-xs.xml (original)
+++ xerces/java/trunk/docs/faq-xs.xml Thu May 27 21:35:07 2010
@@ -21,9 +21,24 @@
<faq title="Usage">
<q>How do I validate against XML schema?</q>
<a>
- <p>In this release, schema validation has been integrated with the
+ <p>XML Schema 1.0 validation has been integrated with the
regular SAXParser and DOMParser classes. No special classes are
required to parse documents that use a schema.</p>
+ <p>For XML Schema 1.1 validation, you'll need to use the JAXP
+ validation API, using the XSD 1.1 Schema factory. Here's an example: </p>
+ <source>
+System.setProperty("
+javax.xml.validation.SchemaFactory:http://www.w3.org/XML/XMLSchema/v1.1",
+"org.apache.xerces.jaxp.validation.XMLSchema11Factory");
+SchemaFactory sf = SchemaFactory.newInstance(
+ "http://www.w3.org/XML/XMLSchema/v1.1");
+Schema s = sf.newSchema(new StreamSource(args[1]));
+Validator v = s.newValidator();
+v.validate(new StreamSource(args[0]));
+ </source>
+ <p>You can also refer to the JAXP sample, SourceValidator, where you
+ can validate xml documents against 1.1 schemas by specifying the "-xsd11"
+ flag when running the sample.</p>
<p>Each document that uses XML Schema grammars must specify the location of the
grammars it uses by using an xsi:schemaLocation attribute if they use
namespaces, and an xsi:noNamespaceSchemaLocation attribute
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org