Incorrect output of xsi:nil=true
We have a schema model built upon attributes rather than element values. For example:
<mother name="jane" age="33" />
<father name="john" age="34" />
<child name="sara" grade="first" />
<child name="thomas" grade="fifth" />
With a schema created for the above xml data installed in sql 2005, all select queries against the table containing the xml column will return xsi:nil=true in the node names.
Normally this is not a problem. However, couple that with VS2005 xmlserializer and the relevant objects will not be created.
Upvotes: 1<=-=Oct 9 2006 3:16PM=-=>
I assume that the schema produced by xsd.exe erroneously generates a nillable content model for the type. Can you remove the nillable=“true” from the XML schema? You can use the XML-DML to do so…
We are looking at improving the fidelity of our handling of the xsi:nil attribute for a future release, so only attributes that are provided in the instances are being returned. But for the time being, we recommend to only use nillable=“true” on elements that may have also non nilled content.
Unfortunately we are also using Biztalk 2006.
Turning off nillable=true would cause Biztalk to not be able to process our xml files any more.
If I set the elements to nillable=false or just flat remove that part of the declaration then Biztalk refuses to handle the xml file and spits out an error.
So it appears to be a catch 22. If I dump either Biztalk or SQL 2005 then we are okay; however, if I use a MS centric solution then I can’t use a properly formatted XML structure in our system.
I’d consider changing our system to use elements instead of attributes, but the size of both the schema and the individual xml files becomes a problem… The schema definition is about 1.0MB as it is, which defines a lot of data that has to move between various systems.
Any other work arounds? Thanks,