I have a xml column containing the content of loaded xsd files. I am using linq to retrieve the files
var xsd = from r in RegulatoryAuthoritySchema
where r.XsdTypeID == 2
where r.MajorSchemaVersion == 1
where r.MinorSchemaVersion ==0
where r.XsdStatusID == 2
select r.XsdData;
My first issue is that I can return the xsd as a string but not as a well formed xml object.
For example, if I try to parse it as an XElement or XMLDocument I get 'Data at the root level is invalid. Line 1, position 1.' I'm assuming this is due to it being derived from an xsd and not xml source. So XMLDocument expects a BOM in the declaration.
My second issue is using the returned xsd as a dynamic source for a WPF treeview. I have seen static examples of XSDs being displayed in a WPF treeview by defining them in the XData of an xmldataprovider resource in the XAML. The XMLDataprovider has a source property but this takes URIs or there is the document property that would take an XMLDocument if I could sort the first issue.
My application is WPF4 and uses开发者_StackOverflow中文版 MVVM so ideally the xsd would be represented as a property of a ViewModel which the treeview was then bound to, but thats another post.
精彩评论