Solved

XML / XPATH data field filter

Posted on 2004-04-09
5
329 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ASP.NET reading ATOM 2 74
Post xml via PHP Soap Client 3 71
PHP delete contents of file- before writing to it 6 49
Access blocked to XML files other than sitemap.xml? 4 33
This article covers the basics of the Sass, which is a CSS extension language. You will learn about variables, mixins, and nesting.
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

749 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