<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: E4X tip: writing expressions to test attributes that may not exist</title>
	<atom:link href="http://www.morearty.com/blog/2006/11/01/e4x-tip-and-quiz-writing-expressions-to-test-attributes-that-may-not-exist/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.morearty.com/blog/2006/11/01/e4x-tip-and-quiz-writing-expressions-to-test-attributes-that-may-not-exist/</link>
	<description>Mike Morearty&#039;s blog</description>
	<lastBuildDate>Thu, 26 Aug 2010 01:50:50 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: Bart vbl</title>
		<link>http://www.morearty.com/blog/2006/11/01/e4x-tip-and-quiz-writing-expressions-to-test-attributes-that-may-not-exist/comment-page-1/#comment-62695</link>
		<dc:creator>Bart vbl</dc:creator>
		<pubDate>Mon, 05 Jul 2010 10:32:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.morearty.com/blog/2006/11/01/e4x-tip-and-quiz-writing-expressions-to-test-attributes-that-may-not-exist/#comment-62695</guid>
		<description>Thanks for saving me a LOT of time which I&#039;d have spent figuring this out myself ^^</description>
		<content:encoded><![CDATA[<p>Thanks for saving me a LOT of time which I&#8217;d have spent figuring this out myself ^^</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jesse Freeman</title>
		<link>http://www.morearty.com/blog/2006/11/01/e4x-tip-and-quiz-writing-expressions-to-test-attributes-that-may-not-exist/comment-page-1/#comment-50983</link>
		<dc:creator>Jesse Freeman</dc:creator>
		<pubDate>Thu, 28 Aug 2008 19:04:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.morearty.com/blog/2006/11/01/e4x-tip-and-quiz-writing-expressions-to-test-attributes-that-may-not-exist/#comment-50983</guid>
		<description>Thanks for this post, for the past 30 mins I thought I was going nuts. This did the trick, keep up the good work!</description>
		<content:encoded><![CDATA[<p>Thanks for this post, for the past 30 mins I thought I was going nuts. This did the trick, keep up the good work!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Oleg</title>
		<link>http://www.morearty.com/blog/2006/11/01/e4x-tip-and-quiz-writing-expressions-to-test-attributes-that-may-not-exist/comment-page-1/#comment-34734</link>
		<dc:creator>Oleg</dc:creator>
		<pubDate>Thu, 17 Jan 2008 11:51:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.morearty.com/blog/2006/11/01/e4x-tip-and-quiz-writing-expressions-to-test-attributes-that-may-not-exist/#comment-34734</guid>
		<description>Thanks. This trick saved me time.</description>
		<content:encoded><![CDATA[<p>Thanks. This trick saved me time.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mike</title>
		<link>http://www.morearty.com/blog/2006/11/01/e4x-tip-and-quiz-writing-expressions-to-test-attributes-that-may-not-exist/comment-page-1/#comment-33850</link>
		<dc:creator>mike</dc:creator>
		<pubDate>Thu, 03 Jan 2008 06:12:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.morearty.com/blog/2006/11/01/e4x-tip-and-quiz-writing-expressions-to-test-attributes-that-may-not-exist/#comment-33850</guid>
		<description>Rick, use the elements() function, and test that the XMLList returned by the elements() function has a length of 1 or greater.  For example, to return a list of nodes of type &quot;child&quot;, but only those ones that contain another element called &quot;grandchild&quot;:

var myxmlvar:XML = 
  &lt;root&gt;
    &lt;thing1 id=&quot;1&quot;/&gt;
    &lt;thing1 id=&quot;2&quot;&gt; &lt;thing2/&gt; &lt;/thing1&gt;
  &lt;/root&gt;;
var mylist:XMLList = myxmlvar.thing1.(elements(&quot;thing2&quot;).length() &gt; 0);

To learn more about functions such as attribute() and elements(), see the documentation for class XML ( http://livedocs.adobe.com/flex/201/langref/XML.html ) and class XMLList ( http://livedocs.adobe.com/flex/201/langref/XMLList.html ).</description>
		<content:encoded><![CDATA[<p>Rick, use the elements() function, and test that the XMLList returned by the elements() function has a length of 1 or greater.  For example, to return a list of nodes of type &quot;child&quot;, but only those ones that contain another element called &quot;grandchild&quot;:</p>
<p>var myxmlvar:XML =<br />
  &lt;root&gt;<br />
    &lt;thing1 id=&quot;1&quot;/&gt;<br />
    &lt;thing1 id=&quot;2&quot;&gt; &lt;thing2/&gt; &lt;/thing1&gt;<br />
  &lt;/root&gt;;<br />
var mylist:XMLList = myxmlvar.thing1.(elements(&quot;thing2&quot;).length() &gt; 0);</p>
<p>To learn more about functions such as attribute() and elements(), see the documentation for class XML ( <a href="http://livedocs.adobe.com/flex/201/langref/XML.html" rel="nofollow">http://livedocs.adobe.com/flex/201/langref/XML.html</a> ) and class XMLList ( <a href="http://livedocs.adobe.com/flex/201/langref/XMLList.html" rel="nofollow">http://livedocs.adobe.com/flex/201/langref/XMLList.html</a> ).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rick T</title>
		<link>http://www.morearty.com/blog/2006/11/01/e4x-tip-and-quiz-writing-expressions-to-test-attributes-that-may-not-exist/comment-page-1/#comment-33845</link>
		<dc:creator>Rick T</dc:creator>
		<pubDate>Thu, 03 Jan 2008 02:35:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.morearty.com/blog/2006/11/01/e4x-tip-and-quiz-writing-expressions-to-test-attributes-that-may-not-exist/#comment-33845</guid>
		<description>A great suggestion. I hope you don&#039;t mind that I mentioned your blog on the Adobe site in response to a query about this topic.

BTW, do you have any suggestions for the best technique for testing for existence of a node?</description>
		<content:encoded><![CDATA[<p>A great suggestion. I hope you don&#8217;t mind that I mentioned your blog on the Adobe site in response to a query about this topic.</p>
<p>BTW, do you have any suggestions for the best technique for testing for existence of a node?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: William G</title>
		<link>http://www.morearty.com/blog/2006/11/01/e4x-tip-and-quiz-writing-expressions-to-test-attributes-that-may-not-exist/comment-page-1/#comment-29399</link>
		<dc:creator>William G</dc:creator>
		<pubDate>Tue, 16 Oct 2007 08:54:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.morearty.com/blog/2006/11/01/e4x-tip-and-quiz-writing-expressions-to-test-attributes-that-may-not-exist/#comment-29399</guid>
		<description>Thanks!!! Your post saved me some hours !
I don&#039;t know if it&#039;s only me but the Flex doc is sometimes hard to understand...especially the XML/XMLList part...</description>
		<content:encoded><![CDATA[<p>Thanks!!! Your post saved me some hours !<br />
I don&#8217;t know if it&#8217;s only me but the Flex doc is sometimes hard to understand&#8230;especially the XML/XMLList part&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mike</title>
		<link>http://www.morearty.com/blog/2006/11/01/e4x-tip-and-quiz-writing-expressions-to-test-attributes-that-may-not-exist/comment-page-1/#comment-11785</link>
		<dc:creator>mike</dc:creator>
		<pubDate>Sun, 28 Jan 2007 07:29:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.morearty.com/blog/2006/11/01/e4x-tip-and-quiz-writing-expressions-to-test-attributes-that-may-not-exist/#comment-11785</guid>
		<description>Yes, selectedNode.hasOwnProperty() can be used to tell whether an attribute is present on a node, which is sufficient in some cases; but usually, you want to test for certain values.  For example, if you want to select only nodes that have an &quot;x&quot; attribute equal to &quot;y&quot;, then using hasOwnProperty, you would have to write

  hasOwnProperty(&quot;@x&quot;) &amp;&amp; @x == &quot;y&quot;

whereas if you use the attribute() function, it&#039;s cleaner:

  attribute(&quot;x&quot;) == &quot;y&quot;</description>
		<content:encoded><![CDATA[<p>Yes, selectedNode.hasOwnProperty() can be used to tell whether an attribute is present on a node, which is sufficient in some cases; but usually, you want to test for certain values.  For example, if you want to select only nodes that have an &quot;x&quot; attribute equal to &quot;y&quot;, then using hasOwnProperty, you would have to write</p>
<p>  hasOwnProperty(&quot;@x&quot;) &amp;&amp; @x == &quot;y&quot;</p>
<p>whereas if you use the attribute() function, it&#8217;s cleaner:</p>
<p>  attribute(&quot;x&quot;) == &quot;y&quot;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alex</title>
		<link>http://www.morearty.com/blog/2006/11/01/e4x-tip-and-quiz-writing-expressions-to-test-attributes-that-may-not-exist/comment-page-1/#comment-11762</link>
		<dc:creator>Alex</dc:creator>
		<pubDate>Sat, 27 Jan 2007 23:18:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.morearty.com/blog/2006/11/01/e4x-tip-and-quiz-writing-expressions-to-test-attributes-that-may-not-exist/#comment-11762</guid>
		<description>if (selectedNode.hasOwnProperty(&quot;@link&quot;) == true) {</description>
		<content:encoded><![CDATA[<p>if (selectedNode.hasOwnProperty(&quot;@link&quot;) == true) {</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Marcus</title>
		<link>http://www.morearty.com/blog/2006/11/01/e4x-tip-and-quiz-writing-expressions-to-test-attributes-that-may-not-exist/comment-page-1/#comment-4340</link>
		<dc:creator>Marcus</dc:creator>
		<pubDate>Thu, 02 Nov 2006 07:27:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.morearty.com/blog/2006/11/01/e4x-tip-and-quiz-writing-expressions-to-test-attributes-that-may-not-exist/#comment-4340</guid>
		<description>Thanks Mike.
Handy tip. And its not really that ugly...</description>
		<content:encoded><![CDATA[<p>Thanks Mike.<br />
Handy tip. And its not really that ugly&#8230;</p>
]]></content:encoded>
	</item>
</channel>
</rss>
