<?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>josh &#62;&#62; /dev/blog &#38; &#187; xml</title>
	<atom:link href="http://joshua.almirun.com/category/xml/feed" rel="self" type="application/rss+xml" />
	<link>http://joshua.almirun.com</link>
	<description>technology, politics, armchair philosophy</description>
	<lastBuildDate>Sun, 02 Jan 2011 13:06:51 +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>marshalling as3 from xsd, continued</title>
		<link>http://joshua.almirun.com/tech/ria/flash/marshalling-as3-from-xsd-continued</link>
		<comments>http://joshua.almirun.com/tech/ria/flash/marshalling-as3-from-xsd-continued#comments</comments>
		<pubDate>Mon, 28 Apr 2008 00:36:06 +0000</pubDate>
		<dc:creator>Josh M</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://joshua.almirun.com/?p=127</guid>
		<description><![CDATA[I have been thinking some more following my earlier post about how good it would be to have a system for creating ActionScript classes from XML Schema, for binding XML data to code. I thought it might be a good idea to set something of this nature up as web service, or a web application, [...]]]></description>
			<content:encoded><![CDATA[<p>I have been thinking some more following my earlier <a href="http://joshua.almirun.com/tech/ria/flash/how-about-an-xsd-to-as3-class-generator">post</a> about how good it would be to have a system for creating ActionScript classes from XML Schema, for binding XML data to code.</p>
<p>I thought it might be a good idea to set something of this nature up as web service, or a web application, using Google AppEngine. I found a Python system called <a href="http://www.rexx.com/~dkuhlman/generateDS.html">generateDS</a> that does pretty much exactly what I want, except it produces Python classes instead of AS3 ones. I got in touch with Dave Kuhlman, the author of generateDS; he pointed out that the system was written specifically for generation of Python code, not for producing other code in other languages. It should be refittable for AS3 but it would take quite a bit of deep hacking.</p>
<p>Another possibility would be to work from the <a href="http://xmlbeans.apache.org/">XMLBeans</a> codebase; but this is Java, and that would exclude the possibility of working with AppEngine.</p>
<p>I would just code it up in AS3 &#8211; possibly as an AIR app &#8211; but I hesitate to do so, because ideally this kind of tool should have a CLI, so that it can be used in build scripts. </p>
<p>Maybe I should write my own from scratch in Python or Ruby. </p>
<p>Hmm&#8230;</p>
<p class="akst_link"><a href="http://joshua.almirun.com/?p=127&amp;akst_action=share-this"  title="E-mail this, post to del.icio.us, etc." id="akst_link_127" class="akst_share_link" rel="nofollow">Share This</a>
</p>]]></content:encoded>
			<wfw:commentRss>http://joshua.almirun.com/tech/ria/flash/marshalling-as3-from-xsd-continued/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>how about an xsd to as3 class generator?</title>
		<link>http://joshua.almirun.com/tech/ria/flash/how-about-an-xsd-to-as3-class-generator</link>
		<comments>http://joshua.almirun.com/tech/ria/flash/how-about-an-xsd-to-as3-class-generator#comments</comments>
		<pubDate>Wed, 23 Apr 2008 06:43:10 +0000</pubDate>
		<dc:creator>Josh M</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://joshua.almirun.com/tech/ria/flash/how-about-an-xsd-to-as3-class-generator</guid>
		<description><![CDATA[There are some really powerful solutions out there for communication between Flesh apps and the backend nowadays. LiveCycle Data Services, BlazeDS, Red5, GraniteDS, PyAMF, OpenAMF &#8230; and of course support for SOAP and JSON &#8230; and I&#8217;m sure there are others I&#8217;m forgetting. When I think about the bad old days of loadVariables(), we&#8217;ve come [...]]]></description>
			<content:encoded><![CDATA[<p>There are some really powerful solutions out there for communication between Flesh apps and the backend nowadays. LiveCycle Data Services, BlazeDS, Red5, GraniteDS, PyAMF, OpenAMF &#8230; and of course support for SOAP and JSON &#8230; and I&#8217;m sure there are others I&#8217;m forgetting. When I think about the bad old days of loadVariables(), we&#8217;ve come a long way. </p>
<p>However, not every project is worth the overhead of defining web services with a server side developer. Sometimes there is no backend. There&#8217;s just a crufty little more-or-less static XML file sent as-is, straight from the server&#8217;s filesystem via HTTP. Except maybe we will be editing the XML file later on by hand when the content changes, says the producer as an aside. OK? </p>
<p>In the real and dirty world of agency work, this is a pretty common scenario. In these cases, you load up the XML file, and nowadays we have some much better tools to read it in and deal with it, like E4X. All well and good. But it&#8217;s still patently unstable. You end up doing procedures that are very close to the structure of the data, very low-level, and therefore very much prone to fail in odd ways. Don&#8217;t get me wrong, I like E4X, but I don&#8217;t want casual references to tags and attributes that may or may not be there scattered through my code. The fact that <a href="http://fdt.powerflasher.com/">FDT</a> shows &#8220;warning&#8221; syntax underlines for E4X operations is, perhaps, a mistake on their part, but a telling one. If I refer to:</p>
<p><code>myXmlDoc.arbitraryTag.@someAttribute</code></p>
<p>&#8230; I am making a number of assumptions. I&#8217;m assuming there is an node &#8220;arbitraryTag&#8221; in my document, and it contains the attribute &#8220;someAttribute&#8221;. The deeper into the DOM you go, the more tenuous it gets, and the less likely we are to think of checking for exceptions. And, at the end of the day, why are we checking for exceptions? XML Schema represent complex data types, of which XML documents are instances.</p>
<p>Our XML Schema should map to static classes, not dynamic objects. Much as we use the ValueObject pattern in remoting and data services. Then we can guarantee that if someone edits the XML file, and it validates against the XML Schema, it will be able to be translated into an object, an instance of those classes. Right now, the way I&#8217;m dealing with XML reminds me of hacking Object.prototype : &#8211; (</p>
<p>What would be great &#8211; and if I get the time I will build one &#8211; is a system that will read in an XML schema &#8211; because it&#8217;s pretty easy to write a schema that defines what&#8217;s acceptable in the project-specific XML file and what isn&#8217;t &#8211; and generate me some ActionScript classes that encapsulate these rules. A bit like the way Flex Builder can read in WSDL and create ActionScript stubs. Except for XSD. Then we could have a translator engine that can create project-specific objects out of my XML documents (and, potentially, vice-versa).</p>
<p>There are such things in the Java and .NET worlds: <a href="http://java.sun.com/developer/technicalArticles/WebServices/jaxb/">JAXB</a> (if you follow the link you&#8217;ll see a diagram that explains what I&#8217;m getting at, much better than I have), for instance, or <a href="http://www.codeproject.com/KB/cpp/CodeXS.aspx">CodeXS</a>. </p>
<p>Why would this be good? Because errors in dealing with these kinds of objects would create compile-time errors, not run-time ones; and the XML Schema can then be a technology-neutral validation point for the documents that everything else feeds off. If it needs to change, I can then regenerate my classes from it, and it will be obvious what else I need to change in the app to deal with the change.</p>
<p class="akst_link"><a href="http://joshua.almirun.com/?p=125&amp;akst_action=share-this"  title="E-mail this, post to del.icio.us, etc." id="akst_link_125" class="akst_share_link" rel="nofollow">Share This</a>
</p>]]></content:encoded>
			<wfw:commentRss>http://joshua.almirun.com/tech/ria/flash/how-about-an-xsd-to-as3-class-generator/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

