sawdustwilly
asked on
xsi:nil and xsi:type attribute order in an element. Does it matter?
Hi,
I have a strange error with my integration platform (webMethods). When i send xsi:nil="true" in an element the element only gets parsed as null if xsi:nil="true" is the last attribute in the element.
I have made a small web service just to test it. It will print out the input after the integration platform have parsed it from xml to its internal format.
This is how the different request looks like, coupled with the printouts of the variable value (notice that the only change in the request is the middle row that I have put two lank rows around.).
Request 1:
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:jak="http://www.test.com/icc/tip/test/jakothun">
<soapenv:Header/>
<soapenv:Body>
<jak:nillableTest soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<jakobTest.nillableTest.do cs_x003A_m yNillableT estDoc xsi:type="prin:__myNillabl eTestDoc" xmlns:prin="http://localhost/jakobTest/nillableTest/flow/printPayload">
<optionalAndNotNull xsi:type="xsd:string" xsi:nil="true" />
</jakobTest.nillableTest.d ocs_x003A_ myNillable TestDoc>
</jak:nillableTest>
</soapenv:Body>
</soapenv:Envelope>
Answer1: (parsed value outputted to a log):
optionalAndNotNull = null
Request2:
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:jak="http://www.test.com/icc/tip/test/jakothun">
<soapenv:Header/>
<soapenv:Body>
<jak:nillableTest soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<jakobTest.nillableTest.do cs_x003A_m yNillableT estDoc xsi:type="prin:__myNillabl eTestDoc" xmlns:prin="http://localhost/jakobTest/nillableTest/flow/printPayload">
<optionalAndNotNull xsi:nil="true" xsi:type="xsd:string" />
</jakobTest.nillableTest.d ocs_x003A_ myNillable TestDoc>
</jak:nillableTest>
</soapenv:Body>
</soapenv:Envelope>
Answer2:
optionalAndNotNull = ''
(empty string with two ' around)
Now to the question. Is there any XML experts out here that know if the w3c XML standard specify anything about which order xsi:nil attributes must be specified to be correct and always parsed correctly by good xml tools?
Or is this just a silly bug in my integration platform, that I should report to them instead?
I have a strange error with my integration platform (webMethods). When i send xsi:nil="true" in an element the element only gets parsed as null if xsi:nil="true" is the last attribute in the element.
I have made a small web service just to test it. It will print out the input after the integration platform have parsed it from xml to its internal format.
This is how the different request looks like, coupled with the printouts of the variable value (notice that the only change in the request is the middle row that I have put two lank rows around.).
Request 1:
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:jak="http://www.test.com/icc/tip/test/jakothun">
<soapenv:Header/>
<soapenv:Body>
<jak:nillableTest soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<jakobTest.nillableTest.do
<optionalAndNotNull xsi:type="xsd:string" xsi:nil="true" />
</jakobTest.nillableTest.d
</jak:nillableTest>
</soapenv:Body>
</soapenv:Envelope>
Answer1: (parsed value outputted to a log):
optionalAndNotNull = null
Request2:
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:jak="http://www.test.com/icc/tip/test/jakothun">
<soapenv:Header/>
<soapenv:Body>
<jak:nillableTest soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<jakobTest.nillableTest.do
<optionalAndNotNull xsi:nil="true" xsi:type="xsd:string" />
</jakobTest.nillableTest.d
</jak:nillableTest>
</soapenv:Body>
</soapenv:Envelope>
Answer2:
optionalAndNotNull = ''
(empty string with two ' around)
Now to the question. Is there any XML experts out here that know if the w3c XML standard specify anything about which order xsi:nil attributes must be specified to be correct and always parsed correctly by good xml tools?
Or is this just a silly bug in my integration platform, that I should report to them instead?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.