Solved

xsi:nil and xsi:type attribute order in an element. Does it matter?

Posted on 2007-11-27
1
822 Views
Last Modified: 2012-06-27
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.docs_x003A_myNillableTestDoc xsi:type="prin:__myNillableTestDoc" xmlns:prin="http://localhost/jakobTest/nillableTest/flow/printPayload">

            <optionalAndNotNull xsi:type="xsd:string" xsi:nil="true" />

         </jakobTest.nillableTest.docs_x003A_myNillableTestDoc>
      </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.docs_x003A_myNillableTestDoc xsi:type="prin:__myNillableTestDoc" xmlns:prin="http://localhost/jakobTest/nillableTest/flow/printPayload">

            <optionalAndNotNull xsi:nil="true" xsi:type="xsd:string" />

         </jakobTest.nillableTest.docs_x003A_myNillableTestDoc>
      </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?
0
Comment
Question by:sawdustwilly
1 Comment
 
LVL 60

Accepted Solution

by:
Geert Bormans earned 125 total points
ID: 20359533
order of attributes should not be important in XML terms.
A set of attributes is an unordered nodeset
Any application that requires a specific attribute to be the last attribute in the row is erroneous
so you should report this to the integration platform vendor

cheers

Geert
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Fetch XML Unions? 3 360
RSS Feed Parsing for Images 5 45
How can i generate these XML with SimpleXML() 5 62
Path of Workbook 3 45
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Many times as a report developer I've been asked to display normalized data such as three rows with values Jack, Joe, and Bob as a single comma-separated string such as 'Jack, Joe, Bob', and vice versa.  Here's how to do it. 
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now