Michael,

Thanks much, this worked exceptionally well.  One minor issue though is the
reported line numbers are no longer there (-1).  Do I need some setting
while loading the DOM?

Also, assuming the line numbers are actually determined, how would I access
them from the DOM (independent of the schema validation issue)?

-Windy

> -----Original Message-----
> From: Michael Glavassevich [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, December 11, 2007 10:24 AM
> To: j-users@xerces.apache.org
> Subject: Re: Avoiding DOM Reparse
> 
> Hi Windy,
> 
> Before calling normalizeDocument() you should be able to set the
> "http://apache.org/xml/properties/internal/grammar-pool"; property on the
> DOMConfiguration with your grammar pool. Alternatively you could use the
> JAXP Validation API [1]. If you pass the PSVI-aware version of the DOM to
> the Validator [2] as both the Source and Result it will annotate your DOM
> with PSVI.
> 
> Thanks.
> 
> [1]
> http://xerces.apache.org/xerces2-
> j/javadocs/api/javax/xml/validation/package-summary.html
> [2]
> http://xerces.apache.org/xerces2-
> j/javadocs/api/javax/xml/validation/Validator.html#validate(javax.xml.tran
> sform.Source,%20javax.xml.transform.Result)
> 
> Michael Glavassevich
> XML Parser Development
> IBM Toronto Lab
> E-mail: [EMAIL PROTECTED]
> E-mail: [EMAIL PROTECTED]
> 
> "Windchime" <[EMAIL PROTECTED]> wrote on 12/11/2007 12:30:30 PM:
> 
> > I am reading lots of XML documents that need schema validation.
> However,
> I
> > don't know what the schema (actually grammar pool) looks like until long
> > after the documents are read.  Finally, I want to have full access to
> the
> > PSVI information.
> >
> > What I would like to know is, is there any way to perform the schema
> > validation without reparsing the XML.  The reparse causes two problems:
> > 1) Takes time
> > 2) All cached Element references must be re-cached
> >
> > The code that I have generally works just fine, except that I must
> reparse
> > the DOM a second time once the grammar has been determined.
> >
> > In priority order, it would be great if I could:
> >
> >    * Somehow associate the grammar pool and then just call
> > normalizeDocument() [ I already have a PSVIDocument using the
> > 'http://apache.org/xml/properties/dom/document-class-name' property ]
> >
> >    * Use an input source that would preserve the original DOM
> >
> >
> >
> > Thanks much in advance,
> >
> >
> > -Windy
> >
> >
> > ---------------------------------------------------------------------
> > 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]


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

Reply via email to