• Alan (unregistered)

    Wow. Just Wow

  • ais523 (unregistered)

    Clearly they need to encode the XML itself in XML so they can add the numbers:

    <tag name="rootNode">
      <properties/>
      <contents>
        <tag name="numberOfAddresses">
          <properties/>
          <contents>110</contents>
        </tag>
        <tag name="address" sequenceno="1" separator="_">
          <properties/>
          <contents>442 Fake St.</contents>
        </tag>
        <tag name="address" sequenceno="2" separator="_">
          <properties/>
          <contents>61 Main St.</contents>
        </tag>
        <!-- ... -->
        <tag name="address" sequenceno="110" separator="_">
          <properties/>
          <contents>3881 N 4th Ave. #5D</contents>
        </tag>
      </contents>
    </tag>
    

    See, that's much more customisable, and easier to process. It even allows a character other than underscore to be used...

  • sweavo (unregistered)

    On a project I worked on, the XML looked like this:

    <CONTAINER>
      <CONTAINER-TYPE>address</CONTAINER-TYPE>
      <NAME>thing</NAME>
      <SUB-CONTAINERS>
        <CONTAINER>
          <CONTAINER-TYPE>address_line</CONTAINER-TYPE>
          <NAME>address_line_1</NAME>
          <VALUES>
            <VALUE>
               <NAME>value1</NAME>
               <VALUE-TYPE>string</VALUE-TYPE>
               <VALUE-VALUE>10, Fake street</VALUE-VALUE>
            </VALUE>
          </VALUES>
        </CONTAINER>
        <CONTAINER>
          <CONTAINER-TYPE>address_line</CONTAINER-TYPE>
          <NAME>address_line_2</NAME>
          <VALUES>
            <VALUE>
               <NAME>value1</NAME>
               <VALUE-TYPE>string</VALUE-TYPE>
               <VALUE-VALUE>Faketown</VALUE-VALUE>
            </VALUE>
          </VALUES>
        </CONTAINER>
      </SUB-CONTAINERS>
    </CONTAINER>
    

    In the end I couldn't read the XML because the word REFACTOR kept bouncing around my head.

  • Azd (unregistered)

    Looks like someone just converted one of our ini files to xml. We have lots of files that look like this:

    numberOfAddresses=110
    address_1=442 Fake St.
    address_2=61 Main St.
       ...
    address_110=3881 N 4th Ave. #5D
    
  • (cs)

    I've always wondered why people name things the blindingly obvious.

    e.g. <rootNode> or public class BasePage : System.Web.Page (note not abstract)

    The name does not describe the purpose and fixes it to a specified location in a hierarchy, invariably as time goes on RootNode, gets moved down the hierarchy and is no longer the ‘rootnode’

  • (cs)

    An XML Schema is perfectly possible. :)

    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
        <xs:element name="rootNode">
            <xs:complexType>
                <xs:sequence>
                    <xs:element name="numberOfAddresses" type="xs:nonNegativeInteger"/>
                    <xs:any maxOccurs="unbounded" minOccurs="0" namespace="##any" processContents="skip"/>
                </xs:sequence>
            </xs:complexType>
        </xs:element>
    </xs:schema>
  • Azd (unregistered) in reply to Azd
    Azd:
    Looks like someone just converted one of our ini files to xml. We have lots of files that look like this:
    numberOfAddresses=110
    address_1=442 Fake St.
    address_2=61 Main St.
       ...
    address_110=3881 N 4th Ave. #5D
    

    I should also add that the code to read in this would open and close the file 111 times ... and was accessed by multiple processes with no locking for interprocess communication.

  • (cs) in reply to pcooper
    pcooper:
    An XML Schema is perfectly possible. :)
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
        <xs:element name="rootNode">
            <xs:complexType>
                <xs:sequence>
                    <xs:element name="numberOfAddresses" type="xs:nonNegativeInteger"/>
                    <xs:any maxOccurs="unbounded" minOccurs="0" namespace="##any" processContents="skip"/>
                </xs:sequence>
            </xs:complexType>
        </xs:element>
    </xs:schema>

    Smarty-pants!

  • xml dragon (unregistered) in reply to ais523
    ais523:
    Clearly they need to encode the XML itself in XML so they can add the numbers:
    <tag name="rootNode">
      <properties/>
      <contents>
        <tag name="numberOfAddresses">
          <properties/>
          <contents>110</contents>
        </tag>
        <tag name="address" sequenceno="1" separator="_">
          <properties/>
          <contents>442 Fake St.</contents>
        </tag>
        <tag name="address" sequenceno="2" separator="_">
          <properties/>
          <contents>61 Main St.</contents>
        </tag>
        <!-- ... -->
        <tag name="address" sequenceno="110" separator="_">
          <properties/>
          <contents>3881 N 4th Ave. #5D</contents>
        </tag>
      </contents>
    </tag>
    
    See, that's much more customisable, and easier to process. It even allows a character other than underscore to be used...
    But, but, but isn't xml designed to let you define your own data structures? I mean, "C" was written in assembler. C++ was most likely written in "C". Java was written in C++. Why not define MyXML in XML?
  • Obvious Conclusion (unregistered) in reply to Alan
    <MyDoc>
      <Programmer>Paula</Programmer>
      <Operation type="WTF">Code</Operation>
      <Quality>Brillant</Quality>
    </MyDoc>
    
  • (cs)

    The real WTF is that the list starts at 1...

  • me too (unregistered)

    please make the bad man go away

  • Wanja (unregistered)

    Than man is more than just shining, he's is fuckin' Paula Bean! Reminds me to last month's "These-Go-To-Fourteen"-CodeSOD.

  • (cs)

    So... in what way is this better than a csv file?

    Actually, scratch that...

    In what way is this better than writing all of the addresses on postit notes, and sticking them to the inside of a filing cabinet in an office abroad?

  • (cs) in reply to Claxon
    Claxon:
    So... in what way is this better than a csv file?

    Actually, scratch that...

    In what way is this better than writing all of the addresses on postit notes, and sticking them to the inside of a filing cabinet in an office abroad?

    I think that needs flipping around. 'In How many ways is a CSV better than this'

  • deets (unregistered)

    The real WTF is that he thinks a schema would be definable if the tags weren't enumerated. Try handcoding one without help of an altova-tool, and you're doomed...

  • (cs)

    Sweet, I understand XML now. It's just like an array.

  • Matt D (unregistered)

    Freaking unreal. This "designer" obviously missed the point of XML entirely.

  • (cs) in reply to ais523
    ais523:
    Clearly they need to encode the XML itself in XML so they can add the numbers: [...] See, that's much more customisable, and easier to process. It even allows a character other than underscore to be used...
    Naah, you didn't think enterprisey enough. What if you wanted to include other elements? Obviously the REALLY advanced-level XML encoding goes as:
    <document>
     <element>
       <property profile="system">
         <name>type</name>
         <value>tag-start</value>
       </property>
     </element>
     <element>
       <property profile="system">
         <name>type</name>
         <value>tag-name</value>
      </property>
      <property profile="system">
         <name>name</name>
         <value>numberOfAdresses</value>
      </property>
     </element>
     <element>
       <property profile="system">
         <name>type</name>
         <value>data</value>
      </property>
      <property profile="system">
         <name>value</name>
         <value>110</value>
      </property>
     </element>
     <element>
       <property profile="system">
         <name>type</name>
         <value>tag-end</value>
      </property>
     </element>
     <element>
       <property profile="system">
         <name>type</name>
         <value>comment</value>
      </property>
      <property profile="system">
         <name>value</name>
         <value> ... </value>
      </property>
     </element>
    </document>
    
  • andrew (unregistered) in reply to ais523

    Oh no, that's far too specific. What they really need is a schema meta-language, for defining acceptable XSD schemas. We could call it XSDSD (XSD Schema Definition)...

    Then you could define all the XSD instances in one go! Think of the expressive power...

  • Andrés (unregistered)

    This WTF has made me twitchy and angry...

  • (cs)

    Reminds me of a computer game I play called Space Empires 5... the game is highly moddable, but the data files are rather strict about what you can do (and the scripts are written in an abomination of a language that appears to be based mainly on Pascal and a bit on BASIC!)

    Here is a typical data file section:

    Number of Requirements := 2 Requirement 1 Description := Requires level 1 or higher in Anti-Proton Weaponry. Requirement 1 Evaluation Function := Get_Empire_Tech_Level("Anti-Proton Weaponry") >= [%Level%] Requirement 2 Description := The empire must have the Tentacle Monsters Of Death racial trait. Requirement 2 Evaluation Function := Empire_Has_Race_Trait("Tentacle Monsters Of Death") Requirement 3 Description := This requirement is impossible. Requiremetn 3 Evaluation Function := 2+2 = 5

    In this data file section, the third requirement will be ignored because the "Number of Requirements" is set to only 2, but if it were not ignored, it would cause an error because there is no space between the plus sign and its operands!

    Any other SE5 players around here? ;)

  • (cs) in reply to xml dragon
    xml dragon:
    But, but, but isn't xml designed to let you define your own data structures? I mean, "C" was written in assembler. C++ was most likely written in "C". Java was written in C++. Why not define MyXML in XML?
    Actually the first C++ compiler was written in C++, and was compiled in itself, by converting the C++ to really bad C code and then compiling that with a C compiler. See: http://en.wikipedia.org/wiki/Cfront
  • (cs) in reply to Thief^
    Thief^:
    Actually the first C++ compiler was written in C++, and was compiled in itself
    Fun exercise: Explain this concept to your grandma.
  • (cs) in reply to Grovesy
    Grovesy:
    I've always wondered why people name things the blindingly obvious.

    e.g. <rootNode> or public class BasePage : System.Web.Page (note not abstract)

    The name does not describe the purpose and fixes it to a specified location in a hierarchy, invariably as time goes on RootNode, gets moved down the hierarchy and is no longer the ‘rootnode’

    Please tell me how you get more purpose-specific than "BasePage"? What would you name it--"ProvideHeaderAndFooterAndControlsCommonToAllPages"?
  • Mike (unregistered)

    I hope people who do this get either fired have to rewrite all these XML files in their spare-time, without pay, of course.

  • (cs) in reply to FredSaw
    FredSaw:
    Grovesy:
    I've always wondered why people name things the blindingly obvious.

    e.g. <rootNode> or public class BasePage : System.Web.Page (note not abstract)

    The name does not describe the purpose and fixes it to a specified location in a hierarchy, invariably as time goes on RootNode, gets moved down the hierarchy and is no longer the ‘rootnode’

    Please tell me how you get more purpose-specific than "BasePage"? What would you name it--"ProvideHeaderAndFooterAndControlsCommonToAllPages"?

    Well, yes!. e.g. Web.Page->MyCompanyPage->SecurePage->DataViewPage->CustomerDetails

    Informs usus as to what each 'base' page does. What would you suggest? BasePage, BaseBasePage, BaseBaseBasePage???

  • (cs) in reply to FredSaw
    FredSaw:
    Grovesy:
    I've always wondered why people name things the blindingly obvious.

    e.g. <rootNode> or public class BasePage : System.Web.Page (note not abstract)

    The name does not describe the purpose and fixes it to a specified location in a hierarchy, invariably as time goes on RootNode, gets moved down the hierarchy and is no longer the ‘rootnode’

    Please tell me how you get more purpose-specific than "BasePage"? What would you name it--"ProvideHeaderAndFooterAndControlsCommonToAllPages"?

    Make it abstract then ;)

  • (cs) in reply to ais523
    ais523:
    Clearly they need to encode the XML itself in XML so they can add the numbers:
    <tag name="rootNode">
      <properties/>
      <contents>
        <tag name="numberOfAddresses">
          <properties/>
          <contents>110</contents>
        </tag>
      </contents>
    </tag>
    
    See, that's much more customisable, and easier to process. It even allows a character other than underscore to be used...
    Why the empty properties tag? :P
  • (cs)

    I can understand stupidity. Sure... However WHY WHY WHY would someone just make their own lives 10x harder? I mean I can understand a quick hack that looks like crap, performs like crap, but took 5 minutes to write, but this probably took longer to implement than a normal xml.

  • (cs) in reply to Mike
    Mike:
    I hope people who do this get either fired have to rewrite all these XML files in their spare-time, without pay, of course.

    That's getting off way too easy. Anything that accesses this XML would have to be re-written also.

  • (cs) in reply to Grovesy
    Grovesy:
    Well, yes!. e.g. Web.Page->MyCompanyPage->SecurePage->DataViewPage->CustomerDetails

    Informs usus as to what each 'base' page does. What would you suggest? BasePage, BaseBasePage, BaseBaseBasePage???

    Essentially, yes. In your example the "blindingly obvious" thing is that they all are pages. What is not obvious is that other pages derive from them. Better:

    System.Web.UI.Page->CompanyBase->SecureBase->DataViewBase->CustomerDetails

  • Sid2K7 (unregistered)

    Well, he does not need an XSD. He's had enough LSD.

  • (cs) in reply to FredSaw
    FredSaw:
    Grovesy:
    Well, yes!. e.g. Web.Page->MyCompanyPage->SecurePage->DataViewPage->CustomerDetails

    Informs usus as to what each 'base' page does. What would you suggest? BasePage, BaseBasePage, BaseBaseBasePage???

    Essentially, yes. In your example the "blindingly obvious" thing is that they all are pages. What is not obvious is that other pages derive from them. Better:

    System.Web.UI.Page->CompanyBase->SecureBase->DataViewBase->CustomerDetails

    Ok I'll meet you 1/2 way and go along with that.

    Though only if the class is marked as Abstract, then yes you could say that it is base e.g. Otherwise, it all depends in how it is being used.

    I'm just not keen on labelling a class 'base', I would prefer it to have a name that hints at its responsibility.

  • Island Usurper (unregistered)

    At least it's a data file and not a web service request. I've had to send requests to a service that only defines <shipment>, <shipment2>, and <shipment3> as part of the schema.

    The real WTF is that they also offer a parameter string version, which allows 6 different shipments to be sent at once. Never mind that "shipments" are actually the kind of things shipping, and not the shipment itself.

  • Matt (unregistered)

    TRWFT is that he didn't use JSON.

    Seriously- who uses XML anymore?

  • James (unregistered)

    OK, so I'm a bit XML-stupid... talk to me like I was 5-year-old, or a 1st-year CS student (same mental acuity, no?). Would the right way to do this would be more like this?

    <addresslist>
      
    123 ABC
    ...
    987 XYZ
    </addresslist>

    I mean, obviously you can't write a schema when every tag is different, right? So if you do what I did above, how do you get a count out of it? I took an XML course a few years back, but not a lot sunk in =-)

  • Bob (unregistered) in reply to akatherder
    akatherder:
    Sweet, I understand XML now. It's just like an array.
    You're now qualified to charge $200/hour as an XML consultant!
  • (cs)

    It seems that one of my prior co-workers actually invented that. Plagiarist!

  • (cs) in reply to James

    Where I work, we'd be efficient and reduce all that needless complexity to just a single line of XML!

    <addressList address_count="110" address_1="123. Fake St." address_2="456 Martin Luther King Blvd." ... />
  • K (unregistered) in reply to akatherder
    akatherder:
    Sweet, I understand XML now. It's just like an array.

    No, it's more like when there's a double yellow line...

  • Robert Kosten (unregistered)

    Oh, that brings back memories... I remember trying to write a XSLT to transform AutoREALM (a mapping tool for pen & paper roleplaying games) into SVG, just for fun. Luckily, I saw, AutoREALM had been extended from a binary format (pascal data-types, ugh) to include a native XML representation. I tried starting by writing a DTD to get a feel for things. Or so I thought...

    CAPTCHA: ingenium

  • John Doe (unregistered) in reply to James
    James:
    OK, so I'm a bit XML-stupid... talk to me like I was 5-year-old, or a 1st-year CS student (same mental acuity, no?). Would the right way to do this would be more like this?
    <addresslist>
      
    123 ABC
    ...
    987 XYZ
    </addresslist>
    Correct
    I mean, obviously you can't write a schema when every tag is different, right? So if you do what I did above, how do you get a count out of it? I took an XML course a few years back, but not a lot sunk in =-)
    Of course you can, but you must brace yourself for many classes, and sky high inheritance hierarchies. At least 110 fold inheritance in this case....
  • HK-47 (unregistered) in reply to ekolis
    ekolis:
    Reminds me of a computer game I play called Space Empires 5... the game is highly moddable, but the data files are rather strict about what you can do (and the scripts are written in an abomination of a language that appears to be based mainly on Pascal and a bit on BASIC!)

    Here is a typical data file section:

    Number of Requirements := 2 Requirement 1 Description := Requires level 1 or higher in Anti-Proton Weaponry. Requirement 1 Evaluation Function := Get_Empire_Tech_Level("Anti-Proton Weaponry") >= [%Level%] Requirement 2 Description := The empire must have the Tentacle Monsters Of Death racial trait. Requirement 2 Evaluation Function := Empire_Has_Race_Trait("Tentacle Monsters Of Death") Requirement 3 Description := This requirement is impossible. Requiremetn 3 Evaluation Function := 2+2 = 5

    In this data file section, the third requirement will be ignored because the "Number of Requirements" is set to only 2, but if it were not ignored, it would cause an error because there is no space between the plus sign and its operands!

    Any other SE5 players around here? ;)

    oh god I was in the beta for that

  • Dr. Evil (unregistered)

    What's wrong with this? Now if only there were a way to add something like C++ templates to XML ...

    [ducks large objects thrown at me]

  • John Doe (unregistered) in reply to deets
    deets:
    The real WTF is that he thinks a schema would be definable if the tags weren't enumerated. Try handcoding one without help of an altova-tool, and you're doomed...
    Funny that you mentioned that: One of the reasons that I'm not using any tools (from Altova, oXygen, whatever) is that I felt "doomed" by using those tools, so I'm using a text editor when I want to create some XML, and in particular XSD. Sure it costs a bit more time, but it saves me from the annoyance that certain tools want to be smarter than what is good for them.

    Any extra time is not a problem, since usually most of the time is spent thinking about the schema / data, and I don't see how a tool will speed up, except for distracting me from my real job. If speed is an issue for something, I would just make an app which can spit out the XML I need.

    This is even true for small / repeatable changes: using copy and paste in a text editor is much faster than starting up the beast of an XML editor, waiting until it is finally done creating its fancy diagrams, and wrestling your way through its GUI (gooey).

  • Dr. Evil (unregistered) in reply to John Doe

    Personally, I'd just write a small perl script to do it ...

  • John Doe (unregistered) in reply to Dr. Evil
    Dr. Evil:
    What's wrong with this? Now if only there were a way to add something like C++ templates to XML ...

    [ducks large objects thrown at me]

    The "X" in XML stands for eXtensible, so you can do it yourself. I would be very interested in a monstrous^H^H^H^H^H^H^H^H^Henterprisey hybrid of XSLT and XML Schema. Sounds very fascinating ;)

    p.s. the real WTF is that BBCode doesn't support [s]strikethrough[/s]

  • (cs)

    What if you delete, say, address 2? How will you know not to look for it? And how do you know when you've reached the end of an address?

     
    <rootNode> 
       <indexOfAddresses>1,3,4...</indexOfAddresses>
       <address_1 numberOfCharacters="12" nextAddress="address_3">442 Fake St.</address_1>
       <address_3 numberOfCharacters="11" nextAddress="address_4>61 Main St.</address_3>
       <address_4 numberOfCharacters="13" nextAddress="address_5>99 R-Tard Ave</address_3>
       ...
    </rootNode>
    </pre>
    
  • dkallen99 (unregistered)

    The REAL WTF is that he started counting with 1, instead of zero. Everyone knows arrays are indexed starting with zero.

Leave a comment on “XML Abuse”

Log In or post as a guest

Replying to comment #175424:

« Return to Article