Great points...Thanks for the guidance.  I'll let you know how it worked
out.
Jim

> -----Original Message-----
> From: Khaled Noaman [mailto:[EMAIL PROTECTED]]
> Sent: Friday, November 02, 2001 4:49 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Schema error vs. Instance error?
> 
> 
> Jim,
> 
> My comments are below.
> 
> >> Here are some suggestions:
> >> 1. Modify the parser to register an additional error handler
> >> that is used
> >> by schema traversal to report errors.
> 
> >.. at first glance I didn't see how to do that.  I'll look again but
> >remember thinking that the Scanner owns the SchemaTraversal 
> instance and
> >doesn't allow me to hook into it.
> 
> This one is a little bit tricky, and it will invlove some 
> code changes to the
> Parser/Scanner/TraverseSchema classes. TraverseSchema 
> indirectly uses the
> scanner/validator
> error reporting mechanism. So, before traversing the schema, 
> scanner/validator
> needs to switch the error handler to be the schema error 
> handler, then switch
> back after traversal.
> 
> >> 2. Add a method to the parser to inquire whether any errors were
> >> encountered during parsing a schema.
> 
> >er...how?  You mean just parse the schema and test for 
> errors and if all
> >goes well parse the instance with the schema?  That might 
> actually work but
> >I'd like to prevent the double parse if possible.  Since I'm 
> caching the
> >grammar it might not be that bad since the schema only parse 
> happens only
> >once.
> You are right. Also, the errors reported during the schema 
> traversal have the
> same line number.
> It is the line number of the schema declaration  in the 
> instance document.
> 
> If you do not like to double parse, then you need to add some 
> code so that the
> parser will have a method to tell you whether any errors were 
> encountered
> during the schema parsing.
> You need to modify TraverseSchema so that it keeps a flag of 
> whether it
> encountered errors during parsing. In the scanner, after the 
> schema traversal,
> you can get that flag and store it. The new method in the 
> parser will simple
> ask the scanner for that flag.
> 
> Regards,
> Khaled
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

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

Reply via email to