I need to get values from a couple xml files that vary.
Ex. one file could contain:

<typeB>
<people.b>  
  <person.1>    
    <fname.1>brian</fname.1>
    <lname.1>smith</lname.1>
  </person.1>
  <person.11>
    <fname.1>joe</fname.1>
    <lname.1>carey</lname.1>
  </person.11>
</people.b>
</typeB>

and another would replace B with A and even have an extra group

<typeA>
<people.a>  
  <person.2>
   <name>
    <fname.2>brian</fname.2>
    <lname.2>smith</lname.2>
   </name>
   <address.2>
    <street>123 pine street</street>
   </address.2>
  </person.2>
  <person.22>
    <fname.2>joe</fname.2>
    <lname.2>carey</lname.2>
  </person.22>
</people.a>
</typeA>

I would need to get any nodes that contain "fname" or "lname" regardless of the number that comes after or what the parent nodes are. Would this be possible without knowing the path?

Hi,

Assuming testDoc is your XmlDocument variable, you can try like this testDoc.DocumentElement.GetElementsByTagName("fname*");

Thanks,
Pradeep

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.