Why XML is great



  • Using XML is great - especially when the user is at least a bit skilled in orgainzing data. Now look at this:

    <people>

        <person_short name="player1" value="Aladar" number="1"/>

        <person_long name="player1" value="Aladar Bela" number="1"/>

        <person_short name="player2" value="Cecil" number="2"/>


        <person_long name="player2" value="Cecil Dezso" number="2"/>


    </people>

    This is why I love programming so much.



  • I structure XML based on how the programming API gets information from it.

    I once used a particularly crappy API from a particularly crappy XML module, and while mostly, you'd use tagnames as though they were "classes" and attributes to define the specifics (such as id, I then used unique tagnames as though they were id because that was the fastest way of getting the data using that particularly crappy API.

    There are no strict rules for defining data in XML, one of the core arguments of people who hate it: it's loose, but it's TOO loose.

    For example, which is better?

    [fruit type="apple"]

    or

    [apple type="fruit"]

    Depends on whether you ask "give me all fruits" or "give me all apples"



  • One rule that can be followed is that in an XML file there sould be no redundancy. Yesterday I thought it was obvious. Today I think it should be taught :/



  • Well... kind of... if you ask "give me all apples", every one of them is going to be a fruit... So, really, if you have a tagname "apple", you would have no reason to have a type="fruit"



  • @Zizzencs said:

    One rule that can be followed is that in an XML file there sould be no redundancy. Yesterday I thought it was obvious. Today I think it should be taught :/

    That depends on what are you doing/needing, XML is a data interchange format so let's suposse I'm going to use it right, that's I'm going to export data to another user.

    Let's suposse that I have a books table and an authors table, in my database I will store the author(s) of a books a reference to the Authors table. Suposse that I want you to know which titles do I have in stock then I willl send you the books with 'quantity>0' that are a subset of every book that I have ever had. As the books are a subset of the total is very possible that the Authors are also a subset of the total so I will not bother you sending every author. I can take two paths here sending you the subset of the authors and books tables as two different XML docs or send you a single XML doc with something like:

      <book>
          <title>SomeTitleHere</title>
          <authors>
             <author>
                <name> someAuthorName</name>
             </author>
          </authors>
       </book>

    This second method is worse in terms of performance if we want to insert this data to a database but, if the target is a XSL that will render the content as HTML, I would use the second way although is redundant.

    I think that thinking about XML in terms of non redundant data can take us very close to think of XML in terms of databases and I'm sure this is a path we don't want to walk.

     

    PS: And, of course, inserting some redundant data will make ours files bigger so the user can think 'Holy mother of God this weights 8Mb' and will give us impressive results when compressing data (that's what consultants call "a new data package that improves compressing")

     

    PSS: for those who don't know the only way of improving compressing ratio is incrementing redundancy



  • @Taliesin said:

    PSS: for those who don't know the only way of improving compressing ratio is incrementing redundancy

    I forgot to add "in losless compression" after "the only way of improving compression ratio", obviously there are two ways of improving compression ratio in compression where we can accept loss of data (loosing more data or incrementing redundancy)



  • <object type="apple" isFruit="true" />

    <object type="car" isFruit="filenotfound" />



  • @DonMcNellis said:

    Well... kind of... if you ask "give me all apples", every one of them is going to be a fruit... So, really, if you have a tagname "apple", you would have no reason to have a type="fruit"

    [apple type="computer"]

    [apple type="road"]

    [apple type="Adam's"]

    ...



  • Re: Why EML is great

    OK first off, why the heck does everyone keep calling it XML?  The acronym stands for "Extended Markup Language", right?  So shouldn't it be EML?  That's what I call it anyway.



  • Because it's eXtended Markup Language.

     

    X looks cooler than E.



  • But technicially it is

    Extended
    Markup
    Language

    or EML.



  • Re: Why XML is great

    You mean of course that it is: Extensible Markup language  right?

    If you're gonna complain about acronyms, at least get them right.  And it makes perfect sense to me. 



  • for words startin with "ex", X is generally taken as the abreviated letter not E, for the simple reasons that it sounds more like its pronounciation, and because X is so much cooler than E.

    "Cross" is also abreviated to X for the use in acronyms



  • @Albatross said:

    OK first off, why the heck does everyone keep calling it XML?  The acronym stands for "Extended Markup Language", right?  So shouldn't it be EML?  That's what I call it anyway.


    Well, the whole thing of Ex abbreviating to X instead of E has a venerable (if irritating) tradition - the IBM PC/XT (eXtended Technology) and
    XMS (eXtended Memory Specification) for example.
    While you are, of course, free to refer to anything as whatever you want, do bear in mind the potential confusion that can result from
    not following the standard nomenclature - particularly when something differs only in the E / X.
    Do you know the difference between XMS and EMS? (hint - the E stands for Expanded).

    A quick google showed 3 things called EML that could be used in the context of filetypes -
    Outlook Email (.eml), Educational Modelling Language and Ecological Metadata Language.
    Ouch :-P



  • @Albatross said:

    But technicially it is

    Extended
    Markup
    Language

    or EML.

    I think of this like finding a new planet. You find it,  you name it. So in standards this will go: we developed it, we name it.

    We should be glad they didn't call it "SuitableForStoringDataInDatabases", that will, surely, be a WTF



  • @Albatross said:

    But technicially it is

    Extended
    Markup
    Language

    or EML.


    I'm quite sure that technically it's whatever the designers decided to call it, which in this case is indeed XML.


  • @aihtdikh said:

    Do you know the difference between XMS and EMS? (hint - the E stands for Expanded).

    "Emergency Medical Services"?


Log in to reply