[prev in list] [next in list] [prev in thread] [next in thread]
List: xerces-cvs
Subject: svn commit: r949902 - /xerces/java/trunk/docs/faq-xs.xml
From: mrglavas () apache ! org
Date: 2010-05-31 23:47:22
Message-ID: 20100531234722.9BD6523889F1 () eris ! apache ! org
[Download RAW message or body]
Author: mrglavas
Date: Mon May 31 23:47:22 2010
New Revision: 949902
URL: http://svn.apache.org/viewvc?rev=949902&view=rev
Log:
Improvements to the XML Schema 1.1 usage example.
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=949902&r1=949901&r2=949902&view=diff
==============================================================================
--- xerces/java/trunk/docs/faq-xs.xml (original)
+++ xerces/java/trunk/docs/faq-xs.xml Mon May 31 23:47:22 2010
@@ -26,13 +26,23 @@
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>
+ <source>import javax.xml.transform.Source;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.Validator;
+
+...
+
+StreamSource[] schemaDocuments = /* created by your application */;
+Source instanceDocument = /* created by your application */;
+
SchemaFactory sf = SchemaFactory.newInstance(
"http://www.w3.org/XML/XMLSchema/v1.1");
-Schema s = sf.newSchema(new StreamSource(args[1]));
+Schema s = sf.newSchema(schemaDocuments);
Validator v = s.newValidator();
-v.validate(new StreamSource(args[0]));
- </source>
+v.validate(instanceDocument);
+</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>
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic