Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
XPath to select sub-node
Message
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
XML
Titre:
XPath to select sub-node
Versions des environnements
Environment:
C# 2.0
OS:
Vista
Divers
Thread ID:
01235567
Message ID:
01235567
Vues:
61
If I have an XML structure like this:
<group>
  <items>
    <item />
    <item />
  </items>
</group>
<somethingelse>
  <items>
    <item />
    <item />
  </items>
</somethingelse>
I have loaded the XML doc and created an XmlNodeList like:
XmlNodeList groupNodeList = xml.SelectNodes(//group);
If I then iterate through the groups and attempt to move through the items in that group, I am picking up all items, not just the ones in that group.
foreach (XmlElement groupNode in groupNodeList)
  XmlNodeList = groupNode.SelectNodes(//item);
it works if I do this
  XmlNodeList = groupNode.SelectNodes(//group//items//item);
obviously the groupNode is not what I think it is - what am I doing wrong here?
- Craig

"If you're not prepared to be wrong, you will never come up with anything original."
- Sir Ken Robinson
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform