<?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>Flex Examples &#187; toXMLString()</title>
	<atom:link href="http://blog.flexexamples.com/tag/toxmlstring/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.flexexamples.com</link>
	<description>Just a bunch of Adobe Flex Examples</description>
	<lastBuildDate>Wed, 26 Jan 2011 18:09:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Parsing XML nodes and Objects with dashes in their names in ActionScript 3.0</title>
		<link>http://blog.flexexamples.com/2008/08/28/parsing-xml-nodes-and-objects-with-dashes-in-their-names-in-actionscript-30/</link>
		<comments>http://blog.flexexamples.com/2008/08/28/parsing-xml-nodes-and-objects-with-dashes-in-their-names-in-actionscript-30/#comments</comments>
		<pubDate>Thu, 28 Aug 2008 08:12:49 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Object]]></category>
		<category><![CDATA[SimpleXMLDecoder]]></category>
		<category><![CDATA[XML]]></category>
		<category><![CDATA[XMLDocument]]></category>
		<category><![CDATA[toXMLString()]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/08/28/parsing-xml-nodes-and-objects-with-dashes-in-their-names-in-actionscript-30/</guid>
		<description><![CDATA[<p>The following example shows how you can parse an XML node with a dash in its node name (&#60;font-family /&#62;) as well as parsing an Object with a dash in it&#8217;s identifier using the square bracket notation ([]).</p> <p>Full code after the jump.</p> <p></p> <p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/XML_parser_test/bin/srcview/source/main.mxml.html">View MXML</a></p> &#60;?xml version="1.0" encoding="utf-8"?&#62; &#60;!-- http://blog.flexexamples.com/2008/08/28/parsing-xml-nodes-and-objects-with-dashes-in-their-names-in-actionscript-30/ --&#62; &#60;mx:Application [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can parse an XML node with a dash in its node name (&lt;font-family /&gt;) as well as parsing an Object with a dash in it&#8217;s identifier using the square bracket notation ([]).</p>
<p>Full code after the jump.</p>
<p><span id="more-776"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/XML_parser_test/bin/srcview/source/main.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/08/28/parsing-xml-nodes-and-objects-with-dashes-in-their-names-in-actionscript-30/ --&gt;
&lt;mx:Application name="XML_parser_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="horizontal"
        verticalAlign="middle"
        backgroundColor="white"
        initialize="init();"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.rpc.xml.SimpleXMLDecoder;
            import mx.utils.ObjectUtil;

            private function init():void {
                var obj:Object = xmlToObject(xmlDP);

                txtXML.text = xmlDP.toXMLString();
                txtObject.text = ObjectUtil.toString(obj);

                lblXML.text = xmlDP.entry.child('font-family').text();
                lblObject.text = String(obj.root.entry["font-family"]);
            }

            private function xmlToObject(value:XML):Object {
                var xmlStr:String = value.toXMLString();
                var xmlDoc:XMLDocument = new XMLDocument(xmlStr);
                var decoder:SimpleXMLDecoder = new SimpleXMLDecoder(true);
                var resultObj:Object = decoder.decodeXML(xmlDoc);
                return resultObj;
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:XML id="xmlDP"&gt;
        &lt;root&gt;
            &lt;entry&gt;
                &lt;font-family&gt;Arial&lt;/font-family&gt;
                &lt;font-size&gt;12&lt;/font-size&gt;
                &lt;font-weight&gt;normal&lt;/font-weight&gt;
                &lt;text-decoration&gt;underline&lt;/text-decoration&gt;
                &lt;text&gt;Hello world!&lt;/text&gt;
            &lt;/entry&gt;
        &lt;/root&gt;
    &lt;/mx:XML&gt;

    &lt;mx:Panel id="xmlPanel"&gt;
        &lt;mx:Text id="txtXML" /&gt;
        &lt;mx:ControlBar&gt;
            &lt;mx:Label text="font-family:" /&gt;
            &lt;mx:Label id="lblXML" /&gt;
        &lt;/mx:ControlBar&gt;
    &lt;/mx:Panel&gt;

    &lt;mx:Panel id="objPanel" height="{xmlPanel.height}"&gt;
        &lt;mx:Text id="txtObject" /&gt;
        &lt;mx:ControlBar&gt;
            &lt;mx:Label text="font-family:" /&gt;
            &lt;mx:Label id="lblObject" /&gt;
        &lt;/mx:ControlBar&gt;
    &lt;/mx:Panel&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/XML_parser_test/bin/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/XML_parser_test/bin/main.html" width="100%" height="300"></iframe></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Parsing XML nodes and Objects with dashes in their names in ActionScript 3.0 on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/08/28/parsing-xml-nodes-and-objects-with-dashes-in-their-names-in-actionscript-30/',contentID: 'post-776',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'toXMLString()',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2008/08/28/parsing-xml-nodes-and-objects-with-dashes-in-their-names-in-actionscript-30/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting the node indentation level when calling the toXMLString() method in ActionScript 3.0</title>
		<link>http://blog.flexexamples.com/2008/08/23/setting-the-node-indentation-level-when-calling-the-toxmlstring-method-in-actionscript-30/</link>
		<comments>http://blog.flexexamples.com/2008/08/23/setting-the-node-indentation-level-when-calling-the-toxmlstring-method-in-actionscript-30/#comments</comments>
		<pubDate>Sun, 24 Aug 2008 06:58:09 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[XML]]></category>
		<category><![CDATA[prettyIndent]]></category>
		<category><![CDATA[toXMLString()]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/08/23/setting-the-node-indentation-level-when-calling-the-toxmlstring-method-in-actionscript-30/</guid>
		<description><![CDATA[<p>The following example shows how you can set the amount of indentation used when calling the toXMLString() method by setting the static XML.prettyIndent property in ActionScript.</p> <p>Full code after the jump.</p> <p></p> <p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/XML_prettyIndent_test/bin/srcview/source/main.mxml.html">View MXML</a></p> &#60;?xml version="1.0" encoding="utf-8"?&#62; &#60;!-- http://blog.flexexamples.com/2008/08/23/setting-the-node-indentation-level-when-calling-the-toxmlstring-method-in-actionscript-30/ --&#62; &#60;mx:Application name="XML_prettyIndent_test" xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white" creationComplete="init();"&#62; &#60;mx:Script&#62; &#60;![CDATA[ import mx.events.SliderEvent; private const [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can set the amount of indentation used when calling the <code>toXMLString()</code> method by setting the static <code>XML.prettyIndent</code> property in ActionScript.</p>
<p>Full code after the jump.</p>
<p><span id="more-759"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/XML_prettyIndent_test/bin/srcview/source/main.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/08/23/setting-the-node-indentation-level-when-calling-the-toxmlstring-method-in-actionscript-30/ --&gt;
&lt;mx:Application name="XML_prettyIndent_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"
        creationComplete="init();"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.events.SliderEvent;

            private const xmlObj:XML = describeType(Application);

            private function init():void {
                slider.value = XML.prettyIndent;
                textArea.text = xmlObj.toXMLString();
            }

            private function slider_change(evt:SliderEvent):void {
                XML.prettyIndent = evt.value;
                textArea.text = xmlObj.toXMLString();
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:Form styleName="plain"&gt;
            &lt;mx:FormItem label="prettyIndent:"&gt;
                &lt;mx:HSlider id="slider"
                        minimum="0"
                        maximum="8"
                        snapInterval="1"
                        tickInterval="1"
                        liveDragging="true"
                        change="slider_change(event);" /&gt;
            &lt;/mx:FormItem&gt;
        &lt;/mx:Form&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:TextArea id="textArea"
            editable="false"
            wordWrap="false"
            width="100%"
            height="100%" /&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/XML_prettyIndent_test/bin/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/XML_prettyIndent_test/bin/main.html" width="100%" height="400"></iframe></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Setting the node indentation level when calling the toXMLString() method in ActionScript 3.0 on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/08/23/setting-the-node-indentation-level-when-calling-the-toxmlstring-method-in-actionscript-30/',contentID: 'post-759',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'prettyIndent,toXMLString()',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2008/08/23/setting-the-node-indentation-level-when-calling-the-toxmlstring-method-in-actionscript-30/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ignoring comments in an XML file in ActionScript 3.0</title>
		<link>http://blog.flexexamples.com/2008/08/22/ignoring-comments-in-an-xml-file-in-actionscript-30/</link>
		<comments>http://blog.flexexamples.com/2008/08/22/ignoring-comments-in-an-xml-file-in-actionscript-30/#comments</comments>
		<pubDate>Sat, 23 Aug 2008 06:01:18 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[XML]]></category>
		<category><![CDATA[ignoreComments]]></category>
		<category><![CDATA[toXMLString()]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/08/22/ignoring-comments-in-an-xml-file-in-actionscript-30/</guid>
		<description><![CDATA[<p>The following example shows how you can ignore comment tags (&#60;!&#x2D;&#x2D; &#8230; &#x2D;&#x2D;&#62;) in an XML document by setting the static XML.ignoreComments property.</p> <p>Full code after the jump.</p> <p></p> <p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/XML_ignoreComments_test/bin/srcview/source/main.mxml.html">View MXML</a></p> &#60;?xml version="1.0" encoding="utf-8"?&#62; &#60;!-- http://blog.flexexamples.com/2008/08/22/ignoring-comments-in-an-xml-file-in-actionscript-30/ --&#62; &#60;mx:Application name="XML_ignoreComments_test" xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white"&#62; &#60;mx:Script&#62; &#60;![CDATA[ XML.ignoreComments = false; private const xmlObj:XML = &#60;TestCase&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can ignore comment tags (&lt;!&#x2D;&#x2D; &#8230; &#x2D;&#x2D;&gt;) in an XML document by setting the static <code>XML.ignoreComments</code> property.</p>
<p>Full code after the jump.</p>
<p><span id="more-757"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/XML_ignoreComments_test/bin/srcview/source/main.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/08/22/ignoring-comments-in-an-xml-file-in-actionscript-30/ --&gt;
&lt;mx:Application name="XML_ignoreComments_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            XML.ignoreComments = false;

            private const xmlObj:XML = &lt;TestCase&gt;
                        &lt;setup&gt;
                            &lt;!-- TODO: implement --&gt;
                        &lt;/setup&gt;
                        &lt;body&gt;
                            &lt;!-- TODO: implement --&gt;
                        &lt;/body&gt;
                    &lt;/TestCase&gt;;

            private function init():void {
                XML.ignoreComments = ignoreCommentsCheckBox.selected;

                var newXMLObj:XML = xmlObj.copy();
                textArea.text = newXMLObj.toXMLString();
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:Form styleName="plain"&gt;
            &lt;mx:FormItem label="ignoreComments:"&gt;
                &lt;mx:CheckBox id="ignoreCommentsCheckBox"
                        change="init();" /&gt;
            &lt;/mx:FormItem&gt;
        &lt;/mx:Form&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:TextArea id="textArea"
            editable="false"
            width="100%"
            height="100%"
            creationComplete="init();" /&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/XML_ignoreComments_test/bin/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/XML_ignoreComments_test/bin/main.html" width="100%" height="200"></iframe></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Ignoring comments in an XML file in ActionScript 3.0 on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/08/22/ignoring-comments-in-an-xml-file-in-actionscript-30/',contentID: 'post-757',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'ignoreComments,toXMLString()',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2008/08/22/ignoring-comments-in-an-xml-file-in-actionscript-30/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

