Jump to content

Using XML as a data Source


Recommended Posts

Good Evening, I am currently working on an assignment where I have use data islands to pull data from an XML document to display on an HTML web page. I have gotten everything to work so far with the exception of my description element. It is in paragraph form (<p>......</p>).How do I pull this over? Here is what I have so far. Can someone help me?

<title>Scotland Tours</title>	  <xml id="tourInfo" src="tour.xml"></xml></head><body>  <h1>Scotland Tours</h1><div><p datasrc="#tourInfo" datafld="description"></p></div><div datasrc="#infoTour" datafld="tourName">   	<h2><span datasrc="#tourInfo" datafld="tourName"></span> </h2>	<h3><img datasrc="#tourInfo" datafld="tourPhoto" hspace="3" vspace="5" border="1" /></h3> <div datasrc="#tourInfo" datafld="tourGuide"></div><div> <a datasrc="#tourInfo" datafld="tdEmail">			<span datasrc="#tourInfo" datafld="tdEmail"></span></a></div>    <table datasrc="#tourInfo" datafld="tour">    <tr>		 <th>Start Date</th>		 <th></th>		 <th></th>		 <th></th>		 <th></th>		 <th>End Date</th>  </tr>	  <tr>	  <td><span datasrc="#tourInfo" datafld="tourStart"></span></td>	  <td></td>	  <td></td>	  <td></td>	  <td></td>	  <td><span datasrc="#tourInfo" datafld="tourEnd"></span></td>	</tr></table><table border= "5" bordercolor= "brown" bordercolorlight= "tan" cellspacing= "0" 		   cellpadding= "4" width= "70%"			 style="font-family: Arial, Helvetica, sans-serif; font-size: 1em;			 background-color: white; float: left; margin: 5 0 5 5"" >	   	</tr>	<thead><tr style="background-color: yellow">	  <th colspan= "2">Itinerary</th>  </tr></thead><tbody style="font-size: 80%"><tr>	<td>Day</td>	<td rowspan="3" valign="top" style="background-color: lightblue">Activity</td></tr></table><div><p>   <button onclick="tourInfo.recordset.moveFirst()">	   |< First   </button>   <button onclick="tourInfo.recordset.movePrevious(); if (tourInfo.recordset.BOF) tourInfo.recordset.moveLast()">		< Back   </button>   <button onclick="tourInfo.recordset.moveNext(); if (tourInfo.recordset.EOF) tourInfo.recordset.moveFirst()">		Forward >   </button>   <button onclick="tourInfo.recordset.moveLast()">		Last >|   </button></p></div></body></html>

Here is the XML document:

<tours>   <tour>	 <description><p><i>Travel Scotland!</i> goes south to England and the Lake District.The tour leaves departs from London, taking an overnight train to Windemere,your gateway to the Lake District. Take some time to peruse the localshops or hike the mountains, following in the footsteps of WilliamWordsworth. With a week in the Lake District, you'll have plenty of timeto discover all of its charms and wonders.</p><p>From the Lake District, we go to York for two fun-filled days. Tour theawesome York Minster, one of the most beautiful cathedrals in Europe. Yorkis also home to underground ruins of one of the earliest Roman settlementsin Britain.</p><p>The tour concludes with two days of sight-seeing and fun in London.</p>	  </description>	  <tourName>The Lake District</tourName>	  <tourPhoto>Lake.jpg</tourPhoto>	  <tourGuide>Mary Taylor</tourGuide>	  <tdEmail>mailto:mtaylor@tscotland.com</tdEmail>	  <tourStart>6/15/2003</tourStart>	  <tourEnd>6/19/2003</tourEnd>	  <itinerary>		 <day>			<dayNumber>1</dayNumber>			<plan>London arrival</plan>		 </day>		 <day>			<dayNumber>2</dayNumber>			<plan>Train to Windemere</plan>		 </day>		 <day>			<dayNumber>3</dayNumber>			<plan>Second day in Windemere</plan>		 </day>		 <day>			<dayNumber>4</dayNumber>			<plan>Trip to Ambleside</plan>		 </day>		 <day>			<dayNumber>5</dayNumber>			<plan>Hiking tour to Grasmere</plan>		 </day>		 <day>			<dayNumber>6</dayNumber>			<plan>Boating trip on Lake Windemere</plan>		 </day>		 <day>			<dayNumber>7</dayNumber>			<plan>Free day</plan>		 </day>		 <day>			<dayNumber>8</dayNumber>			<plan>Trip to Keswick and Honister Pass</plan>		 </day>		 <day>			<dayNumber>9</dayNumber>			<plan>Return to Ambleside</plan>		 </day>		 <day>			<dayNumber>10</dayNumber>			<plan>Train to York</plan>		 </day>		 <day>			<dayNumber>11</dayNumber>			<plan>Second day in York</plan>		 </day>		 <day>			<dayNumber>12</dayNumber>			<plan>Train to London</plan>		 </day>		 <day>			<dayNumber>13</dayNumber>			<plan>Second day in London</plan>		 </day>		 <day>			<dayNumber>14</dayNumber>			<plan>London departure</plan>   		 </day>	  </itinerary>      </tour>   <tour>
Link to post
Share on other sites

Your paragraph will serve as the content holder. Remove the paragraph from the XML document, i.e. leave it like:

<description>Travel Scotland! goes south to England and the Lake District.The tour leaves departs from London, taking an overnight train to Windemere,your gateway to the Lake District. Take some time to peruse the localshops or hike the mountains, following in the footsteps of WilliamWordsworth. With a week in the Lake District, you'll have plenty of timeto discover all of its charms and wonders.From the Lake District, we go to York for two fun-filled days. Tour theawesome York Minster, one of the most beautiful cathedrals in Europe. Yorkis also home to underground ruins of one of the earliest Roman settlementsin Britain.The tour concludes with two days of sight-seeing and fun in London.	  </description>

Or, create a few separate elements in the XML and in the HTML that target each other. That is, create for example two paragraphs in the HTML and two descriptions in the XML.DataIslands are vely limited in what they can do. You might want to start learning about DOM instead. It's a far more powerful way to use XML.

Link to post
Share on other sites
Your paragraph will serve as the content holder. Remove the paragraph from the XML document, i.e. leave it like:
<description>Travel Scotland! goes south to England and the Lake District.The tour leaves departs from London, taking an overnight train to Windemere,your gateway to the Lake District. Take some time to peruse the localshops or hike the mountains, following in the footsteps of WilliamWordsworth. With a week in the Lake District, you'll have plenty of timeto discover all of its charms and wonders.From the Lake District, we go to York for two fun-filled days. Tour theawesome York Minster, one of the most beautiful cathedrals in Europe. Yorkis also home to underground ruins of one of the earliest Roman settlementsin Britain.The tour concludes with two days of sight-seeing and fun in London.	  </description>

Or, create a few separate elements in the XML and in the HTML that target each other. That is, create for example two paragraphs in the HTML and two descriptions in the XML.DataIslands are vely limited in what they can do. You might want to start learning about DOM instead. It's a far more powerful way to use XML.

Link to post
Share on other sites

Thanks! I will play with it and see what happens.

Your paragraph will serve as the content holder. Remove the paragraph from the XML document, i.e. leave it like:
<description>Travel Scotland! goes south to England and the Lake District.The tour leaves departs from London, taking an overnight train to Windemere,your gateway to the Lake District. Take some time to peruse the localshops or hike the mountains, following in the footsteps of WilliamWordsworth. With a week in the Lake District, you'll have plenty of timeto discover all of its charms and wonders.From the Lake District, we go to York for two fun-filled days. Tour theawesome York Minster, one of the most beautiful cathedrals in Europe. Yorkis also home to underground ruins of one of the earliest Roman settlementsin Britain.The tour concludes with two days of sight-seeing and fun in London.	  </description>

Or, create a few separate elements in the XML and in the HTML that target each other. That is, create for example two paragraphs in the HTML and two descriptions in the XML.DataIslands are vely limited in what they can do. You might want to start learning about DOM instead. It's a far more powerful way to use XML.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...