1

Hello all i have an xml like this

<root>
<page key"page1.aspx" value="page1" />
<page key"page2.aspx" value="cookepage" >
</root>

now what i want to get is i want key and value attributes at the same time as i want them to add into a NameValueCollection

like this

NVC.Add(key,value)

untill now i have done this

 For Each Item as XmlNode In xdoc.SelectNodes("//*/@*")
' But this returns me only key or value attribute at a time and i can not add it to NVC
 Next

looking for a good suggestion

Adils Adils
  • 241
  • 1
  • 12
  • 1
    select the `page` nodes. then for each node, loop over attributes. `if attrib.Name='key' then ... elseif attrib.Name='value' then ... end if`. See: http://stackoverflow.com/a/933698/1043824 – inquisitive Nov 04 '13 at 07:33
  • then please mark as answer and close the thread. – inquisitive Nov 04 '13 at 07:52

1 Answers1

1

select the page nodes.

then for each node, loop over attributes.

if attrib.Name='key' then ... elseif attrib.Name='value' then ... end if.

See: https://stackoverflow.com/a/933698/1043824

Community
  • 1
  • 1
inquisitive
  • 3,549
  • 2
  • 21
  • 47