<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Barklund.org &#187; XML</title>
	<atom:link href="http://www.barklund.org/blog/category/programming/xml/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.barklund.org/blog</link>
	<description>work smarter when building current web trends</description>
	<lastBuildDate>Wed, 26 May 2010 09:49:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Copy-Paste Injection &#8211; January 2010 Ideas</title>
		<link>http://www.barklund.org/blog/2010/01/16/copy-paste-injection-january-2010-idea/</link>
		<comments>http://www.barklund.org/blog/2010/01/16/copy-paste-injection-january-2010-idea/#comments</comments>
		<pubDate>Sat, 16 Jan 2010 08:00:50 +0000</pubDate>
		<dc:creator>Barklund</dc:creator>
				<category><![CDATA[DOM 2 Traversal and Range]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[January 2010 Ideas]]></category>
		<category><![CDATA[Online Rights]]></category>
		<category><![CDATA[Trends]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.barklund.org/blog/?p=614</guid>
		<description><![CDATA[The sixteenth idea for my 365 social ideas is an idea for a technical tool to assist everyone in getting the credit they deserve and the loyalty they can expect: a copy-paste injection script. It is the very same idea that tynt.com has &#8220;created&#8221;, but they keep the technology (how simple it may be) to [...]


Related posts:<ol><li><a href='http://www.barklund.org/blog/2010/01/22/social-traffic-analyzer-january-2010-idea/' rel='bookmark' title='Permanent Link: Social Traffic Analyzer &#8211; January 2010 Ideas'>Social Traffic Analyzer &#8211; January 2010 Ideas</a></li>
<li><a href='http://www.barklund.org/blog/2010/01/09/comment-on-everything-january-2010-idea/' rel='bookmark' title='Permanent Link: Comment On Everything &#8211; January 2010 Ideas'>Comment On Everything &#8211; January 2010 Ideas</a></li>
<li><a href='http://www.barklund.org/blog/2010/01/07/app-idea-store-january-2010-idea/' rel='bookmark' title='Permanent Link: App Idea Store &#8211; January 2010 Ideas'>App Idea Store &#8211; January 2010 Ideas</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>The sixteenth idea for my <a href="/blog/365ideas/" title="365 Social Ideas from Barklund.org">365 social ideas</a> is an idea for a technical tool to assist everyone in getting the credit they deserve and the loyalty they can expect: a copy-paste injection script. It is the very same idea that <a href="http://www.tynt.com/" title="Tynt.com">tynt.com</a> has &#8220;created&#8221;, but they keep the technology (how simple it may be) to themselves and have <a href="http://www1.tynt.com/patents" title="Tynt.com about patents">even filed for a patent</a>.</p>
<p><span id="more-614"></span></p>
<p>Well, I have implemented a <a href="/examples/copypaste">very simple demo</a> of the first steps. So far, <a href="/examples/copypaste/jquery.copypaste.js">the script</a> only makes sure to add some extra text to the current selection when ever the mouse button is released (which is how most users select most text) and it only works in Firefox (tested in 3.6). Next steps include making the link direct to the actually selected content, record text copying in Google Analytics, add cross-browser checks etc.</p>
<p>The script is published under the same license as these ideas, CC-BY 3.0.</p>
<h4 id="toc-why">Why?</h4>
<p>Copy-paste is another quite common way of interacting with websites and allowing people to easily spread the word about your website in a new way ensures you credit where such is due. Creating a full-featured jQuery-plugin from this should be fairly easy and then making sure it integrates with Google Analytics if present &#8211; and then we&#8217;re actually done.</p>
<h4 id="toc-whats-next">What&#8217;s next?</h4>
<p>Do with this idea whatever you like &#8211; expand, implement, trash or forget. Just remember, that if you use it in anyway make sure to attribute me according to the Creative Commons Attribution 3.0 License, that all these <a href="/blog/365ideas" title="365 Social Ideas from Barklund.org">365 Social Ideas</a> are published under.</p>


<p>Related posts:<ol><li><a href='http://www.barklund.org/blog/2010/01/22/social-traffic-analyzer-january-2010-idea/' rel='bookmark' title='Permanent Link: Social Traffic Analyzer &#8211; January 2010 Ideas'>Social Traffic Analyzer &#8211; January 2010 Ideas</a></li>
<li><a href='http://www.barklund.org/blog/2010/01/09/comment-on-everything-january-2010-idea/' rel='bookmark' title='Permanent Link: Comment On Everything &#8211; January 2010 Ideas'>Comment On Everything &#8211; January 2010 Ideas</a></li>
<li><a href='http://www.barklund.org/blog/2010/01/07/app-idea-store-january-2010-idea/' rel='bookmark' title='Permanent Link: App Idea Store &#8211; January 2010 Ideas'>App Idea Store &#8211; January 2010 Ideas</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.barklund.org/blog/2010/01/16/copy-paste-injection-january-2010-idea/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Advanced E4X &#8211; Assignment to XMLLists</title>
		<link>http://www.barklund.org/blog/2009/11/04/advanced-e4x-assignment-xmllists/</link>
		<comments>http://www.barklund.org/blog/2009/11/04/advanced-e4x-assignment-xmllists/#comments</comments>
		<pubDate>Wed, 04 Nov 2009 10:22:47 +0000</pubDate>
		<dc:creator>Barklund</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[E4X]]></category>

		<guid isPermaLink="false">http://www.barklund.org/blog/?p=422</guid>
		<description><![CDATA[Setup Direct children Descendants Conclusion I was playing around with E4X last night working on an upcoming blog post about the capabilities of E4X. While playing, I was thoroughly reading the ECMA-357 standard, and found that there are some special rules about assignment and compound assignment, that produce truely unexpected results. I will try to [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<div class="toc">
<ol>
<li><a href="http://www.barklund.org/blog/2009/11/04/advanced-e4x-assignment-xmllists/#toc-setup">Setup</a></li>
<li><a href="http://www.barklund.org/blog/2009/11/04/advanced-e4x-assignment-xmllists/#toc-direct-children">Direct children</a></li>
<li><a href="http://www.barklund.org/blog/2009/11/04/advanced-e4x-assignment-xmllists/#toc-descendants">Descendants</a></li>
<li><a href="http://www.barklund.org/blog/2009/11/04/advanced-e4x-assignment-xmllists/#toc-conclusion">Conclusion</a></li>
</ol>
</div>
<p>I was playing around with E4X last night working on an upcoming blog post about the capabilities of E4X. While playing, I was thoroughly reading the ECMA-357 standard, and found that there are some special rules about assignment and compound assignment, that produce truely unexpected results.</p>
<p>I will try to summarize common pitfalls and provide valid work-arounds.</p>
<p><span id="more-422"></span></p>
<h3 id="toc-setup">Setup</h3>
<p>This post will for most examples work on the following document:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #6699cc; font-weight: bold;">var</span> e<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">XML</span> = <span style="color: #000000; font-weight: bold;">&lt;</span>employees<span style="color: #000000; font-weight: bold;">&gt;</span>
	<span style="color: #000000; font-weight: bold;">&lt;</span>person<span style="color: #000000; font-weight: bold;">&gt;</span>
		<span style="color: #000000; font-weight: bold;">&lt;</span>name<span style="color: #000000; font-weight: bold;">&gt;</span>John<span style="color: #000000; font-weight: bold;">&lt;/</span>name<span style="color: #000000; font-weight: bold;">&gt;</span>
		<span style="color: #000000; font-weight: bold;">&lt;</span>age<span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight:bold;">35</span><span style="color: #000000; font-weight: bold;">&lt;/</span>age<span style="color: #000000; font-weight: bold;">&gt;</span>
	<span style="color: #000000; font-weight: bold;">&lt;/</span>person<span style="color: #000000; font-weight: bold;">&gt;</span>
	<span style="color: #000000; font-weight: bold;">&lt;</span>person<span style="color: #000000; font-weight: bold;">&gt;</span>
		<span style="color: #000000; font-weight: bold;">&lt;</span>name<span style="color: #000000; font-weight: bold;">&gt;</span>Joe<span style="color: #000000; font-weight: bold;">&lt;/</span>name<span style="color: #000000; font-weight: bold;">&gt;</span>
		<span style="color: #000000; font-weight: bold;">&lt;</span>age<span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight:bold;">25</span><span style="color: #000000; font-weight: bold;">&lt;/</span>age<span style="color: #000000; font-weight: bold;">&gt;</span>
		<span style="color: #000000; font-weight: bold;">&lt;</span>hobby<span style="color: #000000; font-weight: bold;">&gt;</span>Swimming<span style="color: #000000; font-weight: bold;">&lt;/</span>hobby<span style="color: #000000; font-weight: bold;">&gt;</span>
	<span style="color: #000000; font-weight: bold;">&lt;/</span>person<span style="color: #000000; font-weight: bold;">&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;/</span>employees<span style="color: #000000; font-weight: bold;">&gt;</span></pre></div></div>

<p>Sometimes other documents will be used explicitly.</p>
<h3 id="toc-direct-children">Direct children</h3>
<p>How would you go about changing the hobby of Joe to running? Well, we could traverse all the way to the node:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;">e.person<span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000;">&#93;</span>.hobby = <span style="color: #990000;">&quot;Running&quot;</span>;</pre></div></div>

<p>This of course works as expected. Actually, we ought to be able to skip the index [1], as only the second person has a hobby and thus only this node ought to be the target for the update:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;">e.person.hobby = <span style="color: #990000;">&quot;Running&quot;</span>;</pre></div></div>

<p>But no, this throws a runtime-error:</p>
<blockquote><p>TypeError: Error #1089: Assignment to lists with more than one item is not supported.</p></blockquote>
<p>But it is not a list with more than one item, is it?</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span>e.person.hobby.<span style="color: #004993;">length</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>; <span style="color: #009900;">// traces 1</span></pre></div></div>

<p>The issue here (I expect, I had a hard time figuring out what the spec actually said about it) is, that the second-to-last list in the assignment target has more than one item:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span>e.person.<span style="color: #004993;">length</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>; <span style="color: #009900;">// traces 2</span></pre></div></div>

<p>This can be tested by introducing some extra level of nodes and try to update one of these:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #6699cc; font-weight: bold;">var</span> more_nodes<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">XML</span> = <span style="color: #000000; font-weight: bold;">&lt;</span>employees<span style="color: #000000; font-weight: bold;">&gt;</span>
	<span style="color: #000000; font-weight: bold;">&lt;</span>person<span style="color: #000000; font-weight: bold;">&gt;</span>
		<span style="color: #000000; font-weight: bold;">&lt;</span>name<span style="color: #000000; font-weight: bold;">&gt;</span>John<span style="color: #000000; font-weight: bold;">&lt;/</span>name<span style="color: #000000; font-weight: bold;">&gt;</span>
		<span style="color: #000000; font-weight: bold;">&lt;</span>age<span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight:bold;">35</span><span style="color: #000000; font-weight: bold;">&lt;/</span>age<span style="color: #000000; font-weight: bold;">&gt;</span>
	<span style="color: #000000; font-weight: bold;">&lt;/</span>person<span style="color: #000000; font-weight: bold;">&gt;</span>
	<span style="color: #000000; font-weight: bold;">&lt;</span>person<span style="color: #000000; font-weight: bold;">&gt;</span>
		<span style="color: #000000; font-weight: bold;">&lt;</span>name<span style="color: #000000; font-weight: bold;">&gt;</span>Joe<span style="color: #000000; font-weight: bold;">&lt;/</span>name<span style="color: #000000; font-weight: bold;">&gt;</span>
		<span style="color: #000000; font-weight: bold;">&lt;</span>age<span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight:bold;">25</span><span style="color: #000000; font-weight: bold;">&lt;/</span>age<span style="color: #000000; font-weight: bold;">&gt;</span>
		<span style="color: #000000; font-weight: bold;">&lt;</span>hobby<span style="color: #000000; font-weight: bold;">&gt;</span>
			<span style="color: #000000; font-weight: bold;">&lt;</span>primary<span style="color: #000000; font-weight: bold;">&gt;</span>Swimming<span style="color: #000000; font-weight: bold;">&lt;/</span>primary<span style="color: #000000; font-weight: bold;">&gt;</span>
			<span style="color: #000000; font-weight: bold;">&lt;</span>secondary<span style="color: #000000; font-weight: bold;">&gt;</span>Sewing<span style="color: #000000; font-weight: bold;">&lt;/</span>secondary<span style="color: #000000; font-weight: bold;">&gt;</span>
		<span style="color: #000000; font-weight: bold;">&lt;/</span>hobby<span style="color: #000000; font-weight: bold;">&gt;</span>
	<span style="color: #000000; font-weight: bold;">&lt;/</span>person<span style="color: #000000; font-weight: bold;">&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;/</span>employees<span style="color: #000000; font-weight: bold;">&gt;</span>
<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span>more_nodes.person.<span style="color: #004993;">length</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>; <span style="color: #009900;">// traces 2</span>
<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span>more_nodes.person.hobby.<span style="color: #004993;">length</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>; <span style="color: #009900;">// traces 1</span>
<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span>more_nodes.person.hobby.primary.<span style="color: #004993;">length</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>; <span style="color: #009900;">// traces 1</span>
more_nodes.person.hobby.primary = <span style="color: #990000;">&quot;Running&quot;</span>; <span style="color: #009900;">// no error, updated as expected</span></pre></div></div>

<p>Voila, it works. What this means is, that the error is not related to the actual XMLList, that you are assigning to &#8211; but to the XMLList, that is the parent of this in the statement. We could actually have reached the desired result by adding an extra level to reach the text node inside the (single) hobby node:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;">e.person.hobby.<span style="color: #000000; font-weight: bold;">*</span> = <span style="color: #990000;">&quot;Running&quot;</span>; <span style="color: #009900;">// no error, updated as expected</span></pre></div></div>

<p>In this case again, the second-to-last XMLList (the target object for the assignment) has a length of 1, and the update can be accomplished.</p>
<h3 id="toc-descendants">Descendants</h3>
<p>But if we really just wanted to update the single hobby, that we know only one of the employees have, then we would normally try:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;">e..hobby = <span style="color: #990000;">&quot;Running&quot;</span>;</pre></div></div>

<p>Now things start to get really interesting. Because, what happened? No error was thrown, but the document after this update looks like:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;</span>employees<span style="color: #000000; font-weight: bold;">&gt;</span>
  <span style="color: #000000; font-weight: bold;">&lt;</span>person<span style="color: #000000; font-weight: bold;">&gt;</span>
    <span style="color: #000000; font-weight: bold;">&lt;</span>name<span style="color: #000000; font-weight: bold;">&gt;</span>John<span style="color: #000000; font-weight: bold;">&lt;/</span>name<span style="color: #000000; font-weight: bold;">&gt;</span>
    <span style="color: #000000; font-weight: bold;">&lt;</span>age<span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight:bold;">35</span><span style="color: #000000; font-weight: bold;">&lt;/</span>age<span style="color: #000000; font-weight: bold;">&gt;</span>
  <span style="color: #000000; font-weight: bold;">&lt;/</span>person<span style="color: #000000; font-weight: bold;">&gt;</span>
  <span style="color: #000000; font-weight: bold;">&lt;</span>person<span style="color: #000000; font-weight: bold;">&gt;</span>
    <span style="color: #000000; font-weight: bold;">&lt;</span>name<span style="color: #000000; font-weight: bold;">&gt;</span>Joe<span style="color: #000000; font-weight: bold;">&lt;/</span>name<span style="color: #000000; font-weight: bold;">&gt;</span>
    <span style="color: #000000; font-weight: bold;">&lt;</span>age<span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight:bold;">25</span><span style="color: #000000; font-weight: bold;">&lt;/</span>age<span style="color: #000000; font-weight: bold;">&gt;</span>
    <span style="color: #000000; font-weight: bold;">&lt;</span>hobby<span style="color: #000000; font-weight: bold;">&gt;</span>Swimming<span style="color: #000000; font-weight: bold;">&lt;/</span>hobby<span style="color: #000000; font-weight: bold;">&gt;</span>
  <span style="color: #000000; font-weight: bold;">&lt;/</span>person<span style="color: #000000; font-weight: bold;">&gt;</span>
  <span style="color: #000000; font-weight: bold;">&lt;</span>hobby<span style="color: #000000; font-weight: bold;">&gt;</span>Running<span style="color: #000000; font-weight: bold;">&lt;/</span>hobby<span style="color: #000000; font-weight: bold;">&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;/</span>employees<span style="color: #000000; font-weight: bold;">&gt;</span></pre></div></div>

<p>That is, the existing hobby was unchanged, but a new hobby node has been appended to the end of the outermost node? The statement works the same, as if I had just written:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;">e.hobby = <span style="color: #990000;">&quot;Running&quot;</span>;</pre></div></div>

<p>Which would do exactly that &#8211; create and append a new hobby node to the outermost node and set its text value to &#8220;Running&#8221;. But the two lists aren&#8217;t identical in the original document:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span>e..hobby.<span style="color: #004993;">length</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>; <span style="color: #009900;">// traces 1</span>
<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span>e.hobby.<span style="color: #004993;">length</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>; <span style="color: #009900;">// traces 0</span></pre></div></div>

<p>But again, assignment to xml (and xmllists) does not really have to do with the last part of the assignment target but the penultimate. And again, adding an extra level to reach the text node(s) works:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;">e..hobby.<span style="color: #000000; font-weight: bold;">*</span> = <span style="color: #990000;">&quot;Running&quot;</span>; <span style="color: #009900;">// no error, and this time updated as expected</span></pre></div></div>

<p>Why the previous statement seemed to ignore the descendant-part of the statement, I&#8217;m not really sure. Could be a bug, could be a loop-hole, but it definitely does not make sense.</p>
<p>There are many other ways to reach the same list of the single hobby node when simply consuming, but they cannot all be used in the same way when updating:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;">e..<span style="color: #000000; font-weight: bold;">*</span>.hobby = <span style="color: #990000;">&quot;Running&quot;</span>; <span style="color: #009900;">// throws the same Error #1089 about more-than-one element lists</span>
e..<span style="color: #000000; font-weight: bold;">*</span>.hobby.<span style="color: #000000; font-weight: bold;">*</span> = <span style="color: #990000;">&quot;Running&quot;</span>; <span style="color: #009900;">// and it works again</span>
&nbsp;
e.<span style="color: #004993;">descendants</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>.hobby = <span style="color: #990000;">&quot;Running&quot;</span>; <span style="color: #009900;">// throws the same Error #1089 about more-than-one element lists</span>
e.<span style="color: #004993;">descendants</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>.hobby.<span style="color: #000000; font-weight: bold;">*</span> = <span style="color: #990000;">&quot;Running&quot;</span>; <span style="color: #009900;">// and it works again</span>
&nbsp;
e.<span style="color: #004993;">descendants</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">'hobby'</span><span style="color: #000000;">&#41;</span> = <span style="color: #990000;">&quot;Running&quot;</span>; <span style="color: #009900;">// compile-time error</span>
<span style="color: #009900;">// the parser simply does not allow assigning to a function invocation</span>
e.<span style="color: #004993;">descendants</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">'hobby'</span><span style="color: #000000;">&#41;</span>.<span style="color: #000000; font-weight: bold;">*</span> = <span style="color: #990000;">&quot;Running&quot;</span>; <span style="color: #009900;">// and it works again</span>
&nbsp;
e..<span style="color: #000000; font-weight: bold;">*</span>.<span style="color: #000000;">&#40;</span><span style="color: #004993;">localName</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>==<span style="color: #990000;">'hobby'</span><span style="color: #000000;">&#41;</span> = <span style="color: #990000;">&quot;Running&quot;</span>; <span style="color: #009900;">// compile-time error</span>
<span style="color: #009900;">// the parser simply does not allow assigning to (what looks like) a function invocation</span>
e..<span style="color: #000000; font-weight: bold;">*</span>.<span style="color: #000000;">&#40;</span><span style="color: #004993;">localName</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>==<span style="color: #990000;">'hobby'</span><span style="color: #000000;">&#41;</span>.<span style="color: #000000; font-weight: bold;">*</span> = <span style="color: #990000;">&quot;Running&quot;</span>; <span style="color: #009900;">// and it works again</span></pre></div></div>

<h3 id="toc-conclusion">Conclusion</h3>
<p>Be aware that assignments to XMLLists does not care about the last list &#8211; it is the second-to-last list, that must contain only one value. Internally, a statement like:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;">expression.property = <span style="color: #004993;">value</span>;</pre></div></div>

<p>Is not a new thing at all, but it is handled in a new, special way, when <code>expression</code> has a value of either XML or XMLList. Thus, if you either get compile-time errors, runtime-errors or nodes appended in completely wrong places, just add extra level of element traversal with the wildcard-identifier <code>.*</code> to reach the text node of the single node you want to update.</p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.barklund.org/blog/2009/11/04/advanced-e4x-assignment-xmllists/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Implementers of DOM Level 2 Traversal and Range</title>
		<link>http://www.barklund.org/blog/2009/09/08/implementors-dom-2-traversal-and-range/</link>
		<comments>http://www.barklund.org/blog/2009/09/08/implementors-dom-2-traversal-and-range/#comments</comments>
		<pubDate>Tue, 08 Sep 2009 14:18:29 +0000</pubDate>
		<dc:creator>Barklund</dc:creator>
				<category><![CDATA[API]]></category>
		<category><![CDATA[DOM 2 Traversal and Range]]></category>

		<guid isPermaLink="false">http://www.barklund.org/blog/?p=356</guid>
		<description><![CDATA[Having found an interest in the DOM Level 2 Traversal and Range specification I will try to gather information about implementations first. Before even testing whether implementations are conformant and/or where their differences lie, I will try simply to list all implementations. A list of popular XML tools implementing DOM in some way Name Language [...]


Related posts:<ol><li><a href='http://www.barklund.org/blog/2009/06/22/cctlds-for-second-level-foreign-registration/' rel='bookmark' title='Permanent Link: ccTLD&#8217;s for second-level foreign registration'>ccTLD&#8217;s for second-level foreign registration</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Having <a href="http://lists.w3.org/Archives/Public/www-dom/2009JulSep/0259.html" title="My initial post on the www-dom@w3 mailing list">found an interest</a> in the <a href="http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113/" title="Document Object Model (DOM) Level 2 Traversal and Range Specification from w3.org">DOM Level 2 Traversal and Range specification</a> I will try to gather information about implementations first.</p>
<p>Before even testing whether implementations are conformant and/or where their differences lie, I will try simply to list all implementations.</p>
<p><span id="more-356"></span></p>
<table border="1">
<caption>A list of popular XML tools implementing DOM in some way</caption>
<col style="width: 100px" />
<col style="width: 100px" />
<col style="width: 70px" />
<col style="width: 70px" />
<thead>
<tr>
<th>Name</th>
<th>Language</th>
<th>Traversal</th>
<th>Range</th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="http://pyxml.sourceforge.net/topics/">pyXML</a></td>
<td>Python</td>
<td>Yes</td>
<td>No</td>
</tr>
<tr>
<td><a href="http://cpan.uwinnipeg.ca/htdocs/XML-LibXML-Iterator/XML/LibXML/Iterator.html">LibXML</a></td>
<td>Perl</td>
<td>Partial</td>
<td>No</td>
</tr>
<tr>
<td><a href="http://xerces.apache.org/">Xerces</a></td>
<td>Java</td>
<td>Yes</td>
<td>Yes</td>
</tr>
<tr>
<td>libxml2/gdome2</td>
<td>C</td>
<td>No</td>
<td>No</td>
</tr>
<tr>
<td>MSXML</td>
<td>.NET</td>
<td>No</td>
<td>No</td>
</tr>
<tr>
<td><a href="http://hackage.haskell.org/cgi-bin/hackage-scripts/package/DOM">Data.DOM</a></td>
<td>Haskell</td>
<td>Yes</td>
<td>Yes</td>
</tr>
<tr>
<td>Trident</td>
<td>JavaScript</td>
<td>No</td>
<td>No</td>
<tr>
<td>Tasman</td>
<td>JavaScript</td>
<td>Unknown</td>
<td>Unknown</td>
<tr>
<td>Gecko</td>
<td>JavaScript</td>
<td>Yes</td>
<td>Yes</td>
<tr>
<td>Webkit</td>
<td>JavaScript</td>
<td>Unknown</td>
<td>Yes</td>
</tr>
<tr>
<td>KHTML</td>
<td>JavaScript</td>
<td>Unknown</td>
<td>Unknown</td>
<tr>
<td>Presto</td>
<td>JavaScript</td>
<td>Yes</td>
<td>Yes</td>
<tr>
<td>iCab</td>
<td>JavaScript</td>
<td>Unknown</td>
<td>Unknown</td>
</tr>
</tbody>
</table>
<p>It is noteworthy, that while LibXML (like many other libraries) is based on libxml2 (which in itself does not implement either traversal nor range) LibXML has a partial implementation of DOM2 Traversal.</p>
<p>If you know of any other implementations of DOM and particularly implementations of either traversal or range, please comment.</p>
<h3 id="toc-references">References</h3>
<p>Some of this has been found simply by googling, some has been found through <a href="http://www.w3.org/DOM/Bindings">the DOM bindings list</a> and some found at <a href="http://en.wikipedia.org/wiki/Comparison_of_layout_engines_%28Document_Object_Model%29" title="Comparison of layout engines (Document Object Model) on Wikipedia">Wikipedia about DOM comparison</a>. Finally I found <a href="http://www.xml.com/pub/rg/DOM_Software">this list of DOM software</a>, which has many other open or commercial implementations, that I will have to look through &#8211; many of them seem to use one of the above-mentioned, many only support DOM1, but the list might add some relevant implementations.<br />


<p>Related posts:<ol><li><a href='http://www.barklund.org/blog/2009/06/22/cctlds-for-second-level-foreign-registration/' rel='bookmark' title='Permanent Link: ccTLD&#8217;s for second-level foreign registration'>ccTLD&#8217;s for second-level foreign registration</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.barklund.org/blog/2009/09/08/implementors-dom-2-traversal-and-range/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
