Re: [xml] Adding pre-defined namespaces
- From: Eric Seidel <eseidel apple com>
- To: veillard redhat com
- Cc: xml gnome org
- Subject: Re: [xml] Adding pre-defined namespaces
- Date: Wed, 5 Oct 2005 15:41:22 -0700
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. :)
Unfortunately use of the libxml SAX2 parser for this "setInnerHTML"
xml parsing barfs due to the fact that the xml fragment we're parsing
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?
-eric
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]