XML for Dummies



  • My project management software company had decided it would be best if
    our website design was contracted out to a company with more time on
    their hands and experience in design than our programmers working on the
    software a while back. The company we went with is extremely good at
    coming up with elegant company logos, business cards and website design,
    but we later found that they aren't very bright when it comes to the
    simplest kind of actual code (markup in this case).



    The website design they put together for us included a flash based menu
    navigation. This posed a problem whenever we needed to add, remove or
    change any of the items in the menu to reflect changes to the website. I
    knew that since they charged us by the hour, requesting some kind of
    external text configuration file for the menu would mean less hours they
    could claim on our bill as we could make changes for ourselves, but made
    the request anyway without any expectations. They had agreed not only to
    do so, but also to use an XML format I had requested for the
    configuration file if we ever wanted to write up our own tools to read
    in the configuration.



    The XML structure they gave us raised a few eyebrows:

    <?xml version="1.0" encoding="UTF-8"?>
    <navigation>
    <home>../index.htm</home>
    <productInfo>
    <overview>../productInfo/overview.htm</overview>
    <ppmInAction>../productInfo/ppmInAction.htm</ppmInAction>
    </productInfo>
    <downloads>
    <freeUpdates>../downloads/freeUpdates.htm</freeUpdates>
    <freeDemo>../downloads/freeDemo.htm</freeDemo>
    </downloads>
    <purchase>
    <buyNow>../purchase/buyNow.htm</buyNow>
    <myAccount>../shop/accounting.php</myAccount>
    </purchase>
    </navigation>

    We could now change the URL of various menu items, but
    it didn't leave us open to add and remove items, or change the name of
    the menu items. I informed the company of these issues and they came
    back with a new version:

    <?xml version="1.0" encoding="UTF-8"?>
    <navText>
    <mainNavA>HOME</mainNavA>
    <mainNavB>PRODUCT INFO</mainNavB>
    <subNavBa>OVERVIEW</subNavBa>
    <subNavBb>PPM IN ACTION</subNavBb>
    <mainNavC>DOWNLOADS</mainNavC>
    <subNavCa>FREE UPDATES</subNavCa>
    <subNavCb>FREE DEMO</subNavCb>
    <mainNavG>PURCHASE</mainNavG>
    <subNavGa>BUY NOW</subNavGa>
    <subNavGb>MY ACCOUNT</subNavGb>
    </navText>
    <navLinks>
    <mainNavA>/</mainNavA>
    <mainNavB>/productInfo/overview.htm</mainNavB>
    <subNavBa>/productInfo/overview.htm</subNavBa>
    <subNavBb>/productInfo/ppmInAction.htm</subNavBb>
    <mainNavC>/downloads/freeUpdates.htm</mainNavC>
    <subNavCa>/downloads/freeUpdates.htm</subNavCa>
    <subNavCb>/downloads/freeDemo.htm</subNavCb>
    <mainNavG>/purchase/buyNow.htm</mainNavG>
    <subNavGa>/purchase/buyNow.htm</subNavGa>
    <subNavGb>/shop/accounting.php</subNavGb>
    </navLinks>

    Disclaimer: I know very little about flash, so maybe it's just possible the XML parsing abilities just made this a horrible task to implement along with variable numbers of flash elements, but I've seen some pretty amazing stuff done with flash that indicate otherwise.



  • Flash has no limits in that respect. It just imports the XML into a DOM type document, with all bells and whistles you'd want.

    This XML is crap,obviously.

    But I heard say that the Flash 6 XML parser was sliiiightly faster at reading attributes than text inside elements. We are now 2.5 versions further so who knows whether that still persists.


Log in to reply