<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.3.3" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>
<channel>
	<title>Comments on: Using E4X With XHTML? Watch Your Namespaces!</title>
	<link>http://www.partlyhuman.com/blog/roger/using-e4x-with-xhtml-watch-your-namespaces</link>
	<description>Welcome to dispatchEvent, a blog brought to you by Roger Braunstein of partlyhuman and Mims Wright of losdesigns.</description>
	<pubDate>Fri, 16 May 2008 03:31:00 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.3</generator>
		<item>
		<title>By: Philip Bulley</title>
		<link>http://www.partlyhuman.com/blog/roger/using-e4x-with-xhtml-watch-your-namespaces#comment-99598</link>
		<dc:creator>Philip Bulley</dc:creator>
		<pubDate>Wed, 02 Apr 2008 16:33:30 +0000</pubDate>
		<guid>http://www.partlyhuman.com/blog/roger/using-e4x-with-xhtml-watch-your-namespaces#comment-99598</guid>
		<description>Great post... figured I had a namespace issue, but had no idea of how to reference it! Thanks mate.</description>
		<content:encoded><![CDATA[<p>Great post&#8230; figured I had a namespace issue, but had no idea of how to reference it! Thanks mate.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mitch</title>
		<link>http://www.partlyhuman.com/blog/roger/using-e4x-with-xhtml-watch-your-namespaces#comment-18140</link>
		<dc:creator>Mitch</dc:creator>
		<pubDate>Tue, 17 Jul 2007 12:27:29 +0000</pubDate>
		<guid>http://www.partlyhuman.com/blog/roger/using-e4x-with-xhtml-watch-your-namespaces#comment-18140</guid>
		<description>This is invaluable. Thank you for publishing this.</description>
		<content:encoded><![CDATA[<p>This is invaluable. Thank you for publishing this.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark</title>
		<link>http://www.partlyhuman.com/blog/roger/using-e4x-with-xhtml-watch-your-namespaces#comment-16246</link>
		<dc:creator>Mark</dc:creator>
		<pubDate>Thu, 05 Jul 2007 14:52:57 +0000</pubDate>
		<guid>http://www.partlyhuman.com/blog/roger/using-e4x-with-xhtml-watch-your-namespaces#comment-16246</guid>
		<description>Don't forget:
if (myXhtmlDocument.namespace("") != undefined){
    default xml namespace = myXhtmlDocument.namespace("");
}

If your xml has a default namespace it'll set it as your default, so your calls won't need the namespace prepended</description>
		<content:encoded><![CDATA[<p>Don&#8217;t forget:<br />
if (myXhtmlDocument.namespace(&#8221;") != undefined){<br />
    default xml namespace = myXhtmlDocument.namespace(&#8221;");<br />
}</p>
<p>If your xml has a default namespace it&#8217;ll set it as your default, so your calls won&#8217;t need the namespace prepended</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dispatchEvent &#187; AS3 E4X Rundown</title>
		<link>http://www.partlyhuman.com/blog/roger/using-e4x-with-xhtml-watch-your-namespaces#comment-7402</link>
		<dc:creator>dispatchEvent &#187; AS3 E4X Rundown</dc:creator>
		<pubDate>Tue, 22 May 2007 01:07:43 +0000</pubDate>
		<guid>http://www.partlyhuman.com/blog/roger/using-e4x-with-xhtml-watch-your-namespaces#comment-7402</guid>
		<description>[...] I can write more about namespaces in a future revision, but for now check out the good discussion started in my previous post, Using E4X? Watch Your Namespaces. [...]</description>
		<content:encoded><![CDATA[<p>[&#8230;] I can write more about namespaces in a future revision, but for now check out the good discussion started in my previous post, Using E4X? Watch Your Namespaces. [&#8230;]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter Hall</title>
		<link>http://www.partlyhuman.com/blog/roger/using-e4x-with-xhtml-watch-your-namespaces#comment-1568</link>
		<dc:creator>Peter Hall</dc:creator>
		<pubDate>Wed, 28 Mar 2007 11:50:11 +0000</pubDate>
		<guid>http://www.partlyhuman.com/blog/roger/using-e4x-with-xhtml-watch-your-namespaces#comment-1568</guid>
		<description>It's not really that toXMLString() is limited. e4x works on a canonicalised data model. There are several ways to achieve the same XML object from different source strings - using default vs explicit namespaces is just one example. Canonicalisation makes XML simpler to work with, at the expense of losing how it was originally declared.</description>
		<content:encoded><![CDATA[<p>It&#8217;s not really that toXMLString() is limited. e4x works on a canonicalised data model. There are several ways to achieve the same XML object from different source strings - using default vs explicit namespaces is just one example. Canonicalisation makes XML simpler to work with, at the expense of losing how it was originally declared.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Roger Braunstein</title>
		<link>http://www.partlyhuman.com/blog/roger/using-e4x-with-xhtml-watch-your-namespaces#comment-1344</link>
		<dc:creator>Roger Braunstein</dc:creator>
		<pubDate>Fri, 23 Mar 2007 00:13:37 +0000</pubDate>
		<guid>http://www.partlyhuman.com/blog/roger/using-e4x-with-xhtml-watch-your-namespaces#comment-1344</guid>
		<description>No, thank you for making things more interesting! Not to mention, I learned something about XML-ID!
I also think it's weird that just because the node exists in a namespace, it's not considered as declaring that namespace...</description>
		<content:encoded><![CDATA[<p>No, thank you for making things more interesting! Not to mention, I learned something about XML-ID!<br />
I also think it&#8217;s weird that just because the node exists in a namespace, it&#8217;s not considered as declaring that namespace&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Claus Wahlers</title>
		<link>http://www.partlyhuman.com/blog/roger/using-e4x-with-xhtml-watch-your-namespaces#comment-1343</link>
		<dc:creator>Claus Wahlers</dc:creator>
		<pubDate>Fri, 23 Mar 2007 00:09:21 +0000</pubDate>
		<guid>http://www.partlyhuman.com/blog/roger/using-e4x-with-xhtml-watch-your-namespaces#comment-1343</guid>
		<description>Yeah something like that, i don't know. What worries me more though is the buggy (?) behavior of namespaceDeclarations() in that case.

Sorry btw for hijacking your post ;)</description>
		<content:encoded><![CDATA[<p>Yeah something like that, i don&#8217;t know. What worries me more though is the buggy (?) behavior of namespaceDeclarations() in that case.</p>
<p>Sorry btw for hijacking your post ;)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Roger Braunstein</title>
		<link>http://www.partlyhuman.com/blog/roger/using-e4x-with-xhtml-watch-your-namespaces#comment-1342</link>
		<dc:creator>Roger Braunstein</dc:creator>
		<pubDate>Thu, 22 Mar 2007 23:25:13 +0000</pubDate>
		<guid>http://www.partlyhuman.com/blog/roger/using-e4x-with-xhtml-watch-your-namespaces#comment-1342</guid>
		<description>It seems like a limitation that &lt;tt&gt;toXmlString()&lt;/tt&gt; can't handle default namespaces or implicitly defined namespaces. For instance, when you use &lt;tt&gt;xml:id&lt;/tt&gt;, you're using a namespace &lt;tt&gt;xml&lt;/tt&gt; that you don't declare, and when you're using the default namespace &lt;tt&gt;http://example.com&lt;/tt&gt; that namespace doesn't have a binding. &lt;tt&gt;toXmlString()&lt;/tt&gt; apparently wants everything to be explicit, so it makes up bindings for the two namespaces &#8212; &lt;tt&gt;aaa&lt;/tt&gt; and &lt;tt&gt;aab&lt;/tt&gt; &#8212; and uses them to explicitly namespace the &lt;tt&gt;id&lt;/tt&gt; attribute as well as the &lt;tt&gt;&#60;root&#62;&lt;/tt&gt; node. I think the output XML string is &lt;em&gt;functionally&lt;/em&gt; equivalent, but it's clearly not literally equivalent :(</description>
		<content:encoded><![CDATA[<p>It seems like a limitation that <tt>toXmlString()</tt> can&#8217;t handle default namespaces or implicitly defined namespaces. For instance, when you use <tt>xml:id</tt>, you&#8217;re using a namespace <tt>xml</tt> that you don&#8217;t declare, and when you&#8217;re using the default namespace <tt><a href="http://example.com" rel="nofollow">http://example.com</a></tt> that namespace doesn&#8217;t have a binding. <tt>toXmlString()</tt> apparently wants everything to be explicit, so it makes up bindings for the two namespaces &mdash; <tt>aaa</tt> and <tt>aab</tt> &mdash; and uses them to explicitly namespace the <tt>id</tt> attribute as well as the <tt>&lt;root&gt;</tt> node. I think the output XML string is <em>functionally</em> equivalent, but it&#8217;s clearly not literally equivalent :(</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Claus Wahlers</title>
		<link>http://www.partlyhuman.com/blog/roger/using-e4x-with-xhtml-watch-your-namespaces#comment-1331</link>
		<dc:creator>Claus Wahlers</dc:creator>
		<pubDate>Thu, 22 Mar 2007 20:09:53 +0000</pubDate>
		<guid>http://www.partlyhuman.com/blog/roger/using-e4x-with-xhtml-watch-your-namespaces#comment-1331</guid>
		<description>&lt;blockquote&gt;Note that you didn’t have to declare xmlns:xml=”http://www.w3.org/XML/1998/namespace” in the  node, but the attribute was clearly scoped to that namespace. That means AS3 respects its implicit existence. :)&lt;/blockquote&gt;
Yep that's the way it's supposed to be. However, toXMLString() seems to behave wrong as it's adding the xml namespace declaration (which is not valid).
Also namespaceDeclarations() seems to have a general problem when used with XMLLists downcasted to XML (or something)</description>
		<content:encoded><![CDATA[<blockquote><p>Note that you didn’t have to declare xmlns:xml=”http://www.w3.org/XML/1998/namespace” in the  node, but the attribute was clearly scoped to that namespace. That means AS3 respects its implicit existence. :)</p></blockquote>
<p>Yep that&#8217;s the way it&#8217;s supposed to be. However, toXMLString() seems to behave wrong as it&#8217;s adding the xml namespace declaration (which is not valid).<br />
Also namespaceDeclarations() seems to have a general problem when used with XMLLists downcasted to XML (or something)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Roger Braunstein</title>
		<link>http://www.partlyhuman.com/blog/roger/using-e4x-with-xhtml-watch-your-namespaces#comment-1327</link>
		<dc:creator>Roger Braunstein</dc:creator>
		<pubDate>Thu, 22 Mar 2007 18:50:23 +0000</pubDate>
		<guid>http://www.partlyhuman.com/blog/roger/using-e4x-with-xhtml-watch-your-namespaces#comment-1327</guid>
		<description>Interesting! I didn't know about &lt;tt&gt;xml:id&lt;/tt&gt;. It appears that for processors that support it, the &lt;tt&gt;xml&lt;/tt&gt; namespace is bound implicitly to http://www.w3.org/XML/1998/namespace, and &lt;tt&gt;id&lt;/tt&gt; is an attribute scoped to this namespace.

AS3 seems to support this. Hurray! Here are some ways you could extract the &lt;tt&gt;id&lt;/tt&gt; attribute. This shows how you can use namespaced attributes as well.

&lt;pre&gt;var b:XML = XML(&apos;&#60;root xmlns=&#34;http://example.com/&#34; xml:id=&#34;wtf&#34; /&#62;&apos;);
trace(b.attributes()[0]); //wtf
trace(b.@id); //null
trace(b.@*::id); //wtf
namespace xml="http://www.w3.org/XML/1998/namespace";
trace(b.@xml::id); //wtf&lt;/pre&gt;

Note that you didn't have to declare &lt;tt&gt;xmlns:xml="http://www.w3.org/XML/1998/namespace"&lt;/tt&gt; in the &lt;tt&gt;&#60;root/&#62;&lt;/tt&gt; node, but the attribute was clearly scoped to that namespace. That means AS3 respects its implicit existence. :)</description>
		<content:encoded><![CDATA[<p>Interesting! I didn&#8217;t know about <tt>xml:id</tt>. It appears that for processors that support it, the <tt>xml</tt> namespace is bound implicitly to <a href="http://www.w3.org/XML/1998/namespace," rel="nofollow">http://www.w3.org/XML/1998/namespace,</a> and <tt>id</tt> is an attribute scoped to this namespace.</p>
<p>AS3 seems to support this. Hurray! Here are some ways you could extract the <tt>id</tt> attribute. This shows how you can use namespaced attributes as well.</p>
<pre>var b:XML = XML(&apos;&lt;root xmlns=&quot;http://example.com/&quot; xml:id=&quot;wtf&quot; /&gt;&apos;);
trace(b.attributes()[0]); //wtf
trace(b.@id); //null
trace(b.@*::id); //wtf
namespace xml="http://www.w3.org/XML/1998/namespace";
trace(b.@xml::id); //wtf</pre>
<p>Note that you didn&#8217;t have to declare <tt>xmlns:xml=&#8221;http://www.w3.org/XML/1998/namespace&#8221;</tt> in the <tt>&lt;root/&gt;</tt> node, but the attribute was clearly scoped to that namespace. That means AS3 respects its implicit existence. :)</p>
]]></content:encoded>
	</item>
</channel>
</rss>
