Re: [xml] Possible bug in interaction of xml:base and external entities



On Fri, Sep 21, 2007 at 05:58:44PM +0100, Toby White wrote:
I *think* xmllint is defining xml:base wrongly in
the presence of external entities - but I'm prepared
to be told I'm wrong or I'm using xmllint inappropriately.

Consider the pair of documents:

1: wrapper.xml

---
<!DOCTYPE wrapper [
<!ENTITY contents SYSTEM "subdir/contents.xml">
]>
<wrapper>&contents;</wrapper>
---

2: subdir/contents.xml

---
<node/>
---

If I open up wrapper.xml in the xmllint --shell, without
using "--noent", then I can't look inside the &contents;
entity (or at least, I can't find a way to do so)

So instead, if I open it up using xmllint --noent --shell,
then take a look at the <node/> inside &contents; and
ask for its base URI, I get told "wrapper.xml", when in fact
the base URI ought to be "contents.xml", or possibly
"subdir/contents.xml" - or so it seems to me, anyway.

How ought I to use xmllint to inspect nodes inside entity
references?

  Known problem, there is no way in the libxml2 tree model to add the
informations about the change of base after entities have been substitued.
If you don't substitute, you get an entity reference node which should
have the path and hence the base of nodes from the entity can be computed.
xml:base was added to the XML standard stack after libxml2 datastructures
design was completed, unfixeable without breaking the ABI in some ways.

In a similar vein, when using xsltproc, are there any extension
functions which allow me to access the base URI of a node?

  not sure 
  http://www.w3.org/TR/xslt#function-unparsed-entity-uri
looks different from what you need.

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/



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