Re: [xml] Adding pre-defined namespaces
- From: Daniel Veillard <veillard redhat com>
- To: Eric Seidel <eseidel apple com>
- Cc: xml gnome org
- Subject: Re: [xml] Adding pre-defined namespaces
- Date: Fri, 7 Oct 2005 23:36:11 -0400
On Wed, Oct 05, 2005 at 03:41:22PM -0700, Eric Seidel wrote:
On Oct 5, 2005, at 3:14 PM, Daniel Veillard wrote:
On Mon, Oct 03, 2005 at 12:45:33AM -0700, Eric Seidel wrote:
Another example is when parsing document fragments for things such as
setInnerHTML in an xhtml context... There we need to build up a
"namespace stack" representing the current document context before
doing the actual parse.
I don't understand, either it's XHTML in which case it is XML
and an XML parser should work or it's not. Trying to parse XML island
in non well-formed XML'like HTML opens the door to so many error case
that loosing the namespace sounds just liek a small side effect.
As far as I understand, this is completely valid javascript + xhtml,
which we'd like to support (and I do currently, through some of my
own hacks):
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://
www.w3.org/2000/svg">
<script type="text/javascript">
<![CDATA[
var e = document.getElementById('test');
e.innerHTML = '<svg:svg></svg:svg>';
}
]]>
</script>
<body>
<div id="test"/>
</body>
</html>
NOTE: setting innerHTML in an xhtml context expects an xmlfragment,
not an html one. Bad naming, I know. :)
Okay, I understand better, one case of use of the namespace from the PCDATA
and not from the markup itself... nasty :-)
Unfortunately use of the libxml SAX2 parser for this "setInnerHTML"
xml parsing barfs due to the fact that the xml fragment we're parsing
It should complain but still produce a tree though.
does not contain all of the necessary namespace definitions. Yet, as
far as I know, this the above code should be valid, since the xml
fragment should be evaluated in the context of the document.
Currently I support this
Thoughts?
This is a bit far stretched IMHO, but I understand, maybe I can add a small
API to add in-scope namespace like that, I find that slightly disturbing though
the parsing really should be context free ...
Daniel
--
Daniel Veillard | Red Hat Desktop team http://redhat.com/
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]