Steve,

The "http://java.sun.com/xml/jaxp/properties/schemaLanguage"; and
"http://java.sun.com/xml/jaxp/properties/schemaSource"; were introduced in
JAXP 1.2 to support schema validation.

A more powerful validation API (javax.xml.validation) was introduced in
JAXP 1.3. You create a Schema using this API and set it on the
DocumentBuilderFactory (or SAXParserFactory). If used correctly (i.e.
cache / reuse the Schema object and parsers) it will perform better than
the JAXP 1.2 method and use less memory (i.e. by sharing the Schema object
across DocumentBuilders). Also it decouples the validation from parsing,
meaning you can plug in a Schema object from another implementation and the
parser will work with it.

If you're just starting to write new code I recommend the JAXP 1.3 method.

Thanks.

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrgla...@ca.ibm.com
E-mail: mrgla...@apache.org

Steve Brannstrom <steveb...@gmail.com> wrote on 09/15/2009 04:02:39 PM:

> Hi Guys,
>
> I'm little confusing with Schema validating with Xerces-J using JAXP
API .
>
> (1)  According to the [1] doc
> DocumentBuilderFactory.#setValidating(boolean) is used for validate
> with the DTD , if i want to use XMLShema i should use
> DocumentBuilderFactory.#setSchema(Schema) where Schema object is load
> through the SchemaFactory.
>
> (2) I found following doc[2] , According to that it is possible to use
> DocumentBuilderFactory.#setValidating(boolean)  method to validate
> with XMLShema , together with
> "http://java.sun.com/xml/jaxp/properties/schemaLanguage"; and
> "http://java.sun.com/xml/jaxp/properties/schemaSource"; properties.
>
> Both of above approaches worked with me , but I'm confusing with
> whether both approaches leads me in to same results or any difference
> of them. I couldn't find any comparison about these two , I'm really
> appreciate if some one can explain differences or provide a good
> reference to me .
>
>
> [1] - http://xerces.apache.org/xerces2-
> j/javadocs/api/javax/xml/parsers/DocumentBuilderFactory.
> html#setValidating(boolean)
> [2]-  http://www.j2ee.me/j2ee/1.4/docs/tutorial/doc/JAXPDOM8.html
>
> Regards,
>
> Steve
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscr...@xerces.apache.org
> For additional commands, e-mail: j-users-h...@xerces.apache.org

Reply via email to