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 2018/03/14 12:41:24 UTC
svn commit: r1826707 -
/xerces/java/branches/xml-schema-1.1-dev/docs/faq-xs.xml
Author: mukulg
Date: Wed Mar 14 12:41:24 2018
New Revision: 1826707
URL: http://svn.apache.org/viewvc?rev=1826707&view=rev
Log:
minor changes to documentation
Modified:
xerces/java/branches/xml-schema-1.1-dev/docs/faq-xs.xml
Modified: xerces/java/branches/xml-schema-1.1-dev/docs/faq-xs.xml
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/docs/faq-xs.xml?rev=1826707&r1=1826706&r2=1826707&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/docs/faq-xs.xml (original)
+++ xerces/java/branches/xml-schema-1.1-dev/docs/faq-xs.xml Wed Mar 14 12:41:24 2018
@@ -25,7 +25,7 @@
regular SAXParser and DOMParser classes, and also with the JAXP
validation API using the XSD 1.0 Schema factory. 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
+ <p>For XML Schema 1.1 validation, the preferred way is to use the JAXP
validation API, using the XSD 1.1 Schema factory. Here's an example: </p>
<source>import javax.xml.transform.Source;
import javax.xml.transform.stream.StreamSource;
@@ -44,6 +44,12 @@ Schema s = sf.newSchema(schemaDocuments)
Validator v = s.newValidator();
v.validate(instanceDocument);
</source>
+ <p>Similar to XML Schema 1.0 validation using SAXParser and DOMParser classes that was
+ available earlier with Xerces, the same has been enhanced to support XML Schema 1.1
+ validation as well. To be able to do this, we need to construct the XSD 1.1 Schema factory
+ with the following java statement, SchemaFactory.newInstance("http://www.w3.org/XML/XMLSchema/v1.1")
+ and do the subsequent validation.
+ </p>
<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>
@@ -51,8 +57,7 @@ v.validate(instanceDocument);
grammars it uses by using an xsi:schemaLocation attribute if they use
namespaces, and an xsi:noNamespaceSchemaLocation attribute
otherwise. These are usually placed on the root / top-level element
- in the document, though they may occur on any element; for more details see XML
- Schema Part 1 section 4.3.2.
+ in the document, though they may occur on any element; for more details see <jump href="https://www.w3.org/TR/xmlschema-1/#composition-instances">XML Schema Part 1 section 4.3.2</jump>.
Here is an example with no target namespace: </p>
<source><document
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
@@ -73,23 +78,6 @@ v.validate(instanceDocument);
</a>
</faq>
- <faq title="Using Entities and CDATA Sections">
- <q>How does the XML Schema processor treat entities and CDATA sections?</q>
- <a>
- <p>According to the XML Infoset the infoset items contributing to the
- <jump href='http://www.w3.org/TR/xml-infoset/#infoitem.character'>[character
- information item]</jump> are: characters in the document, whether literally, as
- a character reference, or within a CDATA section, or within Entity
- Reference. The XML Schema specification
- "requires as a precondition for assessment
- an information set as defined in [XML-Infoset]"
- <jump href='http://www.w3.org/TR/xmlschema-1/#infoset'>(Appendix D)</jump> and thus Xerces might attempt to normalize data in an entity
- reference or CDATA section. To preserve character data within entity references and
- CDATA sections,
- turn off http://apache.org/xml/features/validation/schema/normalized-value feature.
- </p>
- </a>
- </faq>
<faq title="XPath 2.0 support for XML Schema 1.1 validation">
<q>How an XPath 2.0 engine is used for XML Schema 1.1 assertions and CTAs?</q>
<a>
@@ -140,6 +128,23 @@ v.validate(instanceDocument);
</note>
</a>
</faq>
+ <faq title="Using Entities and CDATA Sections">
+ <q>How does the XML Schema processor treat entities and CDATA sections?</q>
+ <a>
+ <p>According to the XML Infoset the infoset items contributing to the
+ <jump href='http://www.w3.org/TR/xml-infoset/#infoitem.character'>[character
+ information item]</jump> are: characters in the document, whether literally, as
+ a character reference, or within a CDATA section, or within Entity
+ Reference. The XML Schema specification
+ "requires as a precondition for assessment
+ an information set as defined in [XML-Infoset]"
+ <jump href='http://www.w3.org/TR/xmlschema-1/#infoset'>(Appendix D)</jump> and thus Xerces might attempt to normalize data in an entity
+ reference or CDATA section. To preserve character data within entity references and
+ CDATA sections,
+ turn off http://apache.org/xml/features/validation/schema/normalized-value feature.
+ </p>
+ </a>
+ </faq>
<faq title="XML Schema API">
<q>Does Xerces provide access to the post schema validation infoset (PSVI)?</q>
<a>
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org