Reading node values in specified datatype in schema( .XSD)
posted 13 years ago
I am a XML against which I have specified the schema also.I have attached the schema at run time using IXMLSchemaCollection interface. It validates the XML fine, and I get the errors if the XML structure is not according to the schema structure defined, but the problem is that when I read the node values using GetNodeTypedValue , I always get a BSTR. One more thing is that this whole works fine when the schema is in .XDR format,In this case I get values in proper datatype. Then we tried a thing for that, while writing the XML value using SetNodeTypedValue we also set the datatype using put_datatype function. This way we are able to get the values in the proper datatype but we are not able to validate the XML with the schema.This happens because when we set the datattype of the node it adds a namespace refenence to the node --- xmlns t="urn:schemas-microsoft-com atatypes" dt t="string" ----- and the validate fn gives an error that these attributes are not defined in the schema.
Still the attributes are read in BSTR's only. Please do guide me.If u can refer a sample where the schema used is .XSD format and we are validating the XML also and getting the values in correct datatypes, it wud be really helpful. I am creating my schemas in XML Spy.