<?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>Forest and the Trees &#187; XML</title>
	<atom:link href="http://www.forestandthetrees.com/category/xml/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.forestandthetrees.com</link>
	<description>Data Visualization with Flex and Flash</description>
	<lastBuildDate>Fri, 11 Jun 2010 15:35:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>XML Attributes to Object Properties</title>
		<link>http://www.forestandthetrees.com/2009/01/13/xml-attributes-to-object-properties/</link>
		<comments>http://www.forestandthetrees.com/2009/01/13/xml-attributes-to-object-properties/#comments</comments>
		<pubDate>Tue, 13 Jan 2009 23:41:26 +0000</pubDate>
		<dc:creator>Doug</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Data]]></category>
		<category><![CDATA[XML]]></category>
		<category><![CDATA[attributes]]></category>
		<category><![CDATA[e4x]]></category>

		<guid isPermaLink="false">http://www.forestandthetrees.com/?p=179</guid>
		<description><![CDATA[Now I can copy and paste this code instead of having to remember a.name().toString(); Anyway &#8211; this takes var x : XML = &#60;node name=&#8217;Doug&#8217; hadAGoodTimeSleddingOnSunday = &#8216;true&#8217;/&#62; to o.name = &#8220;Doug&#8221;; o.hadAGoodTimeSleddingOnSunday = &#8220;true&#8221; //yup you&#8217;d want to type that as a Boolean. var o : Object = {}; var atts : XMLList = [...]]]></description>
			<content:encoded><![CDATA[<p>Now I can copy and paste this code instead of having to remember a.name().toString();</p>
<p>Anyway &#8211; this takes<br />
var x : XML =<br />
&lt;node name=&#8217;Doug&#8217; hadAGoodTimeSleddingOnSunday = &#8216;true&#8217;/&gt;<br />
to<br />
o.name = &#8220;Doug&#8221;;<br />
o.hadAGoodTimeSleddingOnSunday = &#8220;true&#8221; //yup you&#8217;d want to type that as a Boolean.</p>
<p>var o : Object = {};<br />
var atts : XMLList = x.attributes();<br />
for each (var a : XML in atts) {<br />
    var propName : String = a.name().toString();<br />
    o[propName] = a.toXMLString();<br />
}</p>
]]></content:encoded>
			<wfw:commentRss>http://www.forestandthetrees.com/2009/01/13/xml-attributes-to-object-properties/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>toXMLString</title>
		<link>http://www.forestandthetrees.com/2008/02/08/toxmlstring/</link>
		<comments>http://www.forestandthetrees.com/2008/02/08/toxmlstring/#comments</comments>
		<pubDate>Fri, 08 Feb 2008 19:01:34 +0000</pubDate>
		<dc:creator>Doug</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Data]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://www.forestandthetrees.com/?p=137</guid>
		<description><![CDATA[File this under either RTFM or &#8220;can I get that hour of my life back&#8221;, maybe both. To trace xml that is simple (e.g., one node), you need to use toXMLString. public var myXML:XML =&#60;root&#62; &#60;item id=&#8217;1&#8242;/&#62; &#60;item id=&#8217;2&#8242;/&#62; &#60;item id=&#8217;2&#8242;/&#62;&#60;/root&#62; public function init(): void { trace(myXML); trace(&#8216;*************@mID_n==2**************&#8217;); trace(myXML.item.(@id==2));//traces 2 nodes trace(&#8216;************@mID_n==1***************&#8217;); trace(myXML.item.(@id==1));//traces nothing trace(&#8216;***************************&#8217;); [...]]]></description>
			<content:encoded><![CDATA[<p>File this under either RTFM or &#8220;can I get that hour of my life back&#8221;, maybe both. To trace xml that is simple (e.g., one node), you need to use toXMLString.</p>
<p>      public var myXML:XML =&lt;root&gt;<br />
&lt;item id=&#8217;1&#8242;/&gt;<br />
&lt;item id=&#8217;2&#8242;/&gt;<br />
&lt;item id=&#8217;2&#8242;/&gt;&lt;/root&gt;</p>
<p>    public function init(): void {<br />
       trace(myXML);<br />
       trace(&#8216;*************@mID_n==2**************&#8217;);<br />
       trace(myXML.item.(@id==2));//traces 2 nodes<br />
       trace(&#8216;************@mID_n==1***************&#8217;);<br />
       trace(myXML.item.(@id==1));//traces nothing<br />
       trace(&#8216;***************************&#8217;);<br />
       trace(myXML.item.(@id==1).toXMLString());//traces the node<br />
    }</p>
]]></content:encoded>
			<wfw:commentRss>http://www.forestandthetrees.com/2008/02/08/toxmlstring/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Data Widgets</title>
		<link>http://www.forestandthetrees.com/2006/10/05/data-widgets/</link>
		<comments>http://www.forestandthetrees.com/2006/10/05/data-widgets/#comments</comments>
		<pubDate>Thu, 05 Oct 2006 16:59:06 +0000</pubDate>
		<dc:creator>Doug</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Data]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://www.forestandthetrees.com/?p=85</guid>
		<description><![CDATA[Sometimes I need to url-encode some text for a static xml file. And sometimes I need to know the millisecond value of a date (converting millisecond values to dates is the fastest way to create date objects from XML in Flash. Get millisecond values in Flash by using millisecondValue=new Date().getTime()). And sometimes I make widgets [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes I need to url-encode some text for a static xml file. And sometimes I need to know the millisecond value of a date (converting millisecond values to dates is the fastest way to create date objects from XML in Flash. Get millisecond values in Flash by using millisecondValue=new Date().getTime()). And sometimes I make <a href="http://www.forestandthetrees.com/dataWidgets/">widgets to do this for me</a> and then forget about them.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.forestandthetrees.com/2006/10/05/data-widgets/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Excel to XML</title>
		<link>http://www.forestandthetrees.com/2006/06/28/excel-to-xml/</link>
		<comments>http://www.forestandthetrees.com/2006/06/28/excel-to-xml/#comments</comments>
		<pubDate>Wed, 28 Jun 2006 20:20:01 +0000</pubDate>
		<dc:creator>Doug</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Data]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://www.forestandthetrees.com/?p=75</guid>
		<description><![CDATA[I had to convert an Excel file to XML so that I could load the data into Flash. Iâ€™m always excited when I get to use Microsoft Office â€“ so this was a real treat. Actually, itâ€™s not too bad â€“ but, there was one major headache. You need Excel 2003 for this to work. [...]]]></description>
			<content:encoded><![CDATA[<p>I had to convert an Excel file to XML so that I could load the data into Flash. Iâ€™m always excited when I get to use Microsoft Office â€“ so this was a real treat. Actually, itâ€™s not too bad â€“ but, there was one major headache.</p>
<p>You need Excel 2003 for this to work. (I&#8217;m using Windows)</p>
<p>Excel 2003 has a couple ways to export XML. You can use â€œSave As -> XML Spreadsheetâ€. But, that gives you a ridiculous file with lots more info that you want (formatting info, etc.). The better way to do it is to write an xsd (xml schema) and load that into the spreadsheet. Hereâ€™s a <a href="http://www.forestandthetrees.com/sampleCode/sample.xsd">sample xsd</a> defining a repeating node with a bunch of attributes.</p>
<p>So, save that as sample.xsd. Then open your Excel spreadsheet. Choose â€œData ->XML ->XML Sourceâ€. That opens the XML Source window. Click the button â€œXML Mapsâ€. Then â€œAddâ€. Then load your schema (for some reason Excel calls xsds XML Maps).</p>
<p>In the XML Source window, your attribute names will show up. You can drag them onto the column names of your spreadsheet to map them. After mapping, choose â€œSave Asâ€ choose type  â€œXML Dataâ€. And voila, an XML file formatted to the xsd.</p>
<p>Hereâ€™s the rub â€“ and the reason you need the â€œdontNeedâ€ attributes (in the xsd above). For Excel files where the columns are not of equal length or have some empty cells, the XML file will not export if you do not map the columns in sequence from left to right. (I hope there is another way around this as well) So, start at the left and map every one of the columns, until you reach the last column you need to export. Then, â€œright click->remove elementâ€ the attributes in the XML Source window that you donâ€™t need. Yes this is a kluge. But it does seem to work. </p>
<p>The error you get if you donâ€™t do this is â€œA mapped elementâ€™s relationship with other elements cannot be preserved.â€ Thatâ€™s a really helpful message.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.forestandthetrees.com/2006/06/28/excel-to-xml/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
	</channel>
</rss>
