PC Review


Reply
Thread Tools Rate Thread

How to get an typed value for xml

 
 
=?Utf-8?B?Um95?=
Guest
Posts: n/a
 
      15th Aug 2006
I 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;
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
what encoding does system.xml.xmldocument.save(string path) use to save the xml document if there is no <?xml... in the front of the xml document? Daniel Microsoft C# .NET 7 17th Mar 2007 11:29 AM
what encoding does system.xml.xmldocument.save(string path) use to save the xml document if there is no <?xml... in the front of the xml document? Daniel Microsoft Dot NET Framework 5 17th Mar 2007 10:11 AM
what encoding does system.xml.xmldocument.save(string path) use to save the xml document if there is no <?xml... in the front of the xml document? Daniel Microsoft Dot NET 1 15th Mar 2007 10:37 AM
Typed value in xml =?Utf-8?B?Um95?= Microsoft C# .NET 0 21st Aug 2006 03:40 AM
Validating a XML string against a XML Schema (typed dataset) Fabiano Microsoft ADO .NET 1 21st Sep 2004 10:09 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:54 PM.