<?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 String Parser</title>
	<atom:link href="http://blog.betabong.com/2008/09/23/e4x-string-parser/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.betabong.com/2008/09/23/e4x-string-parser/</link>
	<description></description>
	<lastBuildDate>Tue, 20 Apr 2010 20:40:19 +0200</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: betabong</title>
		<link>http://blog.betabong.com/2008/09/23/e4x-string-parser/comment-page-1/#comment-59</link>
		<dc:creator>betabong</dc:creator>
		<pubDate>Fri, 21 Aug 2009 16:35:02 +0000</pubDate>
		<guid isPermaLink="false">http://blog.betabong.com/?p=111#comment-59</guid>
		<description>Leonardo, I see your problem. My E4X parser doesn&#039;t (yet) support namespaces. It&#039;s mainly because I didn&#039;t really need it for my own purposes, but also because I think namespaces are a pain in the ass to handle. What I often do, is to just get rid of them:
&lt;pre lang=&quot;actionscript&quot;&gt;
public static function removeNamspaces( xml : XML ):XML {
	return XML( removeNamspacesFromString( xml.toXMLString() ) );
}

public static function removeNamspacesFromString( value : String ):String  
{  
    value = value.replace(removeNS1, &quot;&quot;);  
    var attrs:Array = value.match(removeNS2);  
    value = value.replace(removeNS2, &quot;%attribute value%&quot;);  
    value = value.replace(removeNS3, &quot;$1&quot;);  
    while (value.indexOf(&quot;%attribute value%&quot;) &gt; 0)  
    {  
        value = value.replace(&quot;%attribute value%&quot;, attrs.shift());  
    }  
    return value;  
} 

private static var removeNS1:RegExp = /xmlns[^&quot;]+\&quot;[^&quot;]+\&quot;/g;
private static var removeNS2:RegExp = /\&quot;[^&quot;]*\&quot;/g;
private static var removeNS3:RegExp = /(&lt;\/?&#124;\s)\w+\:/g;
&lt;/pre&gt;

I admit: this is not a beautiful solution. But it works for most cases. Call me lazy ;)</description>
		<content:encoded><![CDATA[<p>Leonardo, I see your problem. My E4X parser doesn&#8217;t (yet) support namespaces. It&#8217;s mainly because I didn&#8217;t really need it for my own purposes, but also because I think namespaces are a pain in the ass to handle. What I often do, is to just get rid of them:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">function</span> removeNamspaces<span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">xml</span> : <span style="color: #0066CC;">XML</span> <span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">XML</span> <span style="color: #66cc66;">&#123;</span>
	<span style="color: #b1b100;">return</span> <span style="color: #0066CC;">XML</span><span style="color: #66cc66;">&#40;</span> removeNamspacesFromString<span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">xml</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> <span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">function</span> removeNamspacesFromString<span style="color: #66cc66;">&#40;</span> value : <span style="color: #0066CC;">String</span> <span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">String</span>  
<span style="color: #66cc66;">&#123;</span>  
    value = value.<span style="color: #006600;">replace</span><span style="color: #66cc66;">&#40;</span>removeNS1, <span style="color: #ff0000;">&quot;&quot;</span><span style="color: #66cc66;">&#41;</span>;  
    <span style="color: #000000; font-weight: bold;">var</span> attrs:<span style="color: #0066CC;">Array</span> = value.<span style="color: #006600;">match</span><span style="color: #66cc66;">&#40;</span>removeNS2<span style="color: #66cc66;">&#41;</span>;  
    value = value.<span style="color: #006600;">replace</span><span style="color: #66cc66;">&#40;</span>removeNS2, <span style="color: #ff0000;">&quot;%attribute value%&quot;</span><span style="color: #66cc66;">&#41;</span>;  
    value = value.<span style="color: #006600;">replace</span><span style="color: #66cc66;">&#40;</span>removeNS3, <span style="color: #ff0000;">&quot;$1&quot;</span><span style="color: #66cc66;">&#41;</span>;  
    <span style="color: #b1b100;">while</span> <span style="color: #66cc66;">&#40;</span>value.<span style="color: #0066CC;">indexOf</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;%attribute value%&quot;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&amp;</span>gt; <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>  
    <span style="color: #66cc66;">&#123;</span>  
        value = value.<span style="color: #006600;">replace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;%attribute value%&quot;</span>, attrs.<span style="color: #006600;">shift</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;  
    <span style="color: #66cc66;">&#125;</span>  
    <span style="color: #b1b100;">return</span> value;  
<span style="color: #66cc66;">&#125;</span> 
&nbsp;
<span style="color: #0066CC;">private</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">var</span> removeNS1:RegExp = <span style="color: #66cc66;">/</span>xmlns<span style="color: #66cc66;">&#91;</span>^<span style="color: #ff0000;">&quot;]+<span style="color: #000099; font-weight: bold;">\&quot;</span>[^&quot;</span><span style="color: #66cc66;">&#93;</span>+\<span style="color: #ff0000;">&quot;/g;
private static var removeNS2:RegExp = /<span style="color: #000099; font-weight: bold;">\&quot;</span>[^&quot;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">*</span>\<span style="color: #ff0000;">&quot;/g;
private static var removeNS3:RegExp = /(&amp;lt;<span style="color: #000099; font-weight: bold;">\/</span>?|<span style="color: #000099; font-weight: bold;">\s</span>)<span style="color: #000099; font-weight: bold;">\w</span>+<span style="color: #000099; font-weight: bold;">\:</span>/g;</span></pre></div></div>

<p>I admit: this is not a beautiful solution. But it works for most cases. Call me lazy ;)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Leonardo Diaz</title>
		<link>http://blog.betabong.com/2008/09/23/e4x-string-parser/comment-page-1/#comment-58</link>
		<dc:creator>Leonardo Diaz</dc:creator>
		<pubDate>Fri, 21 Aug 2009 16:21:06 +0000</pubDate>
		<guid isPermaLink="false">http://blog.betabong.com/?p=111#comment-58</guid>
		<description>Sorry to &quot;spam&quot; your comment section, but this article is one tof the best and on google one of the first results, so I think this one last comment will help others. All the &quot;problems&quot; I&#039;ve got are nicely explained here http://www.senocular.com/flash/tutorials/as3withflashcs3/?page=4

A great resource to fully understand E4X, I think it&#039;ll help you to update your app to dynamically load the namespaces on the xml (that would be awesome), and add an option to filter by using them.</description>
		<content:encoded><![CDATA[<p>Sorry to &#8220;spam&#8221; your comment section, but this article is one tof the best and on google one of the first results, so I think this one last comment will help others. All the &#8220;problems&#8221; I&#8217;ve got are nicely explained here <a href="http://www.senocular.com/flash/tutorials/as3withflashcs3/?page=4" rel="nofollow">http://www.senocular.com/flash/tutorials/as3withflashcs3/?page=4</a></p>
<p>A great resource to fully understand E4X, I think it&#8217;ll help you to update your app to dynamically load the namespaces on the xml (that would be awesome), and add an option to filter by using them.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Leonardo Diaz</title>
		<link>http://blog.betabong.com/2008/09/23/e4x-string-parser/comment-page-1/#comment-57</link>
		<dc:creator>Leonardo Diaz</dc:creator>
		<pubDate>Fri, 21 Aug 2009 15:53:55 +0000</pubDate>
		<guid isPermaLink="false">http://blog.betabong.com/?p=111#comment-57</guid>
		<description>Hi, well I tried more examples and googled and found that the problem is the default namespace.  with the code added on my last comment (just change the [ for the ;&gt; symbol) it works just by deleting the default namespace (xmlns=&quot;urn:mpeg:schema:2001&quot;), now I&#039;m facing a different problem, and it&#039;s how to filter nodes by its params when they are defined using xsi:, for example some elements on the mpeg7 especification has a defined type (MultimediaContent xsi:type=&quot;AudioVisualType&quot; or MultimediaContent xsi:type=&quot;AudioType&quot;) or MultimediaContent xsi:type=&quot;VisualType&quot; ) if I use the e4x filter ..MultimediaContext.(@xsi:type==&quot;AudioType&quot;)  it does not work,  but if the nodes defines the params just as type=&quot;&quot; (not xsi:type=&quot;&quot;)  then a normal expression ..MultimediaContext.(@type==&quot;AudioType&quot;) works as expected.

...By the way your online parser has help me a lot, i&#039;d be crying by just debugin the code and e4x expressions.</description>
		<content:encoded><![CDATA[<p>Hi, well I tried more examples and googled and found that the problem is the default namespace.  with the code added on my last comment (just change the [ for the ;&gt; symbol) it works just by deleting the default namespace (xmlns=&#8221;urn:mpeg:schema:2001&#8243;), now I&#8217;m facing a different problem, and it&#8217;s how to filter nodes by its params when they are defined using xsi:, for example some elements on the mpeg7 especification has a defined type (MultimediaContent xsi:type=&#8221;AudioVisualType&#8221; or MultimediaContent xsi:type=&#8221;AudioType&#8221;) or MultimediaContent xsi:type=&#8221;VisualType&#8221; ) if I use the e4x filter ..MultimediaContext.(@xsi:type==&#8221;AudioType&#8221;)  it does not work,  but if the nodes defines the params just as type=&#8221;" (not xsi:type=&#8221;")  then a normal expression ..MultimediaContext.(@type==&#8221;AudioType&#8221;) works as expected.</p>
<p>&#8230;By the way your online parser has help me a lot, i&#8217;d be crying by just debugin the code and e4x expressions.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: betabong</title>
		<link>http://blog.betabong.com/2008/09/23/e4x-string-parser/comment-page-1/#comment-56</link>
		<dc:creator>betabong</dc:creator>
		<pubDate>Fri, 21 Aug 2009 09:01:36 +0000</pubDate>
		<guid isPermaLink="false">http://blog.betabong.com/?p=111#comment-56</guid>
		<description>Namespaces are not easy to come by, that&#039;s for sure. Still... what exactly doesn&#039;t work? Can you provide me the example, so I can double check with my code?</description>
		<content:encoded><![CDATA[<p>Namespaces are not easy to come by, that&#8217;s for sure. Still&#8230; what exactly doesn&#8217;t work? Can you provide me the example, so I can double check with my code?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Leonardo Diaz</title>
		<link>http://blog.betabong.com/2008/09/23/e4x-string-parser/comment-page-1/#comment-55</link>
		<dc:creator>Leonardo Diaz</dc:creator>
		<pubDate>Fri, 21 Aug 2009 05:34:27 +0000</pubDate>
		<guid isPermaLink="false">http://blog.betabong.com/?p=111#comment-55</guid>
		<description>opps for the las comment, it did not parse the xml code, I&#039;m trying with some mpeg7 document like this one:
[Mpeg7 xmlns:mpeg7=&quot;urn:mpeg:schema:2001&quot; 		 
			 xmlns=&quot;urn:mpeg:schema:2001&quot;
			 xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
			 xmlns:xml=&quot;http://www.w3.org/XML/1998/namespace&quot;
			 xsi:schemaLocation=&quot;urn:mpeg:schema:2001 XMLSchema/Mpeg7-2001.xsd &quot;]
			 
	[Description type=&quot;ContentEntityType&quot;]
		[MultimediaContent type=&quot;AudioVisualType&quot;]
			[AudioVisual]
		
				[MediaInformation]
					
				[/MediaInformation]
				
			[/AudioVisual]
		[/MultimediaContent]
	[/Description]
[/Mpeg7]

if you delete all the extra params on the mpeg7 it works, but like this, it does not.</description>
		<content:encoded><![CDATA[<p>opps for the las comment, it did not parse the xml code, I&#8217;m trying with some mpeg7 document like this one:<br />
[Mpeg7 xmlns:mpeg7="urn:mpeg:schema:2001"<br />
			 xmlns="urn:mpeg:schema:2001"<br />
			 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"<br />
			 xmlns:xml="http://www.w3.org/XML/1998/namespace"<br />
			 xsi:schemaLocation="urn:mpeg:schema:2001 XMLSchema/Mpeg7-2001.xsd "]</p>
<p>	[Description type="ContentEntityType"]<br />
		[MultimediaContent type="AudioVisualType"]<br />
			[AudioVisual]</p>
<p>				[MediaInformation]</p>
<p>				[/MediaInformation]</p>
<p>			[/AudioVisual]<br />
		[/MultimediaContent]<br />
	[/Description]<br />
[/Mpeg7]</p>
<p>if you delete all the extra params on the mpeg7 it works, but like this, it does not.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Leonardo Diaz</title>
		<link>http://blog.betabong.com/2008/09/23/e4x-string-parser/comment-page-1/#comment-54</link>
		<dc:creator>Leonardo Diaz</dc:creator>
		<pubDate>Fri, 21 Aug 2009 05:23:39 +0000</pubDate>
		<guid isPermaLink="false">http://blog.betabong.com/?p=111#comment-54</guid>
		<description>A great tool, but I haven&#039;t been able to make it work with xml code that defines namespaces and xsd like this for example:


			 
	
		
			
		
				test
				
             
	     
	



it works without the namespace and all that stuff on the mpeg7 element

Any advice??</description>
		<content:encoded><![CDATA[<p>A great tool, but I haven&#8217;t been able to make it work with xml code that defines namespaces and xsd like this for example:</p>
<p>				test</p>
<p>it works without the namespace and all that stuff on the mpeg7 element</p>
<p>Any advice??</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David</title>
		<link>http://blog.betabong.com/2008/09/23/e4x-string-parser/comment-page-1/#comment-51</link>
		<dc:creator>David</dc:creator>
		<pubDate>Tue, 11 Aug 2009 22:17:50 +0000</pubDate>
		<guid isPermaLink="false">http://blog.betabong.com/?p=111#comment-51</guid>
		<description>Thanks! This was just what I needed.</description>
		<content:encoded><![CDATA[<p>Thanks! This was just what I needed.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
