Thursday 15 March 2012

xml - How to directly select nodes in C# -



xml - How to directly select nodes in C# -

i ever select node in c# system.xml library.

when got 2 lever lower current element.

xmlelement sampleelement = (xmlelement)root; xmlnodelist samplenodelist = sampleelement.selectnodes("test/code");

so within of test/code.

however after define on root below.

xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/example" xmlns="http://test.com/schema/"

then can not bring straight test/code this. have utilize 1 level down.

does have improve thought this?

thank !

i not sure asking, used do.

let's have xmldocument, select kind of note this, in xpath

xmlnode _node = xmldocument.selectsinglenode("//code"), find first encountered "code" node.

_node.innertext should give value of node.

make sure when define root elements attributes within root node not nodes.

c# xml xsd

No comments:

Post a Comment