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

2
  • 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: stackoverflow.com/a/933698/1043824 Commented Nov 4, 2013 at 7:33
  • then please mark as answer and close the thread. Commented Nov 4, 2013 at 7:52

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.