Houamn,
One suggestion is to set "reuseGrammar" to true during second xml document
parse. It will reuse the grammar saved in the first xml document parse, and
ignore whatever grammar specified in the second xml document. Note you cannot
have internal subset in this case.
Another suggestion is to use "resolveEntity" to redirect the specified DTD to
your own DTD.
Tinny
"Prior, Chris" wrote:
> Hi,
>
> I know a way to get around this, but it probably won't go down as a nice
> solution:
>
> Before parsing the doc sent to you replace the entire SYSTEM declaration
> with the dtd you want. This way you won't need to override with
> resolveEntity, and in any case that would not have worked for the additional
> entities defined as you pointed out. I do this with the help of
> MemBufInputSource as the source to parse.
>
> If anyone knows a cleaner way please say as I would like to know as well.
>
> Chris Prior
>
> -----Original Message-----
> From: Christoffer Dam Bruun [mailto:[EMAIL PROTECTED]]
> Sent: 26 June 2001 10:40
> To: '[EMAIL PROTECTED]'
> Subject: RE: 2 questions about parsing
>
> I am in exactly the same situation:
> We are making a "gate-keeper" program that must validate all data against
> a previously agreed upon schema.
>
> If you come up with an idea, please let us know.
>
> /Christoffer
>
> > -----Original Message-----
> > From: Alberto Massari [mailto:[EMAIL PROTECTED]]
> > Sent: 26. juni 2001 10:58
> > To: [EMAIL PROTECTED]
> > Cc: [EMAIL PROTECTED]
> > Subject: Re: 2 questions about parsing
> >
> >
> > At 14.58 25/06/01 -0700, [EMAIL PROTECTED] wrote:
> >
> > >More details on second question...
> > >
> > >I will be provided with an XML file from another party. We
> > will agree on
> > >the DTD beforehand, of course. But they could send me a file which a
> > >modified DTD and the XML data in the rest of the file could
> > match that
> > >modified DTD. So Xerces would parse and validate the file
> > without any
> > >problems. But my code to walk the doc tree and extract data
> > would likely
> > >break. So I would like to keep our agreed-upon DTD in a
> > separate file.
> > >Then apply that DTD to the file they provide me. Ideally, I
> > would ignore
> > >any DTD that they provided with their XML file.
> >
> > XML allows you to mix internal and external DTDs, like in
> >
> > <!DOCTYPE SYSTEM "Path_to_DTD_we_agreed_on" [ <!-- extra elements and
> > modified definitions go here --!> ]>
> >
> > Unfortunately, in Xerces you could easily avoid loading the
> > external DTD,
> > but I don't think you can avoid loading the internal one (that, btw,
> > overrides what is written in the external one)
> >
> > Alberto
> >
> >
> > -------------------------------
> > Alberto Massari
> > eXcelon Corp.
> > http://www.StylusStudio.com
> >
> >
> > ---------------------------------------------------------------------
> > 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]
>
> ___________________________________________________
> Email Disclaimer
>
> This communication is for the attention of the
> named recipient only and should not be passed
> on to any other person. Information relating to
> any company or security, is for information
> purposes only and should not be interpreted as
> a solicitation or offer to buy or sell any security.
> The information on which this communication is based
> has been obtained from sources we believe to be reliable,
> but we do not guarantee its accuracy or completeness.
> All expressions of opinion are subject to change
> without notice. All e-mail messages, and associated attachments,
> are subject to interception and monitoring for lawful business purposes.
> ___________________________________________________
>
> ---------------------------------------------------------------------
> 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]