It gives you the fully resolved URI. This lets you know exactly where it's
looking for that dtd file. If that is not the location of the dtd file, then
that is why you have the entity resolver in the first place. Return the
InputSource that points to the correct location of the file.
If you always use test.dtd it's easy to check if that is what the resolver
is trying to find:
systemId.endsWith("test.dtd");
Or if you have multiple dtds, you can just lop off everything before the
final slash to get the dtd name:
systemId.substring(systemId.lastIndexOf('/'));
Clark
-----Original Message-----
From: Cirip Tomas [mailto:[EMAIL PROTECTED]
Sent: Friday, February 15, 2002 1:12 PM
To: '[EMAIL PROTECTED]'
Subject: RE: Still have EntityResolver problem
Yes. But why is parser asking for entity "file:///d:/tc/test.dtd"? If I have
only "test.dtd" in XML document it should bring only "test.dtd" in systemId
and give me a chance to resolve it in custom EntityResolver, or not? Or do I
have to remove "file:///d:/tc/" from systemId? That's strange, isn't it?
Tomas
-----Original Message-----
From: John Utz [mailto:[EMAIL PROTECTED]
Sent: Friday, February 15, 2002 3:55 PM
To: '[EMAIL PROTECTED]'
Subject: Re: Still have EntityResolver problem
i assume that you are running your program from the directory d:\tc,
correct?
On Fri, 15 Feb 2002, Cirip Tomas wrote:
> Hi all,
>
> I still have a problem with entity resolver:
>
> here is a fraction of XML document
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE root SYSTEM "test.dtd">
> <root>
>
> anyway I get systemId="d:\tc\test.dtd" in resolveEntity method of my
> EntityResolver.
>
> when I specify
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE root SYSTEM "xml/test.dtd">
> <root>
>
> I get systemId="d:\tc\xml\test.dtd"
>
> Why? Where is it getting "d:\tc\" from? I parse XML Document using
following
> code
>
> InputSource inputSource = new InputSource(new
> java.io.StringReader(getText()));
> parser.setEntityResolver(new MyEntityResolver());
> parser.parse(inputSource);
>
> Thanks
>
> Tomas
>
> ---------------------------------------------------------------------
> 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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]