Hi James,
<snip>
Then again, if you're parsing it with something less than a full XML
parser, you're probably going to be parsing a small, highly predictable,
family of XML data streams, rather than actually parsing XML as XML.
At least, that's what I've done, where XML data streams been shoved down
my throat with no other meaningful alternative offered.
</snip>
I agree. Any well-formed custom XML is by definition XML. I guess what we are talking about here is valid XML vs well-formed XML. This distinction is important.
Well-formed XML is XML that conforms to the XML 1.0 standard. Easy check - open your XML document in firefox or IE. If it is not well-formed the browser will tell you!
Valid XML is well-formed XML that also conforms to a structure as defined in a XML Schema (XSD) or Document Type Definition (DTD). It is this document that defines your custom XML and distinguishes it from any other custom XML. All XML based languages (XSL, XSLT, SOAP, RSS, etc) have a XSD Schema to define it as a custom XML type. This structure definition helps you write software to use the custom XML. Here is the XSD Schema that defines the SOAP 1.1 envelope:
http://schemas.xmlsoap.org/soap/envelope/ . If you write XML that doesn't conform to this standard and tell your partner it is SOAP 1.1 you are mistaken, and you partner (who probably uses Apache AXIS) will tell you this quite quickly. :-)
In any interface between two systems where XML is interchanged it is extremely important that the interface is well defined. This definition gives both parties something to work to - a form of technical contract. This contract is the schema. You can write your XML generation code using the schema definition in the safe and cosy knowledge that your XML is correct (in structure at least) because it conforms to the standard set. Likewise, you can create a custom parser in the full knowledge that anything defined within the schema has been accomodated.
If your partner sends XML that doesn't conform to the schema your custom parse may fail. But this failure is a failure of your partner to keep to the contract - not a failure of your parsing code. Of course if your code handles this failure badly then that is entirely your fault. :-)
So, to avoid having to wrestle with XML that keeps changing - insist on a scema definition to define the interface (and your XML). If you provide a service that uses XML then provide a schema that defines the service. It is the best way of keeping everybody honest, and to avoid finger pointing when what should be a simple task turns out badly.
Just a few further thoughts on the subject.
Cheers
Larry Ducie
_________________________________________________________________
Get more out of Hotmail Check out the latest features today
http://windowslive.ninemsn.com.au/hotmail/article/878466/your-hotmail-is-about-to-get-even-better
As an Amazon Associate we earn from qualifying purchases.