Re: [xml] Bug 502960: XML namespaces and SAX



On Thu, Dec 20, 2007 at 10:52:53AM -0800, Red wrote:

   [1]http://bugzilla.gnome.org/show_bug.cgi?id=502960
   See  the bug for details, but this seems to be a bona fide libxml bug:
   when   an  entity  reference  is  parsed  using  SAX,  any  associated
   namespaces  from enclosing nodes are not inherited. Please have a look
   and let me know if you agree.

References

   1. http://bugzilla.gnome.org/show_bug.cgi?id=502960

  Yes it's a problem.
The general problem is that you basically need to reparse the whole entities
each time due to this. In general SAX and namespaces don't cohabit nicely.
Frankly, don't use SAX if you intend to play with entities, and avoid
entities and namespace usage:

Retake your example but make the content

<foo>
 <bar xmlns="bar">&test;</bar>
 <bar xmlns="bar2">&test;</bar>
</foo>

When the person who wrote the entity test in your document system
maybe it assumed a "bar" namespace, maybe it assumed no namespace,
but it certainly didn't expect the entity to be used for two different
kind of element.
The only safe thing is taht if you use/expect namespace for content within
a parsed entity you should put the namespace declaration in the entity itself
to guarantee this.

The patch as is is not acceptable, as it breaks the ABI.
Copying the array may work, but it would need a lot of testing to make
sure this doesn't break anything.

Daniel
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]