[ python-Bugs-788931 ] resolving relative paths for external
entities with xml.sax
SourceForge.net
noreply at sourceforge.net
Tue Mar 2 12:44:14 EST 2004
Bugs item #788931, was opened at 2003-08-14 15:31
Message generated for change (Comment added) made by crhode
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=788931&group_id=5470
Category: XML
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Bart Vanhaute (bartvh)
Assigned to: Nobody/Anonymous (nobody)
Summary: resolving relative paths for external entities with xml.sax
Initial Comment:
[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.
----------------------------------------------------------------------
Comment By: Chuck Rhode (crhode)
Date: 2004-03-02 11:44
Message:
Logged In: YES
user_id=988879
See also Bugs 902037 and 616431. -ccr-
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=788931&group_id=5470
More information about the Python-bugs-list
mailing list