We're having a hard time with SQL 05's xml. In a nutshell, I have a schema. I have used .Net 2.0's xsd tool to create classes from this schema.
This schema is also tied to a XML column in my database server. So far so good.
However, when I go to deserialize the xml data stored in the database server I'm getting inconsistent results. Namely the differences in the following queries: SELECT LoanXML.query('declare namespace MISMO="http://mrgdev.local/mismo/";//MISMO:LOAN') FROM Loans WHERE Loans.InternalID = @LoanID
returns something completely different from: SELECT LoanXML from Loans where InternalID = @LoanID
The difference is that the first query throws xsi:nil=true into EVERY SINGLE NODE. Whereas the second one doesn't.
When we go to deserialize, then the nodes aren't converting into objects even though they are properly filled out...
I'd just chuck the .query syntax, except for a little problem where I'm trying to return just the node(s) I want instead of the whole thing.
Is there anyone else using xml deserialization with SQL 05?
In this case the data_version node correctly comes back WITHOUT the xsi:nil="true" In addition, if we UNTYPE the xml column, then it will also come back without the xsi:nil="true"garbage; but that's not a real option.
How do we get the typed version to not do this? I even tried placing the definition for DATA_VERSION in a different schema, but this had zero effect on our output.
After all of our testing, it appears that if an element only has attributes then it reports the element as xsi:nil="true" which in our case is wrong, because our elements only have attributes.
Microsoft is conducting an online survey to understand your opinion of the Msdn Web site. If you choose to participate, the online survey will be presented to you when you leave the Msdn Web site.