﻿<?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>Keith Hair &#187; XML</title>
	<atom:link href="http://keith-hair.net/blog/tag/xml/feed/" rel="self" type="application/rss+xml" />
	<link>http://keith-hair.net/blog</link>
	<description>Scripting is fun like any other hobby</description>
	<lastBuildDate>Sat, 28 Jan 2012 05:04:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Concatenation Tool</title>
		<link>http://keith-hair.net/blog/2012/01/08/concatenation-tool/</link>
		<comments>http://keith-hair.net/blog/2012/01/08/concatenation-tool/#comments</comments>
		<pubDate>Sun, 08 Jan 2012 09:41:13 +0000</pubDate>
		<dc:creator>Keith H</dc:creator>
				<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[JSFL]]></category>
		<category><![CDATA[XML]]></category>
		<category><![CDATA[CAML]]></category>
		<category><![CDATA[combo]]></category>
		<category><![CDATA[Concatenation]]></category>
		<category><![CDATA[Jquery]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[String]]></category>
		<category><![CDATA[videogames]]></category>
		<category><![CDATA[XUL]]></category>

		<guid isPermaLink="false">http://keith-hair.net/blog/?p=393</guid>
		<description><![CDATA[String'n together combos isn't always as fun as doing them in a fighting videogame. If you write script that has a lot String content mixed with variables, I'm sure you're doing a lot of heavy concatenation. Building string combos with quotes and apostrophes sprinkled all over a script gets confusing. The way I like to [...]]]></description>
			<content:encoded><![CDATA[<p>String'n together combos isn't always as fun as doing them in a fighting videogame.<a href="http://keith-hair.net/blog/wp-content/uploads/2012/01/Tekken-Street-2-Piki_thumb.jpg" rel="lightbox[393]"><img src="http://keith-hair.net/blog/wp-content/uploads/2012/01/Tekken-Street-2-Piki_thumb-150x150.jpg" alt="" title="Tekken-Street-2-Piki_thumb" width="150" height="150" class="alignleft size-thumbnail wp-image-431" /></a><a href="http://keith-hair.net/works/2011/concatenator/" target="_blank"><img src="http://keith-hair.net/blog/wp-content/uploads/2012/01/concatenatorUI1-150x150.jpg" alt="" title="concatenatorUI" width="150" height="150" class="alignright size-thumbnail wp-image-441" /></a></p>
<p>If you write script that has a lot String content mixed with variables, I'm sure you're doing a lot of heavy concatenation.<br />
Building string combos with quotes and apostrophes sprinkled all over a script gets confusing. The way I like to keep this confusion to a minimum is to write my static markup separately. This allows me to make sure it shows up as intended. Then I concatenate my variables in all the places that need to have dynamic content.</p>
<p>Taking static markup or script and wrapping quotes around every line is a chore so I made this <a href="http://keith-hair.net/works/2011/concatenator/" title="Concatenation Tool" target="_blank">Concatenation Tool</a> to help with that.</p>
<p>Currently I've only made this support languages I'm using mostly. If I have to use a new language I'd just add it in.<br />
<span id="more-393"></span></p>
<p>Below are some basic use case examples of where a concatenation tool can be useful. </p>
<hr></hr>
<p><strong>JavaScript</strong><br />
<em>Concatenating a content to add to a Jquery UI Dialog.<br />
In this example I purposely used he "text()" method to show the XML content instead of "html()".</em></p>
<pre class="brush: jscript; title: ; notranslate">
    &lt;script type=&quot;text/javascript&quot;&gt;
                $(document).ready(function(){
                var ns = &quot;&quot;;
                ns += &quot;&lt;LIBRARY&gt;&quot;;
                ns += &quot;    &lt;BOOK&gt;&quot;;
                ns += &quot;        &lt;TITLE id=\&quot;2356\&quot;&gt;Charlotte's Web&lt;/TITLE&gt;&quot;;
                ns += &quot;        &lt;AUTHOR&gt;E. B. White&lt;/AUTHOR&gt;&quot;;
                ns += &quot;        &lt;FAMOUS_SAYING&gt;\&quot;Always be on the lookout for the presence of wonder.\&quot;&lt;/FAMOUS_SAYING&gt;&quot;;
                ns += &quot;    &lt;/BOOK&gt;&quot;;
                ns += &quot;    &lt;BOOK&gt;&quot;;
                ns += &quot;        &lt;TITLE id=\&quot;95\&quot;&gt;Scuffy the Tugboat&lt;/TITLE&gt;&quot;;
                ns += &quot;        &lt;AUTHOR&gt;Gertrude Crampton&lt;/AUTHOR&gt;&quot;;
                ns += &quot;        &lt;FAMOUS_SAYING&gt;\&quot;Toot, tooot!\&quot; cried the frightened tugboat.&lt;/FAMOUS_SAYING&gt;&quot;;
                ns += &quot;    &lt;/BOOK&gt;&quot;;
                ns += &quot;&lt;/LIBRARY&gt;&quot;;
                $(&quot;#myDialog&quot;).dialog({width:400, height:400});
                $(&quot;#myDialog p&quot;).text(ns);
                });
    &lt;/script&gt;
</pre>
<p><a href="http://keith-hair.net/blog/wp-content/uploads/2012/01/jqueryui_sample.jpg" rel="lightbox[393]"><img src="http://keith-hair.net/blog/wp-content/uploads/2012/01/jqueryui_sample.jpg" alt="" title="jqueryui_sample" width="462" height="427" class="alignnone size-full wp-image-409" /></a></p>
<hr></hr>
<p><strong>Python</strong><br />
<em>Concatenating with qoutes</em></p>
<pre class="brush: python; title: ; notranslate">
ns = &quot;&quot;
ns += &quot;&lt;LIBRARY&gt;&quot;
ns += &quot;    &lt;BOOK&gt;&quot;
ns += &quot;        &lt;TITLE id=\&quot;2356\&quot;&gt;Charlotte's Web&lt;/TITLE&gt;&quot;
ns += &quot;        &lt;AUTHOR&gt;E. B. White&lt;/AUTHOR&gt;&quot;
ns += &quot;        &lt;FAMOUS_SAYING&gt;\&quot;Always be on the lookout for the presence of wonder.\&quot;&lt;/FAMOUS_SAYING&gt;&quot;
ns += &quot;    &lt;/BOOK&gt;&quot;
ns += &quot;    &lt;BOOK&gt;&quot;
ns += &quot;        &lt;TITLE id=\&quot;95\&quot;&gt;Scuffy the Tugboat&lt;/TITLE&gt;&quot;
ns += &quot;        &lt;AUTHOR&gt;Gertrude Crampton&lt;/AUTHOR&gt;&quot;
ns += &quot;        &lt;FAMOUS_SAYING&gt;\&quot;Toot, tooot!\&quot; cried the frightened tugboat.&lt;/FAMOUS_SAYING&gt;&quot;
ns += &quot;    &lt;/BOOK&gt;&quot;
ns += &quot;&lt;/LIBRARY&gt;&quot;
print(ns)
</pre>
<p><em>Python concatenation with triple quotes to preserve the carriage returns</em></p>
<pre class="brush: python; title: ; notranslate">
ns=&quot;&quot;&quot;&lt;LIBRARY&gt;
    &lt;BOOK&gt;
        &lt;TITLE id=&quot;2356&quot;&gt;Charlotte's Web&lt;/TITLE&gt;
        &lt;AUTHOR&gt;E. B. White&lt;/AUTHOR&gt;
        &lt;FAMOUS_SAYING&gt;&quot;Always be on the lookout for the presence of wonder.&quot;&lt;/FAMOUS_SAYING&gt;
    &lt;/BOOK&gt;
    &lt;BOOK&gt;
        &lt;TITLE id=&quot;95&quot;&gt;Scuffy the Tugboat&lt;/TITLE&gt;
        &lt;AUTHOR&gt;Gertrude Crampton&lt;/AUTHOR&gt;
        &lt;FAMOUS_SAYING&gt;&quot;Toot, tooot!&quot; cried the frightened tugboat.&lt;/FAMOUS_SAYING&gt;
    &lt;/BOOK&gt;
&lt;/LIBRARY&gt;&quot;&quot;&quot;
print(ns)
</pre>
<p><em>Concatenation with regular quotes</em><br />
<a href="http://keith-hair.net/blog/wp-content/uploads/2012/01/samplepy2.jpg" rel="lightbox[393]"><img src="http://keith-hair.net/blog/wp-content/uploads/2012/01/samplepy2.jpg" alt="" title="Concatenation of blocks of text with triple quotes" width="682" height="358" class="alignnone size-full wp-image-413" /></a></p>
<p><em>Concatenation of blocks of text with triple quotes</em><br />
<a href="http://keith-hair.net/blog/wp-content/uploads/2012/01/samplepy1.jpg" rel="lightbox[393]"><img src="http://keith-hair.net/blog/wp-content/uploads/2012/01/samplepy1.jpg" alt="" title="Concatenation with regular quotes" width="698" height="357" class="alignnone size-full wp-image-412" /></a></p>
<hr></hr>
<p><strong>JSFL</strong><br />
<em>Concatenating a XUL markup string for building Flash IDE Panel with JSFL.</em></p>
<pre class="brush: jscript; title: ; notranslate">
if(fl.documents.length == 0){
	fl.createDocument(&quot;timeline&quot;);
}
//------------------------------------------------------------
//An existing folder for the panel's source to be written to.
//------------------------------------------------------------
var appFolderName=&quot;jsflUI_sample&quot;;
var date=new Date();
function writePanelSource()
{
	var code = '';
	code += '&lt;overlay&gt;';
	code += '	&lt;dialog id=&quot;app&quot; title=&quot;Sample UI&quot;&gt;';
	code += '		&lt;hbox&gt;';
	code += '			&lt;spacer/&gt;';
	code += '			&lt;button id=&quot;b0&quot; label=&quot;Button&quot;/&gt;';
	code += '		&lt;/hbox&gt;';
	code += '		&lt;separator/&gt;';
	code += '		&lt;vbox&gt;';
	code += '			&lt;label control=&quot;f0&quot; value=&quot;Field 1&quot; align=&quot;left&quot;/&gt;';
	code += '			&lt;textbox id=&quot;f0&quot; size=&quot;50&quot; value=&quot;'+date.toString()+'&quot;/&gt;';
	code += '			&lt;label control=&quot;f1&quot; value=&quot;Field 2:&quot; align=&quot;left&quot;/&gt;';
	code += '			&lt;textbox id=&quot;f1&quot; size=&quot;50&quot; value=&quot;&quot;/&gt;';
	code += '		&lt;/vbox&gt;';
	code += '		&lt;checkbox id=&quot;cb0&quot; label=&quot;Checkbox 1&quot; checked=&quot;false&quot; /&gt;';
	code += '		&lt;checkbox id=&quot;cb1&quot; label=&quot;Checkbox 2&quot; checked=&quot;false&quot; /&gt;';
	code += '	&lt;/dialog&gt;';
	code += '&lt;/overlay&gt;';
	FLfile.write(fl.configURI + &quot;Commands/&quot;+appFolderName+&quot;/panelsource.xml&quot;, code);
	return code;
}

//----------------------------------------------------------------
//Writes the markup to &quot;appFolderName&quot; of Flash's &quot;Commands folder
//----------------------------------------------------------------
writePanelSource();

//-------------------------------
//Open the Panel in Flash's IDE
//-------------------------------
fl.getDocumentDOM().xmlPanel(fl.configURI + &quot;Commands/&quot;+appFolderName+&quot;/panelsource.xml&quot;);
</pre>
<p><em>Panel UI dialog from JSFL</em><br />
<a href="http://keith-hair.net/blog/wp-content/uploads/2012/01/jsflUI_sample.jpg" rel="lightbox[393]"><img src="http://keith-hair.net/blog/wp-content/uploads/2012/01/jsflUI_sample.jpg" alt="" title="jsflUI_sample" class="alignnone"/></a></p>
<hr></hr>
<p><strong>SharePoint</strong><br />
<em>Concatenating CAML querys.</em></p>
<pre class="brush: jscript; title: ; notranslate">
function getListData()
{
	var clientContext = new SP.ClientContext.get_current();
	var web = clientContext.get_web();
	var userInfoList = web.get_lists().getByTitle('user_list')
	var camlQuery = new SP.CamlQuery();
	var caml = '';
	caml += '&lt;View&gt;';
	caml += '	&lt;Query&gt;';
	caml += '		&lt;OrderBy&gt;';
	caml += '			&lt;FieldRef Name=&quot;Title&quot; Ascending=&quot;False&quot; /&gt;';
	caml += '		&lt;/OrderBy&gt;';
	caml += '	&lt;/Query&gt;';
	caml += '&lt;/View&gt;';
	camlQuery.set_viewXml(caml);
	collListItem = userInfoList.getItems(camlQuery);
	clientContext.load(collListItem);
	var onQuerySucceeded=function(sender, args)
	{
		var oitem;
		var s='';
		var n=0;
		var len=collListItem.get_count();
		var results=[];
		while(n &lt; len)
		{
			oitem = collListItem.itemAt(n);
			s+=&quot;Title:&quot;+oitem.get_item(&quot;Title&quot;)+&quot;&lt;br&gt;&lt;/br&gt;&quot;;
			n++;
		}
		$(&quot;#output&quot;).append(s);
	}
	var onQueryFailed=function(sender, args)
	{
		alert(&quot;Failed getting data.&quot;)
	}
	clientContext.executeQueryAsync
        (
        Function.createDelegate(this, onQuerySucceeded),
        Function.createDelegate(this, onQueryFailed)
        );
}
</pre>
<p><em>Output of Title column from a SharePoint 2010 list.</em><br />
<a href="http://keith-hair.net/blog/wp-content/uploads/2012/01/sharepoint_sample.jpg" rel="lightbox[393]"><img src="http://keith-hair.net/blog/wp-content/uploads/2012/01/sharepoint_sample.jpg" alt="" title="SharePoint output" width="427" height="376" class="alignnone size-full wp-image-423" /></a></p>
<a href='http://www.hexosearch.com/se/submit.aspx?zlvz=&zqz=&zurlz=http://keith-hair.net/blog/2012/01/08/concatenation-tool/&ztz=Concatenation Tool'><img src='http://keith-hair.net/blog/wp-content/plugins/hexosearch-button/logo16x16.png' width='16' height='16' border='0' style='vertical-align:middle' alt='Vote in HexoSearch' title='Vote in HexoSearch' /></a>]]></content:encoded>
			<wfw:commentRss>http://keith-hair.net/blog/2012/01/08/concatenation-tool/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Appending Nodes to an XMLList in AS3</title>
		<link>http://keith-hair.net/blog/2011/10/08/appending-nodes-to-an-xmllist-in-as3/</link>
		<comments>http://keith-hair.net/blog/2011/10/08/appending-nodes-to-an-xmllist-in-as3/#comments</comments>
		<pubDate>Sun, 09 Oct 2011 01:40:49 +0000</pubDate>
		<dc:creator>Keith H</dc:creator>
				<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[XML]]></category>
		<category><![CDATA[appendChild]]></category>
		<category><![CDATA[compound assignment]]></category>
		<category><![CDATA[e4x]]></category>
		<category><![CDATA[operator]]></category>
		<category><![CDATA[XMLList]]></category>

		<guid isPermaLink="false">http://keith-hair.net/blog/?p=344</guid>
		<description><![CDATA[Recently I was working with an XMLList variable and I wanted to add a new XML node to an XMLList. My first thought was to just use the "appendChild" method as you would with an XML object. I wasn't really aware of how to do this, and I did not see an XMLList method listed [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I was working with an XMLList variable and I wanted to add a new XML node to an XMLList.<br />
My first thought was to just use the "appendChild" method as you would with an XML object.<br />
I wasn't really aware of how to do this, and I did not see an XMLList method listed for appending childs in the AS3 documentation.<br />
So I "googled" the term "E4X specification" and read about the "compound assignment operator +=".<br />
Wow using "+=" was really simple. </p>
<p>In the example below I was trying to add a new PAGE node to the existing "PAGE" XMLList....</p>
<p><br></br><br />
<br></br><br />
<strong>Before when I used "appendChild". Error!<br />
Even if my XMLList had one child, it would not be the result I wanted.</strong></p>
<pre class="actionscript">&nbsp;
<span style="color: #000000; font-weight: bold;">var</span> doc:<span style="color: #0066CC;">XML</span>=
&lt;BOOK&gt;
	&lt;PAGE /&gt;
	&lt;PAGE /&gt;
	&lt;PAGE /&gt;
&lt;/BOOK&gt;;
&nbsp;
<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>Original...&quot;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span>doc.<span style="color: #006600;">toXMLString</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
doc.<span style="color: #006600;">PAGE</span>.<span style="color: #0066CC;">appendChild</span><span style="color: #66cc66;">&#40;</span>&lt;PAGE /&gt;<span style="color: #66cc66;">&#41;</span>;
<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>Changes...&quot;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span>doc.<span style="color: #006600;">toXMLString</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
\\<span style="color: #0066CC;">Trace</span> Output:
Original...
&lt;BOOK&gt;
  &lt;PAGE/&gt;
  &lt;PAGE/&gt;
  &lt;PAGE/&gt;
&lt;/BOOK&gt;
TypeError: <span style="color: #0066CC;">Error</span> <span style="color: #808080; font-style: italic;">#1086: The appendChild method only works on lists containing one item.</span>
	at XMLList/http:<span style="color: #808080; font-style: italic;">//adobe.com/AS3/2006/builtin::appendChild()</span>
	at Untitled_fla::MainTimeline/Untitled_fla::frame1<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;</pre>
<p><br></br><br />
<br></br><br />
<strong>Using the compound assignment operator "+=" gives the result I was looking for. The new PAGE node is added to the XMLList.</strong></p>
<pre class="actionscript">&nbsp;
<span style="color: #000000; font-weight: bold;">var</span> doc:<span style="color: #0066CC;">XML</span>=
&lt;BOOK&gt;
	&lt;PAGE /&gt;
	&lt;PAGE /&gt;
	&lt;PAGE /&gt;
&lt;/BOOK&gt;;
&nbsp;
<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>Original...&quot;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span>doc.<span style="color: #006600;">toXMLString</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
doc.<span style="color: #006600;">PAGE</span>+=&lt;PAGE /&gt;; <span style="color: #808080; font-style: italic;">//doc.PAGE=doc.PAGE+&lt;PAGE /&gt;; works just as well.</span>
<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>Changes...&quot;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span>doc.<span style="color: #006600;">toXMLString</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
\\<span style="color: #0066CC;">Trace</span> Output:
Original...
&lt;BOOK&gt;
  &lt;PAGE/&gt;
  &lt;PAGE/&gt;
  &lt;PAGE/&gt;
&lt;/BOOK&gt;
&nbsp;
Changes...
&lt;BOOK&gt;
  &lt;PAGE/&gt;
  &lt;PAGE/&gt;
  &lt;PAGE/&gt;
  &lt;PAGE/&gt;
&lt;/BOOK&gt;
&nbsp;</pre>
<a href='http://www.hexosearch.com/se/submit.aspx?zlvz=&zqz=&zurlz=http://keith-hair.net/blog/2011/10/08/appending-nodes-to-an-xmllist-in-as3/&ztz=Appending Nodes to an XMLList in AS3'><img src='http://keith-hair.net/blog/wp-content/plugins/hexosearch-button/logo16x16.png' width='16' height='16' border='0' style='vertical-align:middle' alt='Vote in HexoSearch' title='Vote in HexoSearch' /></a>]]></content:encoded>
			<wfw:commentRss>http://keith-hair.net/blog/2011/10/08/appending-nodes-to-an-xmllist-in-as3/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Listing class properties dynamically in AS3</title>
		<link>http://keith-hair.net/blog/2009/12/08/listing-class-properties-dynamically-in-as3/</link>
		<comments>http://keith-hair.net/blog/2009/12/08/listing-class-properties-dynamically-in-as3/#comments</comments>
		<pubDate>Wed, 09 Dec 2009 01:23:01 +0000</pubDate>
		<dc:creator>Keith H</dc:creator>
				<category><![CDATA[Flash 9]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[XML]]></category>
		<category><![CDATA[describeType]]></category>
		<category><![CDATA[ObjectUtil.getClassInfo]]></category>
		<category><![CDATA[RegExp]]></category>

		<guid isPermaLink="false">http://keith-hair.net/blog/?p=119</guid>
		<description><![CDATA[Dynamically listing the properties of a class is pretty cool and useful. There are many things you could do by generating a list of existing properties. One example is you can make your class instances represent themselves dynamically in a custom format of your choosing. Like how "toString()" is use with the Array class or [...]]]></description>
			<content:encoded><![CDATA[<p>Dynamically listing the properties of a class is pretty cool and useful. There are many things you could do by generating a list of existing properties. One example is you can make your class instances represent themselves dynamically in a custom format of your choosing. Like how "toString()" is use with the Array class or how Point is represented when toString() is called from it. Going further, listing current properties could be used to save the current values of the class as a "save point". </p>
<p>In the Flex framework, there is ObjectUtil.getClassInfo().properties, but I feel is more useful to just use the XML returned from the describeType method. I like using decribeType for both plain AS3 or when using the Flex framework because its accessible in both.<br />
Since the return of describeType is XML I have more options with E4X filtering/Regular Expressions, than using getClassInfo(). With describeType I can get info on methods as well but to keep things simple I'm only talking about accessor properties in this post. Using the "listProperties" function, I am listing the properties between 3 different classes. This is a function I wrote to show how you can make your own way to use the XML of decribeType. </p>
<p>In the example SWF below, there are 3 classes under inspection. The Helicopter class is a custom class extending Sprite. By setting the parameters of listProperties you can list the properties of Helicopter, or all of the properties it has by being subclassed from Sprite. The other classes are a TextField and a Sprite class. Changing the options lists a different set of properties based on type of Class of properties listed and what class its properties are declared by.</p>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_readprops_1187744061"
			class="flashmovie"
			width="500"
			height="400">
	<param name="movie" value="http://keith-hair.net/blog/examples/listing_properties/readprops.swf" />
	<param name="scale" value="showall" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://keith-hair.net/blog/examples/listing_properties/readprops.swf"
			name="fm_readprops_1187744061"
			width="500"
			height="400">
		<param name="scale" value="showall" />
	<!--<![endif]-->
		
<p><a href="http://adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object><br />
<span id="more-119"></span><br />
<br></br><br />
<strong>The custom Helicopter class extending Sprite</strong></p>
<pre class="actionscript">&nbsp;
package
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">Sprite</span>;
&nbsp;
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Helicopter <span style="color: #0066CC;">extends</span> Sprite
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _roll:<span style="color: #0066CC;">Number</span>=<span style="color: #cc66cc;">0</span>;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _pitch:<span style="color: #0066CC;">Number</span>=<span style="color: #cc66cc;">0</span>;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _yaw:<span style="color: #0066CC;">Number</span>=<span style="color: #cc66cc;">0</span>;
&nbsp;
		<span style="color: #000000; font-weight: bold;">function</span> Helicopter<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #0066CC;">super</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">get</span> roll<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Number</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #b1b100;">return</span> _roll;
		<span style="color: #66cc66;">&#125;</span>
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">set</span> roll<span style="color: #66cc66;">&#40;</span>v:<span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			_roll=v;
&nbsp;
		<span style="color: #66cc66;">&#125;</span>
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">get</span> pitch<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Number</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #b1b100;">return</span> _pitch;
		<span style="color: #66cc66;">&#125;</span>
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">set</span> pitch<span style="color: #66cc66;">&#40;</span>v:<span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			_pitch=v;
&nbsp;
		<span style="color: #66cc66;">&#125;</span>
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">get</span> yaw<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Number</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #b1b100;">return</span> _yaw;
		<span style="color: #66cc66;">&#125;</span>
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">set</span> yaw<span style="color: #66cc66;">&#40;</span>v:<span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			_yaw=v;
&nbsp;
		<span style="color: #66cc66;">&#125;</span>
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span>
&nbsp;</pre>
<pre class="actionscript">&nbsp;
<span style="color: #808080; font-style: italic;">/*============================================================
  obj						-The instance to return properties of.
  accessType				-Set to either &quot;readwrite&quot; or &quot;readonly&quot; to return only those kind of properties.
  excludeCommonWith			-Excludes all properties 'obj' has in common with the Class you give here.
  matchesRE					-If set listProperties will only return the property names that match the RegExp.
  declaredOnlyByObjClass	-If false, will not exclude properties declared by other classes than the givin 'obj'.  
&nbsp;
  Returns and Array of all the properties of the instance.
 ============================================================*/</span>
<span style="color: #000000; font-weight: bold;">function</span> listProperties<span style="color: #66cc66;">&#40;</span>obj:<span style="color: #0066CC;">Object</span>, accessType:<span style="color: #0066CC;">String</span>=<span style="color: #ff0000;">&quot;readwrite&quot;</span>, excludeCommonWith:<span style="color: #000000; font-weight: bold;">Class</span>=<span style="color: #000000; font-weight: bold;">null</span>, matchesRE:RegExp=<span style="color: #000000; font-weight: bold;">null</span>, declaredOnlyByObjClass:<span style="color: #0066CC;">Boolean</span>=<span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Array</span>
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">var</span> a:XMLList;
	<span style="color: #000000; font-weight: bold;">var</span> b:<span style="color: #0066CC;">Array</span>=<span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span>;
	<span style="color: #000000; font-weight: bold;">var</span> c:*;
	<span style="color: #000000; font-weight: bold;">var</span> n:<span style="color: #0066CC;">int</span>;
	<span style="color: #000000; font-weight: bold;">var</span> doc:<span style="color: #0066CC;">XML</span>;
	<span style="color: #000000; font-weight: bold;">var</span> cname:<span style="color: #0066CC;">String</span>;
	matchesRE=matchesRE || <span style="color: #000000; font-weight: bold;">new</span> RegExp<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;.+&quot;</span><span style="color: #66cc66;">&#41;</span>;
	accessType=accessType || <span style="color: #ff0000;">&quot;readwrite&quot;</span>;
	accessType=accessType.<span style="color: #0066CC;">toLowerCase</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>!RegExp<span style="color: #66cc66;">&#40;</span>/readwrite|readonly/i<span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">test</span><span style="color: #66cc66;">&#40;</span>accessType<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
		accessType == <span style="color: #ff0000;">&quot;readwrite&quot;</span>;
	<span style="color: #66cc66;">&#125;</span>
	doc=flash.<span style="color: #006600;">utils</span>.<span style="color: #006600;">describeType</span><span style="color: #66cc66;">&#40;</span>obj<span style="color: #66cc66;">&#41;</span>;
	cname=doc.@<span style="color: #0066CC;">name</span>;
	<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>declaredOnlyByObjClass<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
		a=doc.<span style="color: #006600;">accessor</span>.<span style="color: #006600;"><span style="color: #66cc66;">&#40;</span></span>@access == accessType &amp;&amp; @declaredBy == cname &amp;&amp; matchesRE<span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&quot;test&quot;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#40;</span>@<span style="color: #0066CC;">name</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span>
		a=doc.<span style="color: #006600;">accessor</span>.<span style="color: #006600;"><span style="color: #66cc66;">&#40;</span></span>@access == accessType &amp;&amp; matchesRE<span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&quot;test&quot;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#40;</span>@<span style="color: #0066CC;">name</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #66cc66;">&#125;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>excludeCommonWith != <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
		c=<span style="color: #000000; font-weight: bold;">new</span> excludeCommonWith<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #66cc66;">&#125;</span>
	n=<span style="color: #cc66cc;">0</span>;
	<span style="color: #b1b100;">while</span> <span style="color: #66cc66;">&#40;</span>n &lt; a.<span style="color: #0066CC;">length</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>c != <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
			<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">Object</span><span style="color: #66cc66;">&#40;</span>c<span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">hasOwnProperty</span><span style="color: #66cc66;">&#40;</span>a<span style="color: #66cc66;">&#91;</span>n<span style="color: #66cc66;">&#93;</span>.@<span style="color: #0066CC;">name</span><span style="color: #66cc66;">&#41;</span> == <span style="color: #000000; font-weight: bold;">false</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
				b.<span style="color: #0066CC;">push</span><span style="color: #66cc66;">&#40;</span>a<span style="color: #66cc66;">&#91;</span>n<span style="color: #66cc66;">&#93;</span>.@<span style="color: #0066CC;">name</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #66cc66;">&#125;</span>
		<span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span>
			b.<span style="color: #0066CC;">push</span><span style="color: #66cc66;">&#40;</span>a<span style="color: #66cc66;">&#91;</span>n<span style="color: #66cc66;">&#93;</span>.@<span style="color: #0066CC;">name</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
		n++;
	<span style="color: #66cc66;">&#125;</span>
	<span style="color: #b1b100;">return</span> b;
<span style="color: #66cc66;">&#125;</span>
&nbsp;</pre>
<p><a href="http://keith-hair.net/blog/examples/listing_properties/example.zip"><br />
download fla</a></p>
<a href='http://www.hexosearch.com/se/submit.aspx?zlvz=&zqz=&zurlz=http://keith-hair.net/blog/2009/12/08/listing-class-properties-dynamically-in-as3/&ztz=Listing class properties dynamically in AS3'><img src='http://keith-hair.net/blog/wp-content/plugins/hexosearch-button/logo16x16.png' width='16' height='16' border='0' style='vertical-align:middle' alt='Vote in HexoSearch' title='Vote in HexoSearch' /></a>]]></content:encoded>
			<wfw:commentRss>http://keith-hair.net/blog/2009/12/08/listing-class-properties-dynamically-in-as3/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Case-insensitive E4X filtering</title>
		<link>http://keith-hair.net/blog/2008/06/01/case-insensitive-e4x-filtering/</link>
		<comments>http://keith-hair.net/blog/2008/06/01/case-insensitive-e4x-filtering/#comments</comments>
		<pubDate>Sun, 01 Jun 2008 15:13:57 +0000</pubDate>
		<dc:creator>Keith H</dc:creator>
				<category><![CDATA[XML]]></category>
		<category><![CDATA[E4X Filtering]]></category>
		<category><![CDATA[Regular Expressions]]></category>

		<guid isPermaLink="false">http://keith-hair.com/blog/?p=7</guid>
		<description><![CDATA[When I'm writing a script to read XML data, I personally like the identification of node names and attributes to be case-insensitive. Its one less thing to worry about when others are modifying the XML data that my script will have to read and render, and I think they feel modifying the XML to be [...]]]></description>
			<content:encoded><![CDATA[<p>When I'm writing a script to read XML data, I personally like the identification of node names and attributes to be case-insensitive. Its one less thing to worry about when others are modifying the XML data that my script will have to read and render, and I think they feel modifying the XML to be more user-friendly this way. <img src='http://keith-hair.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Here, the example scripts pull a list of all the nodes with the name "MEDIA".<br />
Using Regular Expressions, you can identify each "MEDIA" node regardless of its letter case.</p>
<pre class="actionscript">&nbsp;
<span style="color: #000000; font-weight: bold;">var</span> doc:<span style="color: #0066CC;">XML</span>=
&lt;DATA&gt;
	&lt;CATEGORY&gt;
		&lt;MEDIA&gt;A.<span style="color: #006600;">jpg</span>&lt;/MEDIA&gt;
		&lt;MEDIA&gt;B.<span style="color: #006600;">jpg</span>&lt;/MEDIA&gt;
	&lt;/CATEGORY&gt;
	&lt;CATEGORY&gt;
		&lt;MEDIA&gt;C.<span style="color: #006600;">jpg</span>&lt;/MEDIA&gt;
	&lt;/CATEGORY&gt;
	&lt;CATEGORY&gt;
		&lt;MEDIA&gt;D.<span style="color: #006600;">jpg</span>&lt;/MEDIA&gt;
	&lt;/CATEGORY&gt;
	&lt;CATEGORY&gt;
		&lt;MEDIA&gt;E.<span style="color: #006600;">jpg</span>&lt;/MEDIA&gt;
	&lt;/CATEGORY&gt;
&lt;/DATA&gt;;
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span> findName:<span style="color: #0066CC;">String</span>=<span style="color: #ff0000;">&quot;media&quot;</span>;
<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span>doc..<span style="color: #006600;">*</span>.<span style="color: #006600;"><span style="color: #66cc66;">&#40;</span></span><span style="color: #000000; font-weight: bold;">new</span> RegExp<span style="color: #66cc66;">&#40;</span>findName,<span style="color: #ff0000;">&quot;i&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&quot;test&quot;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">name</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">toXMLString</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;</pre>
<p> <img src='http://keith-hair.net/blog/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' />  <em>"Error #1069: Property lowerCase not found on QName"</em></p>
<pre class="actionscript">&nbsp;
<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span>doc..<span style="color: #006600;">*</span>.<span style="color: #006600;"><span style="color: #66cc66;">&#40;</span></span><span style="color: #0066CC;">name</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">lowerCase</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>==<span style="color: #ff0000;">&quot;media&quot;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">toXMLString</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;</pre>
<p> <img src='http://keith-hair.net/blog/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' />  Letter case must be same for this to work.</p>
<pre class="actionscript">&nbsp;
<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span>doc..<span style="color: #006600;">*</span>.<span style="color: #006600;"><span style="color: #66cc66;">&#40;</span></span><span style="color: #0066CC;">name</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>==<span style="color: #ff0000;">&quot;MEDIA&quot;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">toXMLString</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;</pre>
<p>Used a regular expression to do case-insensitive filter<br />
 <img src='http://keith-hair.net/blog/wp-includes/images/smilies/icon_neutral.gif' alt=':|' class='wp-smiley' />  Works, letter case does not matter...but the expression is too "hardcoded". </p>
<pre class="actionscript">&nbsp;
<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span>doc..<span style="color: #006600;">*</span>.<span style="color: #006600;"><span style="color: #66cc66;">&#40;</span></span>/media/i.<span style="color: #006600;">test</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">name</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">toXMLString</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;</pre>
<p> <img src='http://keith-hair.net/blog/wp-includes/images/smilies/icon_confused.gif' alt=':-?' class='wp-smiley' />  Works, but compiler does not like it:<br />
<em>"Warning: 3594: test is not a recognized method of the dynamic class RegExp."</em><br />
This is an attempt to allow variables and expressions.</p>
<pre class="actionscript">&nbsp;
<span style="color: #000000; font-weight: bold;">var</span> findName:<span style="color: #0066CC;">String</span>=<span style="color: #ff0000;">&quot;media&quot;</span>;
<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span>doc..<span style="color: #006600;">*</span>.<span style="color: #006600;"><span style="color: #66cc66;">&#40;</span></span><span style="color: #000000; font-weight: bold;">new</span> RegExp<span style="color: #66cc66;">&#40;</span>findName,<span style="color: #ff0000;">&quot;i&quot;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">test</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">name</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">toXMLString</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;</pre>
<p>:jumping: Works!<br />
"[" and "]" keeps the compiler from warning when using the RegExp "test()" method.<br />
Now letter case does not matter, and RegExp constructor allows variables or expressions.</p>
<pre class="actionscript">&nbsp;
<span style="color: #000000; font-weight: bold;">var</span> findName:<span style="color: #0066CC;">String</span>=<span style="color: #ff0000;">&quot;media&quot;</span>;
<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span>doc..<span style="color: #006600;">*</span>.<span style="color: #006600;"><span style="color: #66cc66;">&#40;</span></span><span style="color: #000000; font-weight: bold;">new</span> RegExp<span style="color: #66cc66;">&#40;</span>findName,<span style="color: #ff0000;">&quot;i&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&quot;test&quot;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">name</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">toXMLString</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;</pre>
<a href='http://www.hexosearch.com/se/submit.aspx?zlvz=&zqz=&zurlz=http://keith-hair.net/blog/2008/06/01/case-insensitive-e4x-filtering/&ztz=Case-insensitive E4X filtering'><img src='http://keith-hair.net/blog/wp-content/plugins/hexosearch-button/logo16x16.png' width='16' height='16' border='0' style='vertical-align:middle' alt='Vote in HexoSearch' title='Vote in HexoSearch' /></a>]]></content:encoded>
			<wfw:commentRss>http://keith-hair.net/blog/2008/06/01/case-insensitive-e4x-filtering/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Using E4X with XML in AS3</title>
		<link>http://keith-hair.net/blog/2008/05/31/using-e4x-with-xml-in-as3/</link>
		<comments>http://keith-hair.net/blog/2008/05/31/using-e4x-with-xml-in-as3/#comments</comments>
		<pubDate>Sat, 31 May 2008 15:54:09 +0000</pubDate>
		<dc:creator>Keith H</dc:creator>
				<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[XML]]></category>
		<category><![CDATA[E4X Filtering]]></category>
		<category><![CDATA[Regular Expressions]]></category>

		<guid isPermaLink="false">http://keith-hair.com/blog/?p=5</guid>
		<description><![CDATA[The XML examples represent a book in a library. However the book has several bookworms in it. Using E4X we can find these bookworms. &#160; &#60;library&#62; &#60;book&#62; &#60;page id=&#34;one&#34;/&#62; &#60;worm name=&#34;Eddy&#34; /&#62; &#60;page id=&#34;two&#34;/&#62; &#60;page id=&#34;three&#34;&#62; &#60;worm name=&#34;Lisa&#34;/&#62; &#60;worm name=&#34;Pete&#34; /&#62; &#60;/page&#62; &#60;page id=&#34;four&#34;/&#62; &#60;/book&#62; &#60;/library&#62; &#160; There are some E4X operators and XML methods [...]]]></description>
			<content:encoded><![CDATA[<p>The  XML examples represent a book in a library. However the book has several bookworms in it.<br />
Using E4X we can find these bookworms.</p>
<pre class="xml">&nbsp;
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;library<span style="font-weight: bold; color: black;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;book<span style="font-weight: bold; color: black;">&gt;</span></span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;page</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;one&quot;</span><span style="font-weight: bold; color: black;">/&gt;</span></span>
		<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;worm</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Eddy&quot;</span> <span style="font-weight: bold; color: black;">/&gt;</span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;page</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;two&quot;</span><span style="font-weight: bold; color: black;">/&gt;</span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;page</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;three&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>
			<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;worm</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Lisa&quot;</span><span style="font-weight: bold; color: black;">/&gt;</span></span>
			<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;worm</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Pete&quot;</span> <span style="font-weight: bold; color: black;">/&gt;</span></span>
		<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/page<span style="font-weight: bold; color: black;">&gt;</span></span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;page</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;four&quot;</span><span style="font-weight: bold; color: black;">/&gt;</span></span>
	<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/book<span style="font-weight: bold; color: black;">&gt;</span></span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/library<span style="font-weight: bold; color: black;">&gt;</span></span></span>
&nbsp;</pre>
<p>There are some E4X operators and XML methods to help use do this when combined together:</p>
<blockquote><p>
<strong>..</strong> Access all descendants of the XML object.<br />
<strong>.</strong> Access a property of an Object or XML.<br />
<strong>*</strong> Wildcard, match any part of the XML.<br />
<strong>childIndex()</strong> Index number of an XML object relative to its parent node.<br />
<strong>name()</strong> Name of the XML node.
</p></blockquote>
<p><span id="more-5"></span></p>
<p><strong>Return a certain "worm" node at the index it belongs to from its XMLList.<br />
Any nested "worm" node occurrence is also considered.</strong></p>
<pre class="xml">&nbsp;
var doc:XML=
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;library<span style="font-weight: bold; color: black;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;book<span style="font-weight: bold; color: black;">&gt;</span></span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;page</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;one&quot;</span><span style="font-weight: bold; color: black;">/&gt;</span></span>
		<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;worm</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Eddy&quot;</span> <span style="font-weight: bold; color: black;">/&gt;</span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;page</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;two&quot;</span><span style="font-weight: bold; color: black;">/&gt;</span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;page</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;three&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>
			<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;worm</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Lisa&quot;</span><span style="font-weight: bold; color: black;">/&gt;</span></span>
			<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;worm</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Pete&quot;</span> <span style="font-weight: bold; color: black;">/&gt;</span></span>
		<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/page<span style="font-weight: bold; color: black;">&gt;</span></span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;page</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;four&quot;</span><span style="font-weight: bold; color: black;">/&gt;</span></span>
	<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/book<span style="font-weight: bold; color: black;">&gt;</span></span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/library<span style="font-weight: bold; color: black;">&gt;</span></span></span>;
&nbsp;
//Pick the &quot;worm&quot; node at index 1.
var data:*=doc..*.worm[1];
trace(data.toXMLString());
&nbsp;
/*=========================================
OUTPUT:
&nbsp;
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;worm</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Lisa&quot;</span><span style="font-weight: bold; color: black;">/&gt;</span></span>			//worm[1]
===========================================*/
&nbsp;</pre>
<p><strong>Delete all "worm" nodes from the xml, even the nested ones.</strong></p>
<pre class="xml">&nbsp;
var doc:XML=
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;library<span style="font-weight: bold; color: black;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;book<span style="font-weight: bold; color: black;">&gt;</span></span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;page</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;one&quot;</span><span style="font-weight: bold; color: black;">/&gt;</span></span>
		<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;worm</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Eddy&quot;</span> <span style="font-weight: bold; color: black;">/&gt;</span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;page</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;two&quot;</span><span style="font-weight: bold; color: black;">/&gt;</span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;page</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;three&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>
			<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;worm</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Lisa&quot;</span><span style="font-weight: bold; color: black;">/&gt;</span></span>
			<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;worm</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Pete&quot;</span> <span style="font-weight: bold; color: black;">/&gt;</span></span>
		<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/page<span style="font-weight: bold; color: black;">&gt;</span></span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;page</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;four&quot;</span><span style="font-weight: bold; color: black;">/&gt;</span></span>
	<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/book<span style="font-weight: bold; color: black;">&gt;</span></span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/library<span style="font-weight: bold; color: black;">&gt;</span></span></span>;
&nbsp;
delete doc..*.worm;
trace(doc.toXMLString());
&nbsp;
/*=========================================
OUTPUT:
All &quot;worm&quot; nodes are deleted.
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;library<span style="font-weight: bold; color: black;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;book<span style="font-weight: bold; color: black;">&gt;</span></span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;page</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;one&quot;</span><span style="font-weight: bold; color: black;">/&gt;</span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;page</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;two&quot;</span><span style="font-weight: bold; color: black;">/&gt;</span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;page</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;three&quot;</span><span style="font-weight: bold; color: black;">/&gt;</span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;page</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;four&quot;</span><span style="font-weight: bold; color: black;">/&gt;</span></span>
  <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/book<span style="font-weight: bold; color: black;">&gt;</span></span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/library<span style="font-weight: bold; color: black;">&gt;</span></span></span>
===========================================*/
&nbsp;</pre>
<p><strong><br />
Use E4X filtering with Regular Expressions.</strong><br />
XML methods and Regular Expressions can be used inside parentheses to accomplish E4X filtering.</p>
<blockquote><p>doc..*.(childIndex()==0 &amp;&amp; /library|book/i.test(name())==false)</p></blockquote>
<p><strong>List all nodes that belong at a given index of their XMLList.</strong></p>
<pre class="xml">&nbsp;
var doc:XML=
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;library<span style="font-weight: bold; color: black;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;book<span style="font-weight: bold; color: black;">&gt;</span></span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;page</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;one&quot;</span><span style="font-weight: bold; color: black;">/&gt;</span></span>
		<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;worm</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Eddy&quot;</span> <span style="font-weight: bold; color: black;">/&gt;</span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;page</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;two&quot;</span><span style="font-weight: bold; color: black;">/&gt;</span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;page</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;three&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>
			<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;worm</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Lisa&quot;</span><span style="font-weight: bold; color: black;">/&gt;</span></span>
			<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;worm</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Pete&quot;</span> <span style="font-weight: bold; color: black;">/&gt;</span></span>
		<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/page<span style="font-weight: bold; color: black;">&gt;</span></span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;page</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;four&quot;</span><span style="font-weight: bold; color: black;">/&gt;</span></span>
	<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/book<span style="font-weight: bold; color: black;">&gt;</span></span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/library<span style="font-weight: bold; color: black;">&gt;</span></span></span>;
&nbsp;
//----------------------------------------------------
//Get the first node of each list whose name does not
//match the regular expression.
//----------------------------------------------------
var data:*=doc..*.(childIndex()==0 <span style="color: #ddbb00;">&amp;&amp; /library|book/i.test(name())==false);</span>
trace(data.toXMLString());
&nbsp;
/*=========================================
OUTPUT:
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;page</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;one&quot;</span><span style="font-weight: bold; color: black;">/&gt;</span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;worm</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Lisa&quot;</span><span style="font-weight: bold; color: black;">/&gt;</span></span>
===========================================*/
&nbsp;</pre>
<a href='http://www.hexosearch.com/se/submit.aspx?zlvz=&zqz=&zurlz=http://keith-hair.net/blog/2008/05/31/using-e4x-with-xml-in-as3/&ztz=Using E4X with XML in AS3'><img src='http://keith-hair.net/blog/wp-content/plugins/hexosearch-button/logo16x16.png' width='16' height='16' border='0' style='vertical-align:middle' alt='Vote in HexoSearch' title='Vote in HexoSearch' /></a>]]></content:encoded>
			<wfw:commentRss>http://keith-hair.net/blog/2008/05/31/using-e4x-with-xml-in-as3/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Find and Replace for XML in AS3</title>
		<link>http://keith-hair.net/blog/2008/05/30/find-and-replace-for-xml-in-as3/</link>
		<comments>http://keith-hair.net/blog/2008/05/30/find-and-replace-for-xml-in-as3/#comments</comments>
		<pubDate>Fri, 30 May 2008 04:26:18 +0000</pubDate>
		<dc:creator>Keith H</dc:creator>
				<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://keith-hair.com/blog/?p=3</guid>
		<description><![CDATA[These are some functions I wrote for finding and replacing parts of XML using AS3. Not sure if E4X or "XML.replace()" method can be used to make each function's task better. &#160; /*----------------------------------- Recursively replace nodeNames. -------------------------------------*/ private function findAndReplaceTagNames &#40;xml:XML,find:String,replace:String&#41;:XML &#123; if&#40;xml.localName&#40;&#41; == find&#41;&#123; xml.setLocalName&#40;replace&#41;; &#125; var n:int=0; var c:XML; while&#40;n &#60;xml.children&#40;&#41;.length&#40;&#41;&#41;&#123; c=xml.children&#40;&#41;&#91;n&#93;; findAndReplaceTagNames&#40;c,find,replace&#41;; [...]]]></description>
			<content:encoded><![CDATA[<p>These are some functions I wrote for finding and replacing parts of XML using AS3.<br />
Not sure if E4X or "XML.replace()" method can be used to make each function's task better.</p>
<pre class="actionscript">&nbsp;
<span style="color: #808080; font-style: italic;">/*-----------------------------------
	Recursively replace nodeNames.
-------------------------------------*/</span>
      <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> findAndReplaceTagNames
      <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">xml</span>:<span style="color: #0066CC;">XML</span>,find:<span style="color: #0066CC;">String</span>,replace:<span style="color: #0066CC;">String</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">XML</span>
      <span style="color: #66cc66;">&#123;</span>
          <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">xml</span>.<span style="color: #006600;">localName</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> == find<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
              <span style="color: #0066CC;">xml</span>.<span style="color: #006600;">setLocalName</span><span style="color: #66cc66;">&#40;</span>replace<span style="color: #66cc66;">&#41;</span>;
          <span style="color: #66cc66;">&#125;</span>
          <span style="color: #000000; font-weight: bold;">var</span> n:<span style="color: #0066CC;">int</span>=<span style="color: #cc66cc;">0</span>;
          <span style="color: #000000; font-weight: bold;">var</span> c:<span style="color: #0066CC;">XML</span>;
          <span style="color: #b1b100;">while</span><span style="color: #66cc66;">&#40;</span>n &lt;xml.<span style="color: #006600;">children</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #0066CC;">length</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
              c=<span style="color: #0066CC;">xml</span>.<span style="color: #006600;">children</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#91;</span>n<span style="color: #66cc66;">&#93;</span>;
              findAndReplaceTagNames<span style="color: #66cc66;">&#40;</span>c,find,replace<span style="color: #66cc66;">&#41;</span>;
              n++;
          <span style="color: #66cc66;">&#125;</span>
          <span style="color: #b1b100;">return</span> <span style="color: #0066CC;">xml</span>;
      <span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/*-----------------------------------------
	Recursively replace attributes.
-------------------------------------------*/</span>
      <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> findAndReplaceAttributeNames
      <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">xml</span>:<span style="color: #0066CC;">XML</span>,find:<span style="color: #0066CC;">String</span>,replace:<span style="color: #0066CC;">String</span>,in_tags_named:<span style="color: #0066CC;">String</span>=<span style="color: #ff0000;">&quot;&quot;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">XML</span>
      <span style="color: #66cc66;">&#123;</span>
          <span style="color: #000000; font-weight: bold;">var</span> ok:<span style="color: #0066CC;">Boolean</span>=<span style="color: #000000; font-weight: bold;">true</span>;
          <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>in_tags_named != <span style="color: #ff0000;">&quot;&quot;</span> &amp;&amp; <span style="color: #0066CC;">xml</span>.<span style="color: #006600;">localName</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> != in_tags_named<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
              ok=<span style="color: #000000; font-weight: bold;">false</span>;
          <span style="color: #66cc66;">&#125;</span>
          <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">xml</span>.@<span style="color: #66cc66;">&#91;</span>find<span style="color: #66cc66;">&#93;</span> != <span style="color: #000000; font-weight: bold;">null</span> &amp;&amp; ok<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
              <span style="color: #0066CC;">xml</span>.@<span style="color: #66cc66;">&#91;</span>replace<span style="color: #66cc66;">&#93;</span>=<span style="color: #0066CC;">xml</span>.@<span style="color: #66cc66;">&#91;</span>find<span style="color: #66cc66;">&#93;</span>;
              <span style="color: #0066CC;">delete</span> <span style="color: #0066CC;">xml</span>.@<span style="color: #66cc66;">&#91;</span>find<span style="color: #66cc66;">&#93;</span>;
          <span style="color: #66cc66;">&#125;</span>
          <span style="color: #000000; font-weight: bold;">var</span> n:<span style="color: #0066CC;">int</span>=<span style="color: #cc66cc;">0</span>;
          <span style="color: #000000; font-weight: bold;">var</span> c:<span style="color: #0066CC;">XML</span>;
          <span style="color: #b1b100;">while</span><span style="color: #66cc66;">&#40;</span>n &lt;xml.<span style="color: #006600;">children</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #0066CC;">length</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
              c=<span style="color: #0066CC;">xml</span>.<span style="color: #006600;">children</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#91;</span>n<span style="color: #66cc66;">&#93;</span>;
              findAndReplaceAttributeNames<span style="color: #66cc66;">&#40;</span>c,find,replace<span style="color: #66cc66;">&#41;</span>;
              n++;
          <span style="color: #66cc66;">&#125;</span>
          <span style="color: #b1b100;">return</span> <span style="color: #0066CC;">xml</span>;
      <span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/*---------------------------------------------
	Recursively find and remove attributes.
-----------------------------------------------*/</span>
      <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> findAndRemoveAttributeNames
      <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">xml</span>:<span style="color: #0066CC;">XML</span>,find:<span style="color: #0066CC;">String</span>,in_tags_named:<span style="color: #0066CC;">String</span>=<span style="color: #ff0000;">&quot;&quot;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">XML</span>
      <span style="color: #66cc66;">&#123;</span>
          <span style="color: #000000; font-weight: bold;">var</span> ok:<span style="color: #0066CC;">Boolean</span>=<span style="color: #000000; font-weight: bold;">true</span>;
          <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>in_tags_named != <span style="color: #ff0000;">&quot;&quot;</span> &amp;&amp; <span style="color: #0066CC;">xml</span>.<span style="color: #006600;">localName</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> != in_tags_named<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
              ok=<span style="color: #000000; font-weight: bold;">false</span>;
          <span style="color: #66cc66;">&#125;</span>
          <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">xml</span>.@<span style="color: #66cc66;">&#91;</span>find<span style="color: #66cc66;">&#93;</span> != <span style="color: #000000; font-weight: bold;">null</span> &amp;&amp; ok<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
              <span style="color: #0066CC;">delete</span> <span style="color: #0066CC;">xml</span>.@<span style="color: #66cc66;">&#91;</span>find<span style="color: #66cc66;">&#93;</span>;
          <span style="color: #66cc66;">&#125;</span>
          <span style="color: #000000; font-weight: bold;">var</span> n:<span style="color: #0066CC;">int</span>=<span style="color: #cc66cc;">0</span>;
          <span style="color: #000000; font-weight: bold;">var</span> c:<span style="color: #0066CC;">XML</span>;
          <span style="color: #b1b100;">while</span><span style="color: #66cc66;">&#40;</span>n &lt;xml.<span style="color: #006600;">children</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #0066CC;">length</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
              c=<span style="color: #0066CC;">xml</span>.<span style="color: #006600;">children</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#91;</span>n<span style="color: #66cc66;">&#93;</span>;
              findAndRemoveAttributeNames<span style="color: #66cc66;">&#40;</span>c,find<span style="color: #66cc66;">&#41;</span>;
              n++;
          <span style="color: #66cc66;">&#125;</span>
          <span style="color: #b1b100;">return</span> <span style="color: #0066CC;">xml</span>;
      <span style="color: #66cc66;">&#125;</span>
&nbsp;</pre>
<a href='http://www.hexosearch.com/se/submit.aspx?zlvz=&zqz=&zurlz=http://keith-hair.net/blog/2008/05/30/find-and-replace-for-xml-in-as3/&ztz=Find and Replace for XML in AS3'><img src='http://keith-hair.net/blog/wp-content/plugins/hexosearch-button/logo16x16.png' width='16' height='16' border='0' style='vertical-align:middle' alt='Vote in HexoSearch' title='Vote in HexoSearch' /></a>]]></content:encoded>
			<wfw:commentRss>http://keith-hair.net/blog/2008/05/30/find-and-replace-for-xml-in-as3/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

