Chris
2007-01-20 21:02:29 UTC
I have the following XML file that I am trying to navigate in an
xmldocument. I want to loop through the placeholders and then do a nested
loop through the properties. My code looks a little like this:
My second xpath expression doesn't return any nodes. What am I doing wrong?
The commented out expression does return something but I would that would
return all property nodes not just the ones that belong to the parent.
placeholder_nodelist =
xmlconfig.SelectNodes("/presentation/placeholders/placeholder")
For Each placeholder_node In placeholder_nodelist
Do stuff
'controlnodelist =
xmlconfig.SelectNodes("/presentation/placeholders/placeholder/properties/property")
controlnodelist = xmlconfig.SelectNodes("./properties/property")
For Each controlnode In controlnodelist
next
next
<presentation formname="form1">
<formname>form1</formname>
<placeholders>
<placeholder>
<placeholdername>plformgroup</placeholdername>
<properties>
<property><propertyname>userid</propertyname></property>
</properties>
</placeholder>
<placeholders>
<placeholder>
<placeholdername>plformgroup</placeholdername>
<properties>
<property><propertyname>userid</propertyname></property>
</properties>
</placeholder>
</presentation>
xmldocument. I want to loop through the placeholders and then do a nested
loop through the properties. My code looks a little like this:
My second xpath expression doesn't return any nodes. What am I doing wrong?
The commented out expression does return something but I would that would
return all property nodes not just the ones that belong to the parent.
placeholder_nodelist =
xmlconfig.SelectNodes("/presentation/placeholders/placeholder")
For Each placeholder_node In placeholder_nodelist
Do stuff
'controlnodelist =
xmlconfig.SelectNodes("/presentation/placeholders/placeholder/properties/property")
controlnodelist = xmlconfig.SelectNodes("./properties/property")
For Each controlnode In controlnodelist
next
next
<presentation formname="form1">
<formname>form1</formname>
<placeholders>
<placeholder>
<placeholdername>plformgroup</placeholdername>
<properties>
<property><propertyname>userid</propertyname></property>
</properties>
</placeholder>
<placeholders>
<placeholder>
<placeholdername>plformgroup</placeholdername>
<properties>
<property><propertyname>userid</propertyname></property>
</properties>
</placeholder>
</presentation>