[xml] help locating external entity



Hi all,

I have a problem locating an external entity. My program is at directory
"A",
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 =
xmlCreateFileParserCtxt(".//conf/myconf.xml");

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".

Poking around the source a bit shows that:
        (1) base path = ".//conf", but because "./" is ignored, base path =
"/conf"
        (2) the "../" and "conf/" cancels each other, so the net path =
"MyFile.dtd"
        (3), putting (1) and (2) together, the result entity path is
therefore "/conf/MyFile.dtd"

Is this the correct behavior? Shouldn't the parser take care of extra "/" in
the uri? 
I'm using libxml2.3.11.

thanx,
alice





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