I think the Xerces schema validation is "fully baked".  Xerces
supports Sun's JAXP interface for schema validation, so you can do
this:

SAXParserFactory spf = SAXParserFactory.newInstance();
spf.setValidating(true);
spf.setNamespaceAware(true);
SAXParser p = spf.newSAXParser();
p.setProperty("http://java.sun.com/xml/jaxp/properties/schemaLanguage";,
              "http://www.w3.org/2001/XMLSchema";);

And then you're ready to go.  There's a Xerces-specific way to do it
too.  Also note that with Xerces, "full checking" of schema is off by
default, meaning that it does not perform some more complicated and
time-consuming checks.  Also take a look at the XMLGrammarBuilder
sample in the Xerces source (class xni.XMLGrammarBuilder) for more
ideas.

I assume this is what you were asking and not really "how to write a
parser".

-Steve

On Thu, 14 Oct 2004 14:07:41 -0400, [EMAIL PROTECTED] wrote:
> I have a lot of resources on how to write a schema file. But none of them 
> discuss or show sample code on how to actually write a parser that 
> validates my XML data file against the XML schema file.
> 
> Most places that I check for validation point to Xerces, and the support 
> for that seems to be fresh out of the oven. I wrote a validating parser, 
> but it doesn't really seem to work fully! (If anyone cares to see it, I 
> can send it to you.)
> 
> Is the schema validation work complete in Xerces? I just need the basic 
> data type support and attribute dependency support.
> 
> If you know of any sample validating parsers, can you please send me a 
> link?
> 
> Thanks,
> -ramin


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to