Visit Our Home Page
 Explored,Designed,Delivered.sm
Welcome, Guest. Please Login or Register (Password Reminder)


Creativyst Forums 
Support & Discussion 
Register Help Search Login  
   
   Creativyst Forums-TOP
   Web Site Design
   Display XML Data in your HTML - How deep can be da
(Moderator: admin)
 Author
Topic: Display XML Data in your HTML - How deep can be da       [Link=17]
Reply Please log in first.
milan70
New Member


Posts: 2




     
    Display XML Data in your HTML - How deep can be da   (Date posted: 07/17/02 at 02:18:58) Quote Modify Delete

Hello,

please, can you give me small advice?

Known example:

HTML file:

<html>
<body>
<xml id="cdcat" src="cd_catalog.xml"></xml>
<table border="1" datasrc="#cdcat">
<tr>
<td><span datafld="ARTIST"></span></td>
<td><span datafld="TITLE"></span></td>
</tr>
</table>
</body>
</html>

XML file:

<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- Edited with XML Spy v4.2 -->
<CATALOG>
<CD>
<TITLE>Empire Burlesque</TITLE>
<ARTIST>Bob Dylan</ARTIST>
</CD>
<CD>
<TITLE>Hide your heart</TITLE>
<ARTIST>Bonnie Tyler</ARTIST>
</CD>
</CATALOG>

it works fine but with another XML file it doesn't work:

<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- Edited with XML Spy v4.2 -->
<CATALOG>
<CDLIST>
<CD>
<TITLE>Empire Burlesque</TITLE>
<ARTIST>Bob Dylan</ARTIST>
</CD>
<CD>
<TITLE>Hide your heart</TITLE>
<ARTIST>Bonnie Tyler</ARTIST>
</CD>
</CDLIST>
<BOOKLIST>
....etc.
</BOOKLIST>
</CATALOG>

Is it possible to bind data from deeper elements and how?

Thanks in advance.
Milan

   E-Mail   Ip: Logged
JRepici
Administrator


Posts: 328





Gender:
      JohnRHere2
    Re: Display XML Data in your HTML - How deep can be da   (Date posted: 07/18/02 at 12:04:22) Quote Modify Delete

Milan70,

Thanks for that excellent question!

You can bind deeper elements with data-binding fairly easily using nested tables and the DATAFLD attribute within the TABLE tags.

The article mentions this though it may not cover it well.

In the example you give, there are two elements of the CATALOG element that you'd like to reach into, so you'll be naming a DATAFLD right in the top level table (unusual but perfectly acceptable). Here's how I did it.










My test page (with this html code) can be found at:
http://www.creativyst.com/Site/Misc/sb/xmlDB/xmlDB.htm

Does this help?

-John






. . . . . . . . . . .
New XML file (just added some books to yours):



Last modification: JRepici - 07/18/02 at 12:04:22

   E-Mail   Ip: Logged
milan70
New Member


Posts: 2




     
    Re: Display XML Data in your HTML - How deep can be da   (Date posted: 07/19/02 at 03:22:41) Quote Modify Delete

Perfect, thanks.

I hoped that something like:
<TABLE BORDER="1" DATAFLD="CDLIST.CD" datasrc="#cdcat">
will work. Your solution is good enough.

Milan

   E-Mail   Ip: Logged
JRepici
Administrator


Posts: 328





Gender:
      JohnRHere2
    Re: Display XML Data in your HTML - How deep can be da   (Date posted: 08/08/02 at 00:17:50) Quote Modify Delete



I hoped that something like:
<TABLE BORDER="1" DATAFLD="CDLIST.CD" datasrc="#cdcat">
will work. Your solution is good enough.

Milan


I keep trying things like this as well. It seems to me one of the best ways to make a system capable of handling complexity is to make it consistent. That way, others can make intuitive generalizations that will work in unforeseen situations.

In this case, the same syntax that is used in XSL should work here, but like you, I haven't found a way to make that happen... yet

-John

Last modification: JRepici - 08/08/02 at 00:17:50

   E-Mail   Ip: Logged
Reply Please log in first.
Pages: 1
Jump to:

YaBB Board c 2000
YaBB Programming Team
 



















© Copyright 2002 - 2008 Creativyst, Inc.