[EMAIL PROTECTED] 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]