Message60371
[This is a copy of a message posted on comp.lang.python
for which I did not see any response. After some
reflection, I began to see it as a bug in python, so
here is the bug report.]
I have a set of XML documents that use external entity
definitions for which I am having problems parsing them
using python and xml.sax. The problem is with the
resolution of relative paths in these.
An example:
dir1/test.xml:
<?xml version="1.0"?>
<!DOCTYPE test SYSTEM " ../dir2/test.dtd">
<test>&ent;</test>
dir2/test.dtd:
<!ENTITY ent SYSTEM "test.inc">
<!ELEMENT test (#PCDATA)>
dir2/test.inc:
external entity test
From what I understand of XML specs, relative paths in
external entities are relative to the location of the
document *in which they are defined*. However, using
xml.sax (which calls expat, I presume), the paths are
resolved relative to the current working directory. So
the parser can not find the test.inc when the current
working directory is e.g. dir1.
I do not see how creating an EntityResolver would help
here: how do I know against what base path I have to
resolve the entity?
(the same thing can be read without problems with other
xml parser, for instance in Java).
Bart.
|
|
Date |
User |
Action |
Args |
2008-01-20 09:56:19 | admin | link | issue788931 messages |
2008-01-20 09:56:19 | admin | create | |
|