Pidgin XML
Posted
by David Totzke
on Geeks with Blogs
See other posts from Geeks with Blogs
or by David Totzke
Published on Wed, 21 Apr 2010 15:28:20 GMT
Indexed on
2010/04/21
15:33 UTC
Read the original article
Hit count: 283
I'm looking at an xml document that gets passed to a COM object (yes, I said the "C" word) to save a new record. You can tell by the "new|" at the top of the file before the xml declaration. If we were saving, there would be "edit|" at the top. Couldn't you just have a root element with something like:
<myRootElement mode="new">
Ah, here's why that won't work...
There's no single root element but that's ok because next we find that this document is actually several documents. <?xml version="1.0"?> appears several times. The final document opens with <myElementStart> and closes with <myElementEnd> so it's not even well-formed.
This isn't a style thing. This is broken. I mean, basic well-formed XML only has two rules; three if you count the xml declaration but it works as a document for DTO purposes without it.
- One root element.
- Close all elements with a matching tag.
As a result, both ends of this conversation need to speak the same dialect of broken XML in order to communicate. To join the conversation, you must also learn pidgin XML.
How can you start out so right - XML being the obvious choice in this instance - and then go so horribly wrong?
Dave
Just because I can…
© Geeks with Blogs or respective owner