Newbie: Best layout for XML file?
- From: HerHusband <unknown@xxxxxxxxxxx>
- Date: Thu, 21 Jul 2005 15:58:00 -0500
I have a database that I would like to add XML exporting to, and then be
able to display that information "EASILY" on a web page.
The data consists of three simple text fields "title", "supplies", and
"notes". The supplies and notes fields may have any number of text lines,
including blank lines. For example, a sample record may look like this:
Title: Doghouse
Supplies: 1 *** of plywood
4 2x4x8's
1 bundle roofing shingles
Notes: Go to store, and buy supplies.
Store them in a dry place.
Cut, nail, insert dog.
My first attempt at XML was something like this:
<?xml version="1.0" ?>
<project>
<title>Doghouse</title>
<supplies>
1 *** of plywood
4 2x4x8's
1 bundle roofing shingles
</supplies>
<notes>
Go to store, and buy supplies.
Store them in a dry place.
Cut, nail, insert dog.
</notes>
</project>
This seems to work OK, and I can show it on a web page as easily as this:
<html>
<body>
<xml src="test.xml" id="project" async="false"></xml>
Title: <span datasrc="#project" datafld="title"></span><br>
Supplies: <span datasrc="#project" datafld="supplies"></span><br>
Notes: <span datasrc="#project" datafld="notes"></span><br>
</body>
</html>
However, I understand "data islands" like this are an IE specific way of
displaying XML data. I'm also concerned that the carriage returns in each
field may get lost or displayed incorrectly on some systems.
One way around that "might" be to switch to something like this:
<?xml version="1.0" ?>
<project>
<title>Doghouse</title>
<supplies>1 *** of plywood</supplies>
<supplies>4 2x4x8's</supplies>
<supplies>1 bundle roofing shingles</supplies>
<notes>Go to store, and buy supplies.</notes>
<notes></notes>
<notes>Store them in a dry place.</notes>
<notes>Cut, nail, insert dog.</notes>
</notes>
</project>
However, when I change the XML file like this, the HTML web page above
fails to show the supplies and notes fields. So, I'm not quite sure how
best to handle this.
Can anyone tell me which would be the preferred layout, and the easiest way
to display it on an HTML web page?
Thanks,
Anthony
.
- Follow-Ups:
- Re: Newbie: Best layout for XML file?
- From: Andy Dingley
- Re: Newbie: Best layout for XML file?
- Prev by Date: Registration opens for XML 2005; Respected XML Forum Delivers Practical Information That Attendees Can Put to Immediate Use within Their Organizations
- Next by Date: Re: Newbie: Best layout for XML file?
- Previous by thread: Registration opens for XML 2005; Respected XML Forum Delivers Practical Information That Attendees Can Put to Immediate Use within Their Organizations
- Next by thread: Re: Newbie: Best layout for XML file?
- Index(es):
Loading