Newby - XML data doesn't display in html page.
Newby - XML data doesn't display in html page.
(OP)
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:
Here is a sample of the XML page meetingsbycity.xml
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'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>
<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>
<?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!
RE: Newby - XML data doesn't display in html page.
CODE
<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!