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

Poor Mans Database ????? Ridiculously Desparate

Status
Not open for further replies.

rjonesX

Technical User
Jun 18, 2001
56
US
I have a basic XML file which stores data as such...
(I have repaced the normal brackets with parenthesis so they will not be hidden in this message)...

(state1)
(name)whatever(/name)
(address)whatever(/address)
(phone)whatever(/phone)
(/state1)
(state1)
(name)whatever example2(/name)
(address)whatever example2(/address)
(phone)whatever example2(/phone)
(/state1)

(state2)
(name)whatever example2(/name)
(address)whatever example2(/address)
(phone)whatever example2(/phone)
(/state2)

and so on, describing the various locations of a vendor across the country. I would like to be able to view this as like a poor mans database. I know the basic for-each idea in xsl - and it would be perfect if I could make that dynamic somehow. Maybe using javascript or something, so an individual could click on "alabama" on a link or drop down menu and the xsl document would pick up xsl:for-each select="alabama" - that way i could use the XML document as a poor mans database,

any ideas on how this could be done? Im rediculously desparate

thank you

russ jones
rjones@email.unc.edu
 
Hello,
Do you have a database (table) for which you made the xml file?
If you have such a database, you could try XMLSpy ability to Convert/Import a database (or text file, or Word file) to see what xml file you will get.

For example table:
id name address phone state
1 Aaa addr1 123 CA
2 Bbb addr2 345 TX
3 Ddd addr3 900 CA
will be represented in xml file like:

<table>
<row>
<id>1</id>
<name>Aaa</name>
<address>addr1</address>
<phone>123</phone>
<state>CA</state>
</row>
<row>
<id>2</id>
<name>Bbb</name>
<address>addr2</address>
<phone>345</phone>
<state>TX</state>
</row>
<row>
<id>3</id>
<name>Ddd</name>
<address>addr3</address>
<phone>900</phone>
<state>CA</state>
</row>
</table>

In this xml file would be much easier to do your task.

You could try the opposite XMLSpy function Convert/Export to Text File/Database file to see what the results will be.
You can find XML spy on

There is an article about migrating a database to XML, but they are going into too much details in DTDs. See the example to get the idea:

The next thing you are asking is for using some kind of server-side processing of xml files. This is possible fro example using ASP. MS have provided a huge resources for that:

If you are using other server-side processing like JSP, PHP you have to check the newest support for xml.

Hope this helps.
D.
 
You could also use the data binding properties in IE to simply generate the table in HTML and populate with elements directly from the XML file. Using a simple JavaScript string search you can search the XML document and display the results in your HTML table without ever having to parse the XML document. This is faster and a little easier to work w/ for a simple database than trying to step through the DOM. The catch is that it's only going to work in Internet Explorer. To the best of my knowledge, Netscape does not support Data Binding or Data Islands at all.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top