Hi,

I believe that Micael is asking how to validate an input file against a
*specific* local DTD file, regardless of what DTD is specified in the
DOCTYPE of the input file.

I too would be interested in hearing about any good solutions to this.

Micael, one solution to this is to write a custom EntityResolver, which
either:
(a) checks that the DTD name (public or system) passed to it is the
expected DTD name, or
(b) always returns the contents of the DTD you want to validate against,
regardless of what DTD is specified in the document.

See the javadoc for class org.xml.sax.EntityResolver for more info.

Regards,

Simon

On Mon, 2002-12-02 at 11:05, micael wrote:
> Are you just trying to find out how to connect a dtd to a given xml 
> file?  If so, that is part of the xml file itself.
> 
> At 10:56 PM 12/1/2002 +0100, you wrote:
> >Hi,
> >
> >I explain u my problem.
> >
> >I developp a program that reads it configuration into
> >a xml file.
> >The xml file references a dtd ( project.dtd ).
> >
> >The problem is if i use any other well formatted xml
> >referencing another  dtd.
> >
> >The parsing works and it is normal but this xml
> >file is not valid for my program.
> >
> >I would like to verify for a xml file that the used
> >dtd is well "project.dtd" and not another one.
> >
> >How can i do that ?
> >
> >i use Xerces-J-2.2.1 and i parse using the SAX Method.
> >
> >Thanks
> >
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
> 
> Micael
> 
> -------------------------------------------------------
> 
> This electronic mail  transmission and any accompanying documents contain 
> information belonging to the sender which may be confidential and legally 
> privileged.  This information is intended only for the use of the 
> individual or entity to whom this electronic mail transmission was sent as 
> indicated above. If you are not the intended recipient, any disclosure, 
> copying, distribution, or action taken in reliance on the contents of the 
> information contained in this transmission is strictly prohibited.  If you 
> have received this transmission in error, please delete the message.  Thank 
> you 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
-- 
Simon Kitching <[EMAIL PROTECTED]>


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

Reply via email to