Re: [xml] help locating external entity

On Mon, Jun 25, 2001 at 05:45:59PM -0700, Alice Tull wrote:

Hi all,

I have a problem locating an external entity. My program is at directory
and both my xml file and my dtd are at directory "A/conf". I'm running
my program from directory "A".

I have a line like this to open an xml file to parse:

      xmlParserCtxtPtr ctxt =

And in "myconf.xml", the reference to the dtd is:
      <!DOCTYPE MyFile SYSTEM "../conf/MyFile.dtd" >

Instead of trying the uri ".//conf/../conf/MyFile.dtd", the parser tries 
to load "/conf/MyFile.dtd".

  hum, right, it's a bug !

orchis:~/tmp -> cat conf/myconf.xml
<!DOCTYPE MyFile SYSTEM "../conf/MyFile.dtd" >
orchis:~/tmp -> cat conf/MyFile.dtd
orchis:~/tmp -> xmllint --noout --valid conf/myconf.xml
orchis:~/tmp -> xmllint --noout --valid ./conf/myconf.xml
orchis:~/tmp -> xmllint --noout --valid .//conf/myconf.xml
.//conf/myconf.xml:1: error: failed to load external entity "/conf/MyFile.dtd"
<!DOCTYPE MyFile SYSTEM "../conf/MyFile.dtd" >
.//conf/myconf.xml:2: validity error: Validation failed: no DTD found !
orchis:~/tmp -> 

Poking around the source a bit shows that:
      (1) base path = ".//conf", but because "./" is ignored, base path =

   Seem the // should be reduced first, it's a bug in the URI normalization
code, patch to fix it enclosed, it fixes another '//' normalization bug
in this code,

Is this the correct behavior? Shouldn't the parser take care of extra "/" in
the uri? 

   No and yes, thanks a lot for the report !


Daniel Veillard      | Red Hat Network
veillard redhat com  | libxml Gnome XML XSLT toolkit | Rpmfind RPM search engine
Sep 17-18 2001 Brussels Red Hat TechWorld

Attachment: normalize.patch
Description: Text document

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]