Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. strong type in XML

strong type in XML

Scheduled Pinned Locked Moved C#
csharpquestioncomxmltutorial
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    how to do the following using .NET I have the following XML document : 3.14159 If I were using COM MSXML parser, I could get NodeTypedValue property to get "strongly-typed" value. b= XMLDocument.SelectSingleNode("//b"); variant value = b.NodeTypedValue; //now the variant contains double value. The question is: how to achieve the same using C# ? Value property of XMLNode object returns String type, wchich i have to convert to get desired type... How to do this without explicit conversion (by the means of XMLConvert class or similar...) Thanks Michal Januszczyk

    S 1 Reply Last reply
    0
    • L Lost User

      how to do the following using .NET I have the following XML document : 3.14159 If I were using COM MSXML parser, I could get NodeTypedValue property to get "strongly-typed" value. b= XMLDocument.SelectSingleNode("//b"); variant value = b.NodeTypedValue; //now the variant contains double value. The question is: how to achieve the same using C# ? Value property of XMLNode object returns String type, wchich i have to convert to get desired type... How to do this without explicit conversion (by the means of XMLConvert class or similar...) Thanks Michal Januszczyk

      S Offline
      S Offline
      Stephane Rodriguez
      wrote on last edited by
      #2

      May be that's me but I believe that even with MSXML you are supposed to have a separate schema (with attributes of the form dt:type="int") to define node data types. May be for usability reasons MS indeed allowed to put dt:type attributes along with Xml elements, but that of course didn't apply to define attribute data types since an attribute can hardly be data typed by another attribute. It's not lost with the .NET Xml parser, just made different. The Xml schema has its own namespace and has the equivalent API you referred to, scattered in this namespace. For instance, System.Xml.Schema.XmlSchemaDatatype.ParseValue(). PS : the .NET Xml parser is not a wrapper of the MSXML parser, which is a very good design decision. (at least something that stands for itself in this .NET run-time).

      J 1 Reply Last reply
      0
      • S Stephane Rodriguez

        May be that's me but I believe that even with MSXML you are supposed to have a separate schema (with attributes of the form dt:type="int") to define node data types. May be for usability reasons MS indeed allowed to put dt:type attributes along with Xml elements, but that of course didn't apply to define attribute data types since an attribute can hardly be data typed by another attribute. It's not lost with the .NET Xml parser, just made different. The Xml schema has its own namespace and has the equivalent API you referred to, scattered in this namespace. For instance, System.Xml.Schema.XmlSchemaDatatype.ParseValue(). PS : the .NET Xml parser is not a wrapper of the MSXML parser, which is a very good design decision. (at least something that stands for itself in this .NET run-time).

        J Offline
        J Offline
        Jeff J
        wrote on last edited by
        #3

        .S.Rod. wrote: ...(at least something that stands for itself in this .NET run-time). Why Stephane, I haven't noticed your using that "smiley" before. ;) If I didn't know better, I'd say you are among those of us who have been wrestling with the insanity of the software industry for so long... "Few are those who see with their own eyes and feel with their own hearts." - A. Einstein

        S 1 Reply Last reply
        0
        • J Jeff J

          .S.Rod. wrote: ...(at least something that stands for itself in this .NET run-time). Why Stephane, I haven't noticed your using that "smiley" before. ;) If I didn't know better, I'd say you are among those of us who have been wrestling with the insanity of the software industry for so long... "Few are those who see with their own eyes and feel with their own hearts." - A. Einstein

          S Offline
          S Offline
          Stephane Rodriguez
          wrote on last edited by
          #4

          A last funny pic before tonight's hunting,

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups