plq
asked on
XML / XPATH data field filter
Hopefully you will only need xpath knowledge to answer this. Don't let the data islands put you off !!!
In internet explorer, you can bind a table to an xml data island as follows:
<xml id="xmlsource">
<root><record><field1>1</f ield1><fie ld2>Hello< /field2></ record><re cord><fiel d1>2</fiel d1><field2 >World</fi eld2></rec ord></root >
</xml>
<table datasrc="#xmlsource">
<tr>
<td>
<span datafld="field1"></span>
</td>
<td>
<span datafld="field2"></span>
</td>
</tr>
</table>
Now when I add attributes to the xml root node, the binding stops working. e.g. attr1 in <root attr1="12">
Here's how to fix it:
<root attr1="12"><record><field1 >1</field1 ><field2>H ello</fiel d2></recor d><record> <field1>2< /field1><f ield2>Worl d</field2> </record>< /root>
<table datasrc="#xmlsource" datafld="record">
the extra DATAFLD clause at table level fixes the problem
Question is:
Is there a way of fixing this problem without hard coding the name of the first child node ("record" in this case). I thought perhaps some mixture of slashes and dots might do it ???
<table datasrc="#xmlsource" datafld="youranswerinherep lease">
In internet explorer, you can bind a table to an xml data island as follows:
<xml id="xmlsource">
<root><record><field1>1</f
</xml>
<table datasrc="#xmlsource">
<tr>
<td>
<span datafld="field1"></span>
</td>
<td>
<span datafld="field2"></span>
</td>
</tr>
</table>
Now when I add attributes to the xml root node, the binding stops working. e.g. attr1 in <root attr1="12">
Here's how to fix it:
<root attr1="12"><record><field1
<table datasrc="#xmlsource" datafld="record">
the extra DATAFLD clause at table level fixes the problem
Question is:
Is there a way of fixing this problem without hard coding the name of the first child node ("record" in this case). I thought perhaps some mixture of slashes and dots might do it ???
<table datasrc="#xmlsource" datafld="youranswerinherep
ASKER
In practise I think (in msxml terms) IE will be doing this to expand the table client side :
for each nod in xmldoc.selectNodes("record ")
what would be the syntax for returning the first childNode (as opposed to the first attribute) in a selectNodes statement ? Without specifying "record"
for each nod in xmldoc.childNodes(0)
=
for each nod in xmldoc.selectNodes(????)
for each nod in xmldoc.selectNodes("record
what would be the syntax for returning the first childNode (as opposed to the first attribute) in a selectNodes statement ? Without specifying "record"
for each nod in xmldoc.childNodes(0)
=
for each nod in xmldoc.selectNodes(????)
ASKER
ooops what I should have put was
for each nod in xmldoc.childNodes(0).child Nodes
=
for each nod in xmldoc.selectNodes(????)
for each nod in xmldoc.childNodes(0).child
=
for each nod in xmldoc.selectNodes(????)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Nah I tried everything, its not using any xpath, I think its inserting the string directly.
thanks for trying
thanks for trying
I think so...but may be i'm wrong.