Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / XML / July 2006

Tip: Looking for answers? Try searching our database.

Data types for XmlElement and XmlAttribute

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Roy - 18 Jul 2006 14:24 GMT
I have an XmlDocument loaded from an xml file. I have also an xsd schema file
associated with it so that it will be in the XmlSchemaSet.
How do I get the data type for the value of an XmlElement and XmlAttribute
as described in the schema while I am accessing the nodes (attributes and
element) in the XmlDocument?
Martin Honnen - 18 Jul 2006 14:30 GMT
> I have an XmlDocument loaded from an xml file. I have also an xsd schema file
> associated with it so that it will be in the XmlSchemaSet.
> How do I get the data type for the value of an XmlElement and XmlAttribute
> as described in the schema while I am accessing the nodes (attributes and
> element) in the XmlDocument?

That is possible in .NET 2.0, see the property SchemaInfo
<http://msdn2.microsoft.com/en-us/library/system.xml.xmlelement.schemainfo.aspx>
<http://msdn2.microsoft.com/en-us/library/system.xml.schema.ixmlschemainfo.aspx>

Signature

    Martin Honnen --- MVP XML
    http://JavaScript.FAQTs.com/

Roy - 18 Jul 2006 16:56 GMT
Is there any support in .Net to get the value (for both attribute and
element) in its defined types?
The value for XmlAttribute alway gives a string for example. If it is
defined as an interger in xsd, I would like to get it as an interger. Or I
have to write my code to convert it for every types from string.

> > I have an XmlDocument loaded from an xml file. I have also an xsd schema file
> > associated with it so that it will be in the XmlSchemaSet.
[quoted text clipped - 5 lines]
> <http://msdn2.microsoft.com/en-us/library/system.xml.xmlelement.schemainfo.aspx>
> <http://msdn2.microsoft.com/en-us/library/system.xml.schema.ixmlschemainfo.aspx>
Priya Lakshminarayanan - 18 Jul 2006 18:05 GMT
If you use an XPathNavigator over the XmlDocument, then you can get typed
values (typed according to the schema) using the following properties on the
navigator:
TypedValue Property
ValueAsBoolean Property
ValueAsDateTime Property
ValueAsDouble Property
ValueAsInt Property
ValueAsLong Property

Thanks,
Priya

> Is there any support in .Net to get the value (for both attribute and
> element) in its defined types?
[quoted text clipped - 14 lines]
>> <http://msdn2.microsoft.com/en-us/library/system.xml.xmlelement.schemainfo.aspx>
>> <http://msdn2.microsoft.com/en-us/library/system.xml.schema.ixmlschemainfo.aspx>

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.