Click to See Complete Forum and Search --> : Passing data with XML


therealmikenels
07-17-2008, 01:46 PM
We are passing XML to another system. A large dispute has arisen concerning how XML tags that contain no data must be passed. Our problem is our BizTalk application handles a tag with no data with a single element closed at the end ex. <gateway_id /> as opposed to <gateway_id></gateway_id> or not sending it at all. Is sending a single element to indicate no data <gateway_id /> proper according to the XML standard?

Is this well-formed XML according to the standard to send to another computer that is expected to comply with the XML standard?
Example below:
<s2>
<s2form>
<MerchantInfo>
<MerchantRecord>
<stat_ind>1</stat_ind>
<gateway_id />
<phone>770-555-5555</phone>
</MerchantRecord>
</MerchantInfo>
</s2form>
</s2>

bogocles
07-17-2008, 03:25 PM
Yes, empty elements of the kind ...



<empty-element />

... are considered the "proper" way to go about these. Note, however, that just about every XML parser out there will equate the above with:



<empty-element></empty-element>

So they will both be considered to be the same, which is to say, empty.

Not to be rude or anything, but if you work in an environment where big disputes are occuring over this, then there is some major nerdiness going on. :) Beware!