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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Newby - XML data doesn't display in html page.

Status
Not open for further replies.

Evil8

MIS
Mar 3, 2006
313
US
Hello,

I'm new to using XML data. Our office has a website with a page that displays Community Meetings. Currently this page is static and needs to be updated by hand monthly. To make this more efficant I've databased the meetings in Access 2010 and exported the information to XML.

I have the page created but all I get is the table header and one row of blank cells.

So far the code looks like:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html xmlns:od="urn:schemas-microsoft-com:officedata">
<head>
<title>Community Meetings</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<script>
	function ld_meet()
	{
	var doc=nb_meet.XMLDocument;
	doc.load("meetingsbycity.xml");
	document.getElementById("head_id").innerHTML="Meetings By City ";
	}
</script>

<xml id="nb_meet" src="meetingsbycity.xml"></xml> 
<object id="nb_meet"
	CLASSID="clsid:550dda30-0541-11d2-9ca9-0060b0ec3d39"
	width="0" height="0"></object>

<body>

<table width="80%" datasrc="#nb_meet" border="1" align="center" bordercolor="#FFFFFF">
	<caption>
  <span><strong><font color="#990000" size="6">Meetings By City</font></strong></span> 
  </caption>
	<thead>
		<tr>
			<th>City</span></th>
			<th>State</span></th>
			<th>Date</span></th>
			<th>Time</span></th>
			<th>Place</span></th>
			<th>Address</span></th>
		</tr>
	</thead>
 	<tbody>
		<tr>
			<td><span datafld="city"> </span></td>
			<td><span datafld="state"> </span></td>
			<td><span datafld="edate"> </span></td>
			<td><span datafld="etime"> </span></td>
			<td><span datafld="place"> </span></td>
			<td><span datafld="address"> </span></td>
		</tr>
 	</tbody>
 </table>

</body>
</html>

Here is a sample of the XML page meetingsbycity.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="xml_style.css"?>
<dataroot xmlns:od="urn:schemas-microsoft-com:officedata" generated="2011-11-28T12:34:22">
<Meetings>
	<qry_meetings>
		<ID>1</ID>
		<edate>2011-10-06T00:00:00</edate>
		<etime>1899-12-30T11:00:00</etime>
		<name>AmericInn</name>
		<address>3009 Lakeshore Drive East</address>
		<city>Ashland</city>
		<state>WI</state>
	</qry_meetings>
	<qry_meetings>
		<ID>2</ID>
		<edate>2011-11-03T00:00:00</edate>
		<etime>1899-12-30T11:00:00</etime>
		<name>AmericInn</name>
		<address>3009 Lakeshore Drive East</address>
		<city>Ashland</city>
		<state>WI</state>
	</qry_meetings>
	<qry_meetings>
		<ID>3</ID>
		<edate>2011-12-01T00:00:00</edate>
		<etime>1899-12-30T11:00:00</etime>
		<name>AmericInn</name>
		<address>3009 Lakeshore Drive East</address>
		<city>Ashland</city>
		<state>WI</state>
	</qry_meetings>
</Meetings>
</dataroot>

I'm not sure what I'm doing wrong. I don't think I'm too far off, but I'm stuck. Can anyone help? Where does the CLASSID come from? I got the one I'm using from an example.

Thanks!
 
I got data! I simplified the DSO Function on the html page and removed the style and dataroot tags from XML page. The html code looks like this:
Code:
<html>
<head>
<title>Community Meetings</title>

<script language="JavaScript">
	function load()
	{
	var xmlDso=myXML.XMLDocument;
	xmlDso.load("meetingsbycity.xml");
	}
</script>

</head>
<body bgcolor="#FFFFFF" onLoad="load()">

<object id="myXML" CLASSID="clsid:550dda30-0541-11d2-9ca9-0060b0ec3d39"	width="0" height="0"></object>

<table datasrc="#myXML" border="1" width="100%">
	<caption>
		<span><strong><font color="#990000" size="6">Meetings By City</font></strong></span> 
 	</caption>
	<thead>
		<tr>
			<th>City</span></th>
			<th>State</span></th>
			<th>Date</span></th>
			<th>Time</span></th>
			<th>Place</span></th>
			<th>Address</span></th>
		</tr>
	</thead>
 		<tr>
			<td><span datafld="city"> </span></td>
			<td><span datafld="state"> </span></td>
			<td><span datafld="edate"> </span></td>
			<td><span datafld="etime"> </span></td>
			<td><span datafld="name"> </span></td>
			<td><span datafld="address"> </span></td>
		</tr>
  </table>

</body>
</html>

Now I'll try to do better formatting on html page. I want to have the data in colums down and right but look like:

name
edate - etime
address
city, state

I wonder if I can also have the user choose a different XML page to load by button?

Happy coding!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top