<?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>Tue, 24 Jan 2012 05:31:03 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Danny Kopping</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-63660</link>
		<dc:creator>Danny Kopping</dc:creator>
		<pubDate>Tue, 03 May 2011 23:11:23 +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-63660</guid>
		<description>&lt;p&gt;You rock Mr Morearty!&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>You rock Mr Morearty!</p>]]></content:encoded>
	</item>
	<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>&lt;p&gt;Thanks for saving me a LOT of time which I&#039;d have spent figuring this out myself ^^&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Thanks for saving me a LOT of time which I'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>&lt;p&gt;Thanks for this post, for the past 30 mins I thought I was going nuts. This did the trick, keep up the good work!&lt;/p&gt;
</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>&lt;p&gt;Thanks. This trick saved me time.&lt;/p&gt;
</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>&lt;p&gt;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;:&lt;/p&gt;

&lt;p&gt;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);&lt;/p&gt;

&lt;p&gt;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 ).&lt;/p&gt;
</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 = 
  &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);</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>&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;BTW, do you have any suggestions for the best technique for testing for existence of a node?&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>A great suggestion. I hope you don'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>&lt;p&gt;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...&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Thanks!!! Your post saved me some hours !
I don't know if it's only me but the Flex doc is sometimes hard to understand...especially the XML/XMLList part...</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>&lt;p&gt;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&lt;/p&gt;

&lt;p&gt;hasOwnProperty(&quot;@x&quot;) &amp;&amp; @x == &quot;y&quot;&lt;/p&gt;

&lt;p&gt;whereas if you use the attribute() function, it&#039;s cleaner:&lt;/p&gt;

&lt;p&gt;attribute(&quot;x&quot;) == &quot;y&quot;&lt;/p&gt;
</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'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>&lt;p&gt;if (selectedNode.hasOwnProperty(&quot;@link&quot;) == true) {&lt;/p&gt;
</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>&lt;p&gt;Thanks Mike.
Handy tip. And its not really that ugly...&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Thanks Mike.
Handy tip. And its not really that ugly...</p>]]></content:encoded>
	</item>
</channel>
</rss>

