• chreng (disco)

    I bet they do not escape xml-characters

  • adrian7 (disco) in reply to chreng

    might be valid xml tho :stuck_out_tongue:

  • gleemonk (disco)

    <comment_3>And where's the WTF? </comment_3>

  • aliceif (disco) in reply to gleemonk

    In the title.

  • gleemonk (disco) in reply to aliceif

    Literally you're correct. The most perfect form of correct. Your statement competes with Mathematics on being perfect. I didn't say it was useless, did I? That would have been microaggressing, and I couldn't do that I'm sure.

  • dkf (disco) in reply to adrian7

    Well-formed, sure. Maybe. Valid? I'm not writing that DTD/schema…!

  • dkf (disco)

    I've also seen it argued seriously to me that you need to write:

    <foo>
        <elem number="1"> … </elem>
        <elem number="2"> … </elem>
        <elem number="3"> … </elem>
        <elem number="4"> … </elem>
        <elem number="5"> … </elem>
    </foo>
    

    Why? Because the person concerned thought that otherwise the order of the <elem>s would be undefined, and that a sequence number was therefore critical. Because XML is designed for representing structured documents where randomly reordered paragraphs are a thing. At least I eventually managed to persuade him that XML naturally supports proper sequences of things (and always has done).

  • Jaloopa (disco) in reply to dkf

    Worth remembering that attributes are unordered, though. XML sees no semantic difference between

    <foo>
        <elem attrib1="Hello" attrib2="World" />
    </foo>
    

    and

    <foo>
        <elem attrib2="World" attrib1="Hello"  />
    </foo>
    
  • The_Quiet_One (disco)

    TRWTF is it's not zero-indexed.

  • Dragnslcr (disco) in reply to dkf
    dkf:
    I've also seen it argued _seriously_ to me that you need to write: ... Why? Because the person concerned thought that otherwise the order of the `<elem>`s would be undefined, and that a sequence number was therefore critical. Because XML is designed for representing structured documents where randomly reordered paragraphs are a thing. At least I eventually managed to persuade him that XML naturally supports proper sequences of things (and always has done).

    But what if you want the elements to be ordered in some way other than the order in the XML file? Huh? You didn't think of that, did you?

    </troll>

  • Dragnslcr (disco)

    There are people who know XML, love XML, and use XML everywhere they can, even if it isn't the best tool to use in that situation.

    Then there are people who don't know XML, but still love it and use it everywhere they can.

  • Spectre (disco) in reply to The_Quiet_One
    The_Quiet_One:
    TRWTF is it's not zero-indexed.

    Maybe it is, and the zeroth element is somewhere within the ellipsis.

  • kupfernigk (disco) in reply to Jaloopa
    Jaloopa:
    Worth remembering that attributes are unordered, though. XML sees no semantic difference

    It shouldn't though. If it regarded your two examples as different,now that would be a wtf.

  • Matt_Westwood (disco) in reply to Dragnslcr
    Dragnslcr:
    dkf:
    I've also seen it argued _seriously_ to me that you need to write: ... Why? Because the person concerned thought that otherwise the order of the `<elem>`s would be undefined, and that a sequence number was therefore critical. Because XML is designed for representing structured documents where randomly reordered paragraphs are a thing. At least I eventually managed to persuade him that XML naturally supports proper sequences of things (and always has done).

    But what if you want the elements to be ordered in some way other than the order in the XML file? Huh? You didn't think of that, did you?

    </troll>

    I have been known to include an "order" element in a particularly complicated object whose ordering is intrinsically indeterminate and defined at project implementation time, when the ordering itself is not available in the database and we needed to do some hand-rolling. Not the neatest implementation and not the most compact, but straightforward to understand and easy to maintain.

  • Peter_Wolff (disco)
    "Of course this means that an XSD schema is absolutely impossible to define."
    Not impossible, just hard, if you want to enforce that the numbers are contiguous.
  • dkf (disco) in reply to Peter_Wolff
    Peter_Wolff:
    Not impossible, just hard

    Not hard, just tedious. Very tedious. Tedious even by the standards of writing XSD by hand…

  • frostymarvelous (disco) in reply to Spectre

    You did see < address_110 > right

  • Spectre (disco) in reply to frostymarvelous

    Doesn't mean there isn't an <address_0> somewhere.

Leave a comment on “Classic WTF: XML Abuse”

Log In or post as a guest

Replying to comment #:

« Return to Article