tugwilson | 16 May 15:43
Picon
Favicon

Re: [groovy-user] XML processing with Groovy's different APIs


Jean-Noël Rivasseau-3 wrote:
> 
> My question is : is it possible to do schema validation (not DTD)
> directly in DOMBuilder, XmlParser or XmlSlurper? According to the
> docs, it seems that validation with these objects works only with a
> DTD. I am using a schema, I tried to use validation but it failed.
> Does that mean I have to turn validation off and use the method
> described (involving creating a validator object)?
> 

If your XML document contains xsi:noNamespaceSchemaLocation or
xsi:schemaLocation attributes and the parser's
http://xml.org/sax/features/validation property is true then the parser will
validate against the schema. If not you need to set the parser's
http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation
and/or http://apache.org/xml/properties/schema/external-schemaLocation
properties. See http://xerces.apache.org/xerces-j/schema.html

With XmlSlurper you can instantiate and configure the parser and then pass
the configured parser to the constructor.

John Wilson
--

-- 
View this message in context: http://www.nabble.com/XML-processing-with-Groovy%27s-different-APIs-tp17274414p17275063.html
Sent from the groovy - user mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Gmane