<?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 Attribute Filter Doesn&#8217;t Work In Switch Statements</title>
	<atom:link href="http://www.zorked.com/flash/e4x-attribute-filter-doesnt-work-in-switch-statements/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.zorked.com/flash/e4x-attribute-filter-doesnt-work-in-switch-statements/</link>
	<description>Progressive Web Development</description>
	<pubDate>Sun, 05 Jul 2009 02:45:12 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Joe</title>
		<link>http://www.zorked.com/flash/e4x-attribute-filter-doesnt-work-in-switch-statements/#comment-13552</link>
		<dc:creator>Joe</dc:creator>
		<pubDate>Fri, 24 Apr 2009 14:36:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.zorked.com/flash/e4x-attribute-filter-doesnt-work-in-switch-statements/#comment-13552</guid>
		<description>Insane!!

I'm so glad I found this and I'm not going mad. The braces solution works great. Of course you can also solve the problem by branching out of the switch statement into a new function too. Thanks! :-)</description>
		<content:encoded><![CDATA[<p>Insane!!</p>
<p>I&#8217;m so glad I found this and I&#8217;m not going mad. The braces solution works great. Of course you can also solve the problem by branching out of the switch statement into a new function too. Thanks! <img src='http://www.zorked.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: peteSK</title>
		<link>http://www.zorked.com/flash/e4x-attribute-filter-doesnt-work-in-switch-statements/#comment-13091</link>
		<dc:creator>peteSK</dc:creator>
		<pubDate>Mon, 06 Apr 2009 20:01:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.zorked.com/flash/e4x-attribute-filter-doesnt-work-in-switch-statements/#comment-13091</guid>
		<description>Surround your switch case with { }  i.e

switch (anything) {
case "testcase":{
  var xlData:XMLList = xmlData.Books.Book.(@author == 'Dickens');
}
break;
}

should fix it.

If you think about it, it kind of makes sense where the error is  as inside a filter 'this' is scoped to the class however many methods are scoped to the current node thats being filtered.  I can imagine the codes quite messy... :)</description>
		<content:encoded><![CDATA[<p>Surround your switch case with { }  i.e</p>
<p>switch (anything) {<br />
case &#8220;testcase&#8221;:{<br />
  var xlData:XMLList = xmlData.Books.Book.(@author == &#8216;Dickens&#8217;);<br />
}<br />
break;<br />
}</p>
<p>should fix it.</p>
<p>If you think about it, it kind of makes sense where the error is  as inside a filter &#8216;this&#8217; is scoped to the class however many methods are scoped to the current node thats being filtered.  I can imagine the codes quite messy&#8230; <img src='http://www.zorked.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bruce</title>
		<link>http://www.zorked.com/flash/e4x-attribute-filter-doesnt-work-in-switch-statements/#comment-10217</link>
		<dc:creator>Bruce</dc:creator>
		<pubDate>Tue, 24 Feb 2009 17:31:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.zorked.com/flash/e4x-attribute-filter-doesnt-work-in-switch-statements/#comment-10217</guid>
		<description>Yeah, this one nailed me today.  I am surprised with as much e4x filtering as I use it didn't nail me earlier.

I didn't have to use a function to fix, I simply declared the XML variable outside of the switch

var x:XML;

switch(item.name().toString()) {
	case "section":
		x = content_data.section.(name == item.@label)[0];
		break;
						
	case "page":
		x = content_data.section.page.(name == item.@label)[0];
		break;
}</description>
		<content:encoded><![CDATA[<p>Yeah, this one nailed me today.  I am surprised with as much e4x filtering as I use it didn&#8217;t nail me earlier.</p>
<p>I didn&#8217;t have to use a function to fix, I simply declared the XML variable outside of the switch</p>
<p>var x:XML;</p>
<p>switch(item.name().toString()) {<br />
	case &#8220;section&#8221;:<br />
		x = content_data.section.(name == item.@label)[0];<br />
		break;</p>
<p>	case &#8220;page&#8221;:<br />
		x = content_data.section.page.(name == item.@label)[0];<br />
		break;<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike</title>
		<link>http://www.zorked.com/flash/e4x-attribute-filter-doesnt-work-in-switch-statements/#comment-8198</link>
		<dc:creator>Mike</dc:creator>
		<pubDate>Thu, 05 Feb 2009 21:54:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.zorked.com/flash/e4x-attribute-filter-doesnt-work-in-switch-statements/#comment-8198</guid>
		<description>Well, here's the solution I came up with - maybe it will help others:

//inside switch
var xml:XMLList = getFilteredXML(myXML.node1.node2, "languag", "english");
trace(xml);
//end of switch


private function getFilteredXML(_xml:XMLList, _attr:String, _val:String):XMLList {
	return _xml.(attribute(_attr) == _val);
}


Simply takes the E4X filter out of the switch by way of a function call - works well too!</description>
		<content:encoded><![CDATA[<p>Well, here&#8217;s the solution I came up with - maybe it will help others:</p>
<p>//inside switch<br />
var xml:XMLList = getFilteredXML(myXML.node1.node2, &#8220;languag&#8221;, &#8220;english&#8221;);<br />
trace(xml);<br />
//end of switch</p>
<p>private function getFilteredXML(_xml:XMLList, _attr:String, _val:String):XMLList {<br />
	return _xml.(attribute(_attr) == _val);<br />
}</p>
<p>Simply takes the E4X filter out of the switch by way of a function call - works well too!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jordan</title>
		<link>http://www.zorked.com/flash/e4x-attribute-filter-doesnt-work-in-switch-statements/#comment-8197</link>
		<dc:creator>jordan</dc:creator>
		<pubDate>Thu, 05 Feb 2009 21:46:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.zorked.com/flash/e4x-attribute-filter-doesnt-work-in-switch-statements/#comment-8197</guid>
		<description>Nope, I haven't found anything better, unfortunately. Glad this helped you troubleshoot though!</description>
		<content:encoded><![CDATA[<p>Nope, I haven&#8217;t found anything better, unfortunately. Glad this helped you troubleshoot though!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike</title>
		<link>http://www.zorked.com/flash/e4x-attribute-filter-doesnt-work-in-switch-statements/#comment-8190</link>
		<dc:creator>Mike</dc:creator>
		<pubDate>Thu, 05 Feb 2009 21:15:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.zorked.com/flash/e4x-attribute-filter-doesnt-work-in-switch-statements/#comment-8190</guid>
		<description>This has been driving me crazy for days!

Found your site after the bug report gave me better search criteria.

Have you found any solutions other than a giant IF statement?</description>
		<content:encoded><![CDATA[<p>This has been driving me crazy for days!</p>
<p>Found your site after the bug report gave me better search criteria.</p>
<p>Have you found any solutions other than a giant IF statement?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
