Geeks With Blogs
Totzkeeeeee's Blog Just because I can...

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.

  1. One root element.
  2. 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?

Just because I can…

Posted on Wednesday, April 21, 2010 10:28 AM | Back to top

Comments on this post: Pidgin XML

Comments are closed.
Comments have been closed on this topic.
Copyright © David Totzke | Powered by: