xerces-j-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@cogsci.ed.ac.uk (K. Ari Krupnikov)
Subject Re: PSVI access through DOM in xerces-j
Date Thu, 21 Nov 2002 21:13:36 GMT
sandygao@ca.ibm.com writes:

> Try this:
> 

> factory.setNamespaceAware(true);
> factory.setValidating(true);
> factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaLanguage",
>                      "http://www.w3.org/2001/XMLSchema");

> 
> Note that you need all the 4 things to get DOM PSVI: namespace, validation,
> schema language, and document class.

Thanks! I knew I was missing something *very* simple.

> The reason it's not a complete sample is that we are assuming people
> reading this faq should already be familiar with schema validation (which

I'm curious, is this just an assumption, or am I the first one to have
trouble with this?

> requires the first 3 settings). Also how to set those features/properties
> differs from API to API, and we didn't want to provide all versions of
> similar sample code for all possible API's.

How do you mean "differs from API to API"? Do you mean SAX/DOM/XNI?
What I was missing for the DOM version was exactly 3 lines of code -
even less than my original estimate. Reading the SAX snippet
(http://xml.apache.org/xerces2-j/faq-xs.html#faq-6), would have one
believe that no configuration is needed, and the PSVI will be
available by default; the code is therefore quite short. But I
understand that one needs to set the same four features/properties on
the SAXParser(Factory) that you listed in your mail. So that's extra 4
lines.

Consider it a bug report for the docs :=)

Ari.


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


Mime
View raw message