|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How to get an typed value for xmlI have an XmlAttribute defined in xsd file as a short. After I create an
XmlDocument and add an element to it, I create an attribute for the element and I set the value of the attribute as "3". However, the TypedValue in the last line of the following code does not give me a short value. Instead, it is still a string value of "3". Why? How do I get a typed value from an xml/xsd pair? // create an XmlDocument here and add header part of an xml here XmlSchemaSet mySet = new XmlSchemaSet(); XmlSchema schema = mySet.Add(null, "c:\\mySchema.xsd"); mySet.Compile(); myDoc.Schema = mySet; ValidationEventHandler handler = new ValidationEventHandler(myHandler); myDoc.Validate(handler); XPathNavigator navigator = attribute.CreateNavigator(); short value = (short)navigator.TypedValue; |
|||||||||||||||||||||||