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
   Displaying nested xml via html
(Moderator: admin)
 Author
Topic: Displaying nested xml via html       [Link=180]
Reply Please log in first.
poorcow
New Member


Posts: 1




     
    Displaying nested xml via html   (Date posted: 10/31/06 at 05:34:58) Quote Modify Delete

I have an xml file which i am trying to display in a html table. The xml is nested and looks like the following:

<?xml version="1.0" ?>
- <Test version="1.1" creator="me">
+ <metadata>
- <stationlist>
- <section name="All">
+ <station name="TYNE SEA" lon="-0.460000" lat="55.000000">
<param name="Temp15" value="10" />
<param name="Weather15" value="8" />
<param name="Wind15" value="230_5" />
<param name="Temp21" value="10" />
<param name="Weather21" value="2" />
<param name="Wind21" value="250_4" />
<param name="Temp30" value="9" />
<param name="Weather30" value="2" />
<param name="Wind30" value="250_3" />
<param name="Temp39" value="9" />
<param name="Weather39" value="1" />
<param name="Wind39" value="290_4" />
<param name="Temp63" value="8" />
<param name="Weather63" value="3" />
<param name="Wind63" value="200_4" />
<param name="Temp87" value="6" />
<param name="Weather87" value="1" />
<param name="Wind87" value="180_6" />
<param name="Temp111" value="9" />
<param name="Weather111" value="1" />
<param name="Wind111" value="260_4" />
</station>
- <station name="HUMBER SEA" lon="2.340000" lat="53.500000">
<param name="Temp15" value="9" />
<param name="Weather15" value="8" />
<param name="Wind15" value="240_5" />
<param name="Temp21" value="9" />
<param name="Weather21" value="8" />
<param name="Wind21" value="250_5" />
<param name="Temp30" value="10" />
<param name="Weather30" value="2" />
<param name="Wind30" value="260_4" />
<param name="Temp39" value="10" />
<param name="Weather39" value="1" />
<param name="Wind39" value="320_3" />
<param name="Temp63" value="9" />
<param name="Weather63" value="1" />
<param name="Wind63" value="210_4" />
<param name="Temp87" value="7" />
<param name="Weather87" value="1" />
<param name="Wind87" value="180_5" />
<param name="Temp111" value="9" />
<param name="Weather111" value="1" />
<param name="Wind111" value="300_4" />
</station>
- <station name="THAMES SEA" lon="3.140000" lat="52.000000">
<param name="Temp15" value="9" />
<param name="Weather15" value="8" />
<param name="Wind15" value="240_3" />
<param name="Temp21" value="10" />
<param name="Weather21" value="2" />
<param name="Wind21" value="250_4" />
<param name="Temp30" value="9" />
<param name="Weather30" value="2" />
<param name="Wind30" value="260_3" />
<param name="Temp39" value="10" />
<param name="Weather39" value="8" />
<param name="Wind39" value="300_3" />
<param name="Temp63" value="8" />
<param name="Weather63" value="1" />
<param name="Wind63" value="160_2" />
<param name="Temp87" value="6" />
<param name="Weather87" value="1" />
<param name="Wind87" value="160_4" />
<param name="Temp111" value="10" />
<param name="Weather111" value="3" />
<param name="Wind111" value="320_4" />
</station>
</section>
</stationlist>
</Test>

I am trying to get to the <section name="All"> attribute and then go into each <station name> attribute followed by <param name> and <value>

So far my html looks like this:

<HTML>

<HEAD>
<TITLE>Test Check</TITLE>
</HEAD>

<BODY>

<!-- This is the 'Data Island' element -->
<XML ID="Temps" SRC="temps.xml"></XML>

<TR>
<TD>
<THEAD>
<TH>
<B>Temperatures</B>
</TH>
</THEAD>
</TD>
</TR>
<BR><BR>

<!-- Note the DATASRC attribute naming the MyProducts island -->
<!-- Also, the PAGESIZE=5 attribute for five rows at a time -->
<TABLE ID="TemperatureTable" DATASRC="#Temps" BORDER="1"><!-- DATAPAGESIZE="5"> -->

<TR>
<TD>
<TABLE DATASRC="#Temps" DATAFLD="stationlist.section " BORDER="1">
<THEAD>
<TH>
<B>Number of Stations:</B> <SPAN DATAFLD="section "></SPAN>
</TH>
</THEAD>
<THEAD>
<TH>
<B>Test Version:</B> <SPAN DATAFLD="version"></SPAN>
</TH>
</THEAD>
</TD>
</TR>


<THEAD>
<TH><B>
Place Name
</TH>
<TH><B>
Time Slot
</TH>
<TH><B>
Temperature
</B></TH>
</THEAD>

<TR>
<TD>
<TR>
<TD>
<TABLE DATASRC="#Temps" DATAFLD="section name" BORDER="1">
<THEAD>
<TH>
<SPAN DATAFLD="station name"></SPAN>
</TH>
</THEAD>
</TD>
</TR>
</TD>
<TD>
<SPAN DATAFLD="param"></SPAN>
</TD>
<TD>
<SPAN DATAFLD="value"></SPAN>
</TD>
</TR>

</TABLE>

</BODY>
</HTML>

Can you see where I'm going wrong?

   E-Mail   Ip: Logged
JRepici
Administrator


Posts: 328





Gender:
      JohnRHere2
    Re: Displaying nested xml via html   (Date posted: 10/31/06 at 17:08:23) Quote Modify Delete

PoorCow,

I haven't really had a time to look at this closely, but the first thing that might be giving you trouble is the XML attributes. Here's a good thread about that: #23

     -djr

   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.