I'm pretty n00b, but lately I've been playing with parsing some XML data. I really found a nice feature on this site where I can get a specific node with a specific attribute by doing: docFoo.SelectSingleNode ("foo / bar / baz [@ name = 'qux']); the data looks like this:
<saving-throws>
<saving-throw>
<name>Fortitude</name>
<abbr>Fort</abbr>
<ability>Con</ability>
<modifiers>
<modifier name="base" value="2"/>
<modifier name="ability" value="5"/>
<modifier name="magic" value="0"/>
<modifier name="feat" value="0"/>
<modifier name="race" value="0"/>
<modifier name="familar" value="0"/>
<modifier name="feature" value="0"/>
<modifier name="user" value="0"/>
<modifier name="misc" value="0"/>
</modifiers>
</saving-throw>
<saving-throw>
<name>Reflex</name>
<abbr>Ref</abbr>
<ability>Dex</ability>
<modifiers>
<modifier name="base" value="6"/>
<modifier name="ability" value="1"/>
<modifier name="magic" value="0"/>
<modifier name="feat" value="0"/>
<modifier name="race" value="0"/>
<modifier name="familar" value="0"/>
<modifier name="feature" value="0"/>
<modifier name="user" value="0"/>
<modifier name="misc" value="0"/>
</modifiers>
</saving-throw>
And I want to get a node named = base, but for each save-throw node, where childnode "abbr" = xx. Can I somehow do this in one SelectSingleNode, or do I have to stop on a saving throw and go through the rest of the tree?
source
share