View Full Version : XML ? Huh? help please....
lady_weaver
09-25-2005, 05:27 PM
Ok. Is there someone out there that can tell me what I am suppose to do here. I have been asked to add something to a webpage I am to hand in. this............Create an additional page using XML to display all of the produce offered...........How do I do this. I have been getting help woth various websitees to look at but it hasn't clicked with me. CAn somebody please help. Pleeeeeeeaaaaaasssssseeeeee. I have been working at this for hours and not getting anywhere. My email address is lady_weaver01@yahoo.com
anyone????????????
mark87
09-25-2005, 07:42 PM
Basically you'd build an XML file like so -
<?xml version="1.0" encoding="ISO-8859-1" ?>
<products>
<product>
<name>Item One</name>
<desc>A Widget</desc>
<price>£10.00</price>
</product>
<product>
<name>Item Two</name>
<desc>A Larger Widget</desc>
<price>£20.00</price>
</product>
</products>
It doesn't matter what tags you use, but that should give you an idea on how to build an XML file.
Then you need to get a way of transfering the XML to the (X)HTML document.
You could use an XML parser, or something called XSL (http://www.w3schools.com/xsl/xsl_languages.asp) which is a method of styling XML to look like a HTML webpage. Sure there are more options but I've only just started with XML myself.
sangren
10-03-2005, 04:58 PM
I am experiencing a similar problem. The concept of XML is relatively new to me and I was attempting to determing how it could be used to transfer data from an iSeries to a DMV web server. I also noted the Apache Forrest tool is an option, but I was unable to determine whether or not that converts the data to XML or I have to create the XML first... Confused
darkmage784
10-03-2005, 08:49 PM
XML is like HTML, except you invent your own tags. XSL is a combination of XSLT, XPath and XSL-FO, XML-based languages that you use to transform XML into XHTML. W3Schools (http://www.w3schools.com/) has a lot of helpful tutorials on this.
PowerDrift
10-04-2005, 07:30 AM
Well, once you get your XML file done (which as you have seen in the above post that it is not that hard), your choices are XSL and CSS to display your XML file. I prefer CSS because XSL basically inserts your XML data like PHP does with variables. CSS on the other hand takes the raw XML file and adds style to it without having to interface with another file, unless you make the CSS file external (highly recommended for organizational purposes).
sangren
10-04-2005, 10:07 PM
I have created an XML file and an html file to view it, but when I attempt to view it using my html file with Javascript, it just returns formatting. Here is my code for the xml file:
<?xml version="1.0" encoding="ISO-8859-1" ?>
- <!-- Edited with XML Spy v4.2
-->
- <note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
the html file:
<html>
<head>
<script language="JavaScript"
for="window" event="onload">
var xmlDoc = new ActiveXObject("Microsoft.XMLDOM")
xmlDoc.async="false"
xmlDoc.load("note.xml")
nodes = xmlDoc.documentElement.childNodes
to.innerText = nodes.item(0).text
from.innerText = nodes.item(1).text
header.innerText = nodes.item(2).text
body.innerText = nodes.item(3).text
</script>
<title>HTML using XML data</title>
</head>
<body bgcolor="yellow">
<h1>Refsnes Data Internal Note</h1>
<b>To: </b><span id="to"></span>
<br>
<b>From: </b><span id="from"></span>
<hr>
<b><span id="header"></span></b>
<hr>
<span id="body"></span>
</body>
</html>
Help.. please
mrruben5
10-04-2005, 10:26 PM
http://www.dynamicdrive.com/dynamicindex11/ajax.htm
sangren
10-05-2005, 02:54 PM
Still searching for assistance. I tired using the dhtml code and ended up with a blank page.
mrruben5
10-07-2005, 09:01 PM
Can you post the code?
sangren
10-07-2005, 09:53 PM
My html code is posted above. Not sure if I still have the other code or not. If that is what you are looking for, I will see if I can find it.
mrruben5
10-08-2005, 01:38 PM
You are referring to an object by name, while you have id's in the html. Try it with getelementbyid or change the id's to the name attribute
sangren
10-10-2005, 08:31 PM
Can you clarify what you mean within my code? I think I follow what you're saying, but I am not sure. Thanks!
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.