<X12_4010_837>
<TS837Q3_2000A>
<testvalue_AB>ck</testvalue_AB>
<TS837Q3_2000B>
<testvalue abc="testing this1">
</testvalue>
</TS837Q3_2000B>
<TS837Q3_2000B>
<testvalue abc="testing this2">
</testvalue>
</TS837Q3_2000B>
</TS837Q3_2000B>
</TS837Q3_2000A>
</X12_4010_837>
My Questions: 1) if I do SelectSingleNode(XPathFld) Does this give me both
of the nodes??? if not how can I get both nodes????
2)how can I walk through both nodes and list
the value of the attributes?????
I apprecite if some one could hep me with the
code.
Thank in advance
Public string myfunc(string strxml)
{
System.Xml.XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml(strInXml);
...............
/
XPathFld=(/X12_4010_837/TS837Q3_2000A/TS837Q3_2000B/testvalue/@abc);
nFld = xmlDoc.SelectSingleNode(XPathFld);
string Code="";
if(nFld !=null)
{
Code=nFld.Value;
}
}
> My Questions: 1) if I do SelectSingleNode(XPathFld) Does this give me both
> of the nodes??? if not how can I get both nodes????
SelectSingleNode() method selects single node as can guess from its name.
To select both use SelectNodes() method.
>
> 2)how can I walk through both nodes and list
> the value of the attributes?????
Take a look at SelectNodes() method documentation - that's pretty trivial.
--
Oleg Tkachenko [XML MVP]
http://blog.tkachenko.com