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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. counting Attributes in xml file of one childnode [modified]

counting Attributes in xml file of one childnode [modified]

Scheduled Pinned Locked Moved C#
xml
4 Posts 2 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.
  • R Offline
    R Offline
    Ravi Shankar43
    wrote on last edited by
    #1

    The above xml file node has so many child nodes named . I want the code for counting number of attributes in that node. I counted the number of nodes in that file as XmlDocument doc = new XmlDocument(); doc.Load("D:/SAMPLEXML.xml"); int count = doc.SelectSingleNode ("//Payments").ChildNodes.Count; TextBox1.Text=count.ToString(); now i want to count the attributes in one node i.e payment Ravi Shankar M -- modified at 4:53 Friday 30th November, 2007

    C 2 Replies Last reply
    0
    • R Ravi Shankar43

      The above xml file node has so many child nodes named . I want the code for counting number of attributes in that node. I counted the number of nodes in that file as XmlDocument doc = new XmlDocument(); doc.Load("D:/SAMPLEXML.xml"); int count = doc.SelectSingleNode ("//Payments").ChildNodes.Count; TextBox1.Text=count.ToString(); now i want to count the attributes in one node i.e payment Ravi Shankar M -- modified at 4:53 Friday 30th November, 2007

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      You need to check 'Ignore HTML tags in this message (good for code snippets)' Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at

      R 1 Reply Last reply
      0
      • C Christian Graus

        You need to check 'Ignore HTML tags in this message (good for code snippets)' Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at

        R Offline
        R Offline
        Ravi Shankar43
        wrote on last edited by
        #3

        OK oK thank u

        1 Reply Last reply
        0
        • R Ravi Shankar43

          The above xml file node has so many child nodes named . I want the code for counting number of attributes in that node. I counted the number of nodes in that file as XmlDocument doc = new XmlDocument(); doc.Load("D:/SAMPLEXML.xml"); int count = doc.SelectSingleNode ("//Payments").ChildNodes.Count; TextBox1.Text=count.ToString(); now i want to count the attributes in one node i.e payment Ravi Shankar M -- modified at 4:53 Friday 30th November, 2007

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          you need to select each node, and do Attributes.Count ( or Attributes.Length perhaps ? ) on the node.

          Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

          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