Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Quirk With XML Data Island Binding

Status
Not open for further replies.

larryg1964

Programmer
Apr 8, 2007
2
US
Playing around with fundamental XML Data Islands in simple HTML pages with the intent to link up an XML/RSS feed from a Forum to a lead in HTML page.

All worked as advertised, however, noticed a quirk with the very last data tag. As there are several other <link> tags but in lower nodes, it was not expected but for some reason the last higher level <link> tag is picking up the <starter><link> tag.

Looking for someone who can explain what is going on. The interesting thing is if the data tag is changed to say <anything> instead of <link>, it works fine so the IE 7.0 XML engine is not letting go of a previous tag's data OR maybe there is a limit on a given tag name. However, it would seem logical for it to be the last instance, but it is not.

Below is the code of the HTML file and a sample of the XML data. Any thoughts would be appreciated.

Thanks,
LarryG

HTML FILE (recentpost.html)
=========
<html><head><title>Test XML Databinding</title></head>
<body>
<xml id="rawdata" src="tpg_recent.xml"></xml>

<TABLE BORDER="1" datafld="recent-post" datasrc="#rawdata">

<TR><TD>Time: <SPAN DATAFLD="time"></SPAN></TD></TR>
<TR><TD>ID: <SPAN DATAFLD="id"></SPAN></TD></TR>
<TR><TD>Subject: <SPAN DATAFLD="subject"></SPAN></TD></TR>
<TR><TD>Body: <SPAN DATAFLD="body"></SPAN></TD></TR>

<TR><TD>
<TABLE BORDER="1" datafld="starter" datasrc="#rawdata">
<TR><TD>&nbsp;&nbsp;&nbsp;Starter Name: <SPAN DATAFLD="name"></SPAN></TD></TR>
<TR><TD>&nbsp;&nbsp;&nbsp;Starter Link: <SPAN DATAFLD="link"></SPAN></TD></TR>
</TABLE>
</TD></TR>

<TR><TD>
<TABLE BORDER="1" datafld="poster" datasrc="#rawdata">
<TR><TD>&nbsp;&nbsp;&nbsp;Poster Name: <SPAN DATAFLD="name"></SPAN></TD></TR>
<TR><TD>&nbsp;&nbsp;&nbsp;Poster Link: <SPAN DATAFLD="link"></SPAN></TD></TR>
</TABLE>
</TD></TR>

<TR><TD>
<TABLE BORDER="1" datafld="topic" datasrc="#rawdata">
<TR><TD>&nbsp;&nbsp;&nbsp;Topic Name: <SPAN DATAFLD="subject"></SPAN></TD></TR>
<TR><TD>&nbsp;&nbsp;&nbsp;Topic Link: <SPAN DATAFLD="link"></SPAN></TD></TR>
</TABLE>
</TD></TR>

<TR><TD>
<TABLE BORDER="1" datafld="board" datasrc="#rawdata">
<TR><TD>&nbsp;&nbsp;&nbsp;Board Name: <SPAN DATAFLD="name"></SPAN></TD></TR>
<TR><TD>&nbsp;&nbsp;&nbsp;Board Link: <SPAN DATAFLD="link"></SPAN></TD></TR>
</TABLE>
</TD></TR>

<TR><TD>Msg Link: <SPAN DATAFLD="link"></SPAN></TD></TR>

<TR><TD>&nbsp;</TD></TR>
</TABLE>

</BODY>
</HTML>


XML DATA (tpg_recent.xml)
========
<?xml version="1.0" encoding="ISO-8859-1"?>
<smf:xml-feed xmlns:smf=" xmlns=" xml:lang="en-US">
<recent-post>
<time>April 07, 2007, 06:55:12 PM</time>
<id>1111</id>
<subject>
<![CDATA[Happy Easter]]>
</subject>
<body>
<![CDATA[I want to wish everyone a Happy Easter.]]>
</body>
<starter>
<name>
<![CDATA[richard]]>
</name>
<id>3</id>
<link> </starter>
<poster>
<name>
<![CDATA[richard]]>
</name>
<id>3</id>
<link> </poster>
<topic>
<subject>
<![CDATA[Happy Easter]]>
</subject>
<id>126</id>
<link> </topic>
<board>
<name>
<![CDATA[General Discussion]]>
</name>
<id>1</id>
<link> </board>
<link> </recent-post>
</smf:xml-feed>
 
If you give upper level "link" tag another name, like "toplink", for instance, the rendering engine would pick up the right link.
 
Thanks Tsuji.
I did notice that as mentioned in my orig post, 3 paragraph. My problem is, I do not control the XML source so what I get is what I get! I can not change that tag name unfortunately.
LarryG
 
Automatic mapping to tables using data island technology is quite inflexible (and documentation obscur). Probably due to all the negative criticisms and being more innovative than others to attract broader supports at the time stopped ms to spend long enough period to beef it up robust. But I'm no historian of that, so I might be wrong.

I agree with you, very odds and the inflexibility makes it of very limited usefulness, but still of some residue usefulness, though. (The idea by itself is not necessarily bad.) To make it more flexible, it has to be coupled with jscript and xslt and to feed data with more control.

Another way to salvage the page is to wrap the last link into similar structure of "starter" ... etc and make a table on its own on the last link one level down after the wrapping. Other than that, I would not spend more time on it to fight it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top