commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Kitching <si...@ecnetwork.co.nz>
Subject Re: [Digester] XML driven schema validation?
Date Thu, 07 Aug 2003 23:16:04 GMT

On Fri, 2003-08-08 at 04:04, Steve Byrne wrote:
> Simon Kitching <simon@ecnetwork.co.nz> writes:
> 
> Ki ora, Simon ;)

:-)

What are you seeing as your behaviour? A hang, or just invalid documents
being processed?

Hmm.. I wonder what default ErrorHandler the Digester sets up for its
parser...

One solution for you that will *definitely* work is for you to create a
validating SAXParser object yourself, using the normal JAXP apis, pass
the Digester object as the SAX Content Handler (digester implements this
interface) then call parse on the SAX parser object. This way, you have
the responsibility of setting up the parser exactly as you wish. Well,
by "definitely work", I mean that the responsibility for setting up the
parser to do validation is now yours, not the digester's.


Cheers,

Simon


> 
> Yes, it's good that you asked about this since I didn't specify it in my
> query.  Right after instantiating the digester instance, I called:
> 
>    digester.setNamespaceAware(true);
>    digester.setValidating(true);
> 
>    // with or without this line, the behavior is the same.  I may not
>    // have the URL exactly right here; this is from memory and not
>    // cut & pasted from the actual code
>    digester.setSchemaLanguage("http://www.w3.org/XMLSchema");
> 
> 
> > Hi,
> > 
> > Sorry to ask the obvious, but have you called
> >   digester.setValidating(true)
> > immediately after creating the digester instance?
> > 
> > On Thu, 2003-08-07 at 18:53, Steve Byrne wrote:
> > 
> > > I'm trying to get digester to do XML Schema validation based off the schema
> > > referenced in the input XML file.  I have tried doing
> > > digester.setSchema("foo.xsd"), and that works, but I want to have the schema
> > > used for validation instead be selected by the incoming XML file.  
> > 
> > 
> > 
> 
> 


Mime
View raw message