Showing posts with label xml. Show all posts
Showing posts with label xml. Show all posts

Tuesday, March 30, 2010

Auto-Formatting your XML for legibility

Generally all of my XML work involves Flash, and trying to figure out how to point to my nodes to grab data. I use AS2, so I still use "myXML.firstChild.childNodes[4].firstChild" notation. I know there are other ways I can call this out by testing for nodeName or by using attributes, but I still prefer this method when I'm not the one writing the XML.

Anyway, tracing your XML in Flash, you'll notice Flash cares less about giving this information back to you in a digestable format. They give it to you like this:

<?xml version='1.0' encoding='utf-8' ?><somenode>someinfo</somenode><somenode><somenode><somenode><somenode></somenode></somenode></somenode></somenode></code></code></em>

Chewing through that can be a pain. I ran across a website that you can plug this into, and it will spit out beautifully formatted XML for your reading enjoyment:
http://www.shell-tools.net/index.php?op=xml%5Fformat

Tuesday, February 26, 2008

Excel to XML

I'm working on an XML driven Flash combobox today. That's an entirely different post. I asked for the list of mobile handsets this particular website would need to display as options in the dropdowns, and you can guess that a list like this, per carrier, would be HUGE. I get the list, and to my horror, the list is in Excel format (.xls). OH. MY. GOD. I'm going to have to wrap each of these items in XML tags.That's 3 carriers, a total of 600 handsets, 1200 times copying and pasting. My. This is gonna take me hours.

I've mentioned it before, I'm no developer. I consider myself to be a graphic designer that happens to know Flash, so often the programming side of things awakens parts of my brain that I haven't used since high school, when I took Turbo Pascal (or even younger, when I was programming "10 goto 20" statements on an Apple IIe). I generally can figure out how to make almost anything work in Flash, given that there are 1000 ways to do anything in that program. That said, I have no idea how to even approach this from a programming angle, so I'm about to start just copying and pasting.

One thing I've always prided myself on, was my Googling. Anyone can Google, but I have it down to a science. I was called Google Man in my past life, not a term I particularly care for. If it's on the web, most likely I can find it.Anyway, to my point, I found this website: http://www.digitalsurvivors.com/archives/000679.php. Basically showed me how to take an Excel list, and create an XML structure out of the data. Using a very simple formula, A1&B1&C1, etc., I was able to take these lists of 600 handsets total, and create a 3 fully valid XML files. Something I thought was going to take me 3 hours, took me 5 minutes. It's like freaking magic. This site saved my day and my sanity.

This is a great tool, something I had never even thought of using for something like this. Figured I'd share.