E4X. It's truly quirky. Maybe this will save someone who finds it via Google some time:
The language supports XML literal syntax... but element names have to be valid variable names or else you'll get truly cryptic compiler errors. That means no operators, which I immediately ran into while trying to use hyphenated tag names like "<element-group>".
The language also supports filtering syntax, but it only filters at the first level of the node you reference (i.e. it's not recursive in any way). So, pretty much you have to write tree walking code and the filtering syntax is just a little bit of shorthand for getting at specific children during your tree walking.
The language supports read and write "dot notation" shorthand for getting and setting elements and attributes (i.e. XML classes are unsealed). But there are some major quirks to the syntax when used as a setter:
1. Using the dot accessor shorthand as a setter is only supported with lists that have a single item. If the list has multiple items, you get a runtime error. Fail.
2. Using the dot accessor shorthand as a setter always creates the element as a child of the single item in the list instead of adding it as a second child element to the root of the list. So, in effect, while you can add a new tag with the syntax "myXML.newtag = newvalue;", you will be surprised to find that this adds the "<newtag>newvalue</newtag>" element as a child element of the FIRST CHILD of the XML object, not as a child of the root of the XML object. I imagine this is because it would be weird to be able to use the dot accessor shorthand to add a second item to a list, when that shorthand isn't supported for lists with more than one item - you coud only use the syntax exactly once for the list. Nonetheless: Fail.
3. Using the length() function on an XML object and the bracket accessor notation WILL let you add new elements to the root of the list. However, you can't mix the dot accessor shorthand syntax with the bracket accessor syntax or you will get a different runtime error. So, you can't say this: "myXML[myXML.length()].newtag = newvalue;", but you CAN say this: "myXML[myXML.length()] = <newtag>newvalue</newtag >;".
Final caveats: since the class is unsealed, you can accidentally type myXML.length and myXML.children and this will compile. However, you'll probably get a runtime error since you probably meant to type myXML.length(); and myXML.children();
|
Page Summary
July 2008
|
I'm five months into my transition from low-level driver and systems programmer to modern Flex/Java/Web application developer. (This particular transition is a second priority, after first actually doing my software management job well, which is itself quite time intensive. Hence the leisurely pace at which I'm making this transition.)
Even after I mastered traditional C++ development, I never actually built a lot of software for myself because building good software was still labor intensive, and who the hell wants to spend their few free hours away from their software job building more software? But there were definitely some pieces of software I would have liked to have built for myself if it wouldn't have been so labor intensive to do so. The theory goes that once I learn this ridiculous number of less complicated things, I'll be able to churn out reasonably useful and attractive software like nobody's business. So far it seems plausible. But oh the learning curve! So very many news things to figure out: Java the language and the runtime and the development tools, Eclipse, Ant, SQL the server and the language, JDBC to link the SQL and Java worlds, J2EE application servers like JBoss or GlassFish, servlet containers like TomKat or Jetty and JSP syntax, tag libraries like JSTL, WAR files, EAR files, XDoclet to manage deployment descriptors, XML-RPC vs. WSDL vs. RESTful semantics, countless alternative frameworks like struts or JSF or Tapestry or LCDS, Flex and ActionScript, and CSS, and HTML. I sure will be excited when my view can tell my controller to access my model to get my data out of my database and send it back to my view so it can be displayed. Unfortunately, I don't exactly know when that will happen. Maybe a few days. Maybe a few weeks. It's still hard to say :). Anyway, MySQL is finally happy with all my table definitions and data constraints, so it must be time for bed... where I will surely dream of Java objects. A photo of me from the recent NYC trip, and today's massive haul from the garden. More goodness from the mothership: http://get.adobe.com/amp/ I recorded Ben Francis this morning. Here's the song for the curious. This is very cool: http://www.youtube.com/watch?v=jwMj3PJD Garden 2008 pics for News from the job: http://www.adobe.com/aboutadobe/pressro A random mention of my existence in the media: This year I went to Singapore and India to spend Christmas and New Year's Eve with my friends Heather and Joe. The first pass of the PNME photo editing and processing is complete. You can view the results here: About 18 months ago I was upset with myself for having gone so very long without having read any fiction. So I went to a used book store, and after some browsing I settled on David Foster Wallace's "Infinite Jest". Apparently a worthy 1100 pages representing the cutting edge of fiction. So dense and involved that I had to periodically set it aside to read entire other books. So lengthy that sometimes only sheer force of will kept me pushing through towards the end. I updated my studio computer. The RAID array went belly up somehow. This might mean an entire day spent reloading sample libraries and instruments. Lame. Perhaps I'll break my "school night" rule and go make a cocktail. Right now I'm not terribly fond of computers. Here's why July almost killed me: http://www.digidesign.com/index.cfm?nav I'm at the Pittsburgh airport right now waiting for my flight home. I'm always pleased to find free WiFi at airports. (For If you look on this journal: http://mom2letterbs.livejournal.com/ Fight isolation: build a community. |