<?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>dispatchEvent() Blog™ &#187; plugin</title>
	<atom:link href="http://dispatchevent.org/tag/plugin/feed/" rel="self" type="application/rss+xml" />
	<link>http://dispatchevent.org</link>
	<description>Collective thoughts on the Flash Platform, iOS, Unity, and any other technology we use.</description>
	<lastBuildDate>Tue, 17 Aug 2010 08:15:35 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Using XML Schemas in Eclipse / FlexBuilder</title>
		<link>http://dispatchevent.org/mims/using-xml-schemas-in-eclipse-flexbuilder/</link>
		<comments>http://dispatchevent.org/mims/using-xml-schemas-in-eclipse-flexbuilder/#comments</comments>
		<pubDate>Mon, 20 Apr 2009 05:00:16 +0000</pubDate>
		<dc:creator>Mims H Wright</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tips, Tricks, and Hacks]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[flexbuilder]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[xml]]></category>
		<category><![CDATA[xml-schema]]></category>
		<category><![CDATA[xsd]]></category>

		<guid isPermaLink="false">http://dispatchevent.org/?p=626</guid>
		<description><![CDATA[UPDATE: After reading the entry by Misprintt on the SchemaManager and XMLDecoder more thoroughly, I felt the need to tell you all to go check it out! This is a very powerful undocumented feature of Flex (why undocumented?) that could &#8230; <a href="http://dispatchevent.org/mims/using-xml-schemas-in-eclipse-flexbuilder/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><strong>UPDATE:</strong> After reading the <a href="http://blog.misprintt.net/?p=192">entry by Misprintt on the SchemaManager and XMLDecoder</a> more thoroughly, I felt the need to tell you all to go check it out! This is a very powerful undocumented feature of Flex (why undocumented?) that could potentially save loads of time on a larger project. Along with the rest of this article, you could automate the parsing of your XML files into bindable model classes with ease.</p>
<p><a href="http://www.w3schools.com/Schema/default.asp">XML-Schema</a> (.XSD extension) are documents used to describe the format of XML files. They are similar to DTD (Document type declaration) files but much more powerful.</p>
<p><a href="http://dispatchevent.org/wp-content/uploads/2009/02/picture-1.png"><img class="alignnone size-full wp-image-633" title="xsd editor" src="http://dispatchevent.org/wp-content/uploads/2009/02/picture-1.png" alt="xsd editor" width="435" height="355" /></a></p>
<p>While working on some XML documents for a Flash site, I stumbled across the XML-Schema editor for Eclipse. The editor shows the XSD as a graphical representation of the model that you&#8217;re editing that looks similar to a UML class diagram.</p>
<p><a href="http://wiki.eclipse.org/index.php/Introduction_to_the_XSD_Editor">Here&#8217;s a great article on how it works.</a></p>
<h3><span id="more-626"></span>Benefits of using XSD</h3>
<p>As I said, XSD allows you to define the format of your XML document but with much more detail that DTD.</p>
<ul>
<li>XSD allows you to type your data (integers, strings, booleans) so that you can better predict what format the xml will be</li>
<li>It allows the creation of custom types which gives it an object oriented aspect</li>
<li>You can use all kinds of restrictions for what kind of content can appear within a tag including the number of elements, whether values are required or not, you can even use regular expressions to limit the acceptable values. This is very nice when you&#8217;re working with a 3rd party who is generating the XML data.</li>
<li>Using an XSD file can allow you to automate the validation of an XML file&#8217;s format</li>
</ul>
<p>Once you&#8217;ve created your XSD file, you can use the new XML document wizard to create an XML file that links to your schema file. The wizard will automatically populate the XML document with valid data! Furthermore, as you edit the XML file you will get warnings and errors if you go outside the formatting requirements defined in the XSD. For example, if you define a tag &lt;description&gt; as having a maximum length of 128, you will see a visual error if your tag contains more than 128 characters. It&#8217;s a great way to forsee problems as you write them.</p>
<p><span style="text-decoration: line-through;">I hope in the future to write some kind of tool to parse XML based on an XSD file in flash.</span> Apparently, Adobe had created an undocumented Flex feature to validate XML against XSD. <a href="http://blog.misprintt.net/?p=181">Via Misprintt</a></p>
<h3>Installing the XML extensions</h3>
<p>Unfortunately, the editor is not installed by default and nstalling software in Eclipse is not very intuitive. I&#8217;ve done my best to describe the process here but if you need further help, <a href="http://dispatchevent.org/mims/pimp-my-clipse-a-list-of-must-have-eclipse-plug-ins-for-flexflash-development/">check this entry</a>.</p>
<ol>
<li>Open Eclipse or FlexBuilder</li>
<li>Go to Help&gt;Software Updates&#8230; ( &gt; Find and Install for Eclipse 3.3)<br />
<a href="http://dispatchevent.org/wp-content/uploads/2009/02/softwareupdate.png"><img class="alignnone size-full wp-image-630" title="softwareupdate" src="http://dispatchevent.org/wp-content/uploads/2009/02/softwareupdate.png" alt="softwareupdate" /></a></li>
<li>Make sure you have the <a href="http://www.eclipse.org/europa/">Europa</a> or <a href="http://www.eclipse.org/ganymede/">Ganymede</a> update sites in the list of update sites:
<pre style="margin: 0em;">Eclipse 3.4 users:
<a class="external free" title="http://download.eclipse.org/releases/ganymede/" rel="nofollow" href="http://download.eclipse.org/releases/ganymede/">http://download.eclipse.org/releases/ganymede/</a>

<a href="http://download.eclipse.org/releases/europa/site.xml">http://download.eclipse.org/releases/europa/site.xml</a></pre>
</li>
<li>Select the XML and XSD extensions in this screenshot. In Eclipse 3.4 you can search for them, in 3.3 you will have to look through the packages for them manually.<a href="http://dispatchevent.org/wp-content/uploads/2009/02/xmlextensions.png"><img class="alignnone size-full wp-image-629" title="xmlextensions" src="http://dispatchevent.org/wp-content/uploads/2009/02/xmlextensions.png" alt="xmlextensions" width="400" /></a></li>
<li>Restart Eclipse after the install is complete</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://dispatchevent.org/mims/using-xml-schemas-in-eclipse-flexbuilder/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
