- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
Frist
Admin
XML is TRWTF
Admin
This is not that bad: there are no regular expressions!
Admin
That definitely isn't true. They didn't use a web service to parse the XML.
Admin
Improvement suggestion:
for(int i = 0; i < int.MaxValue; ++i) { } // slow down the application for no reason
Admin
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.
Admin
The reason is to get the client to hire you back in six months to figure out why the application is running so slowly!
Admin
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
Admin
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.
Admin
I think that code would probably be left out by the optimiser. If you added a Sleep statement however...
Admin
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!
Admin
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!
Admin
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.
Admin
As compared to the oneliner that was otherwise required, two lines of code is still a doubling of the number of lines :)