• Sauron (unregistered)

    Frist

  • Sauron (unregistered)

    XML is TRWTF

  • Acne (unregistered)

    This is not that bad: there are no regular expressions!

  • (nodebb)
    In short, given the challenge of "loading XML from a document", they've managed to make the wrong choice at every opportunity.

    That definitely isn't true. They didn't use a web service to parse the XML.

  • (nodebb)

    Improvement suggestion:

    for(int i = 0; i < int.MaxValue; ++i) { } // slow down the application for no reason

  • D-Coder (unregistered)

    If the XML is known to be not large, and this isn't called frequently, then the wasted space/time are small. And it's only two lines of code. So depending on circumstances it may be quite adequate.

  • Richard Brantley (unregistered) in reply to Mr. TA

    The reason is to get the client to hire you back in six months to figure out why the application is running so slowly!

  • Lurk (unregistered)

    Sauron>XML is TRWTF There speaks someone who has never worked with EDIFACT messages. I did, 30 years ago, never again. For all its verbosity XML is a paragon of clarity by comparison. See the example here : https://en.wikipedia.org/wiki/EDIFACT

  • (nodebb) in reply to D-Coder

    It may be adequate, but it's still unnecessary. They didn't need to use the stream reader to parse the XML, turn it back into a string, and then re-parse it.

  • Fizzlecist (unregistered) in reply to Mr. TA

    I think that code would probably be left out by the optimiser. If you added a Sleep statement however...

  • (nodebb)

    The XML is needed to make it enterprisey. And if it's worth doing once, then it must be better doing it twice. This code is brillant!

  • Officer Johnny Holzkopf (unregistered) in reply to nerd4sale

    For security reasons (very important in an enterprise!), make sure you read the file character per character, then put them into an array, and finally iterate over the length of the array to build a string from it, character by character. You can easily omit unwanted characters here, if your PHB demands it, for important management reasons you're not supposed to understand. There is so much potential!

  • owlstead (unregistered)

    Oh, yeah, that's the same thing as having to program multiple XML operations in Java and the architect telling me: no, you don't have to combine them, I'll do that using a script. Of course I had to combine all of them afterwards as tech was complaining that the script was too slow.

  • owlstead (unregistered) in reply to D-Coder

    As compared to the oneliner that was otherwise required, two lines of code is still a doubling of the number of lines :)

  • سمارت بتس (unregistered)
    Comment held for moderation.
  • Fergus Brainstorm (unregistered) in reply to Mr. TA
    Comment held for moderation.
  • Craig (unregistered)
    Comment held for moderation.
  • C# Programmer (unregistered)
    Comment held for moderation.

Leave a comment on “An XML Parser”

Log In or post as a guest

Replying to comment #589060:

« Return to Article