Solved

XML / XPATH data field filter

Posted on 2004-04-09
5
326 Views
Last Modified: 2013-11-19
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</field1><field2>Hello</field2></record><record><field1>2</field1><field2>World</field2></record></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>Hello</field2></record><record><field1>2</field1><field2>World</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="youranswerinhereplease">

0
Comment
Question by:plq
  • 3
  • 2
5 Comments
 
LVL 15

Expert Comment

by:dualsoul
ID: 10794449
No. As i remeber datasrc - is the extension to provide DSO. DSO is Data Source Object, not XML. It can be some data quering through ODBC for instance. So you should specify field names explicitly.

I think so...but may be i'm wrong.
0
 
LVL 8

Author Comment

by:plq
ID: 10801904
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(????)

0
 
LVL 8

Author Comment

by:plq
ID: 10801906
ooops what I should have put was

   for each nod in xmldoc.childNodes(0).childNodes
=
   for each nod in xmldoc.selectNodes(????)
0
 
LVL 15

Accepted Solution

by:
dualsoul earned 500 total points
ID: 10801989
selectNodes(child::*)  - in XPath terms.

but i don't think this will help you much.

But if you come up with some solution, let me know :)
0
 
LVL 8

Author Comment

by:plq
ID: 10834630
Nah I tried everything, its not using any xpath, I think its inserting the string directly.

thanks for trying
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to use xmlReader and idatareader  ? 4 56
AL3 Files 4 29
PowerShell script to remove string in xml file 8 20
JSON  parse help 7 26
Browsing the questions asked to the Experts of this forum, you will be amazed to see how many times people are headaching about monster regular expressions (regex) to select that specific part of some HTML or XML file they want to extract. The examp…
The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

778 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question