[XML-DEV Mailing List Archive Home]
[By Thread]
[By Date]
[Recent Entries]
[Reply To This Message]
Displaying XML values with the help of DOM
- From: pranav <pranav@i...>
- To: xml-dev@l...
- Date: Wed, 16 May 2001 15:27:40 +0530
Hi all,
I
am trying to displaying XML values into HTML my the help of following code. This
code is working very fine with NS but not with IE.
Please help me to find out the reason and Solution
of this problem.
Here is my code.........
<script language="javascript"> var
xml; function init1() { var x =
xml.getElementsByTagName('rec'); var dis =
document.createElement('TABLE');
for
(i=0;i<x.length;i++) { var row =
document.createElement('TR'); for
(j=0;j<x[i].childNodes.length;j++) { if
(x[i].childNodes[j].nodeType != 1)
continue; alert(x[i].childNodes[j].firstChild.nodeValue); var
col = document.createElement('TD'); var coltext =
document.createTextNode(x[i].childNodes[j].firstChild.nodeValue); col.appendChild(coltext); row.appendChild(col); }
dis.appendChild(row); }
document.getElementById('test').appendChild(dis); } //alert("hohohohoho"); function
msXML() { xml.validateOnParse = false;
xml.resolveExternals = false; xml.onreadystatechange =
CheckState; function CheckState() {
if(xml.readyState == 4) { init1() }
} } function nsXML() { init1() } function
init() { if (document.implementation &&
document.implementation.createDocument) {
xml = document.implementation.createDocument("", "",
null); xml.addEventListener("load",nsXML,false); } else
if (document.documentElement &&
document.documentElement.applyElement) { xml = new
ActiveXObject("Microsoft.XMLDOM"); msXML(); } else { alert('Your
browser can\'t handle this script'); }
xml.load("x1.xml");
} </script> <html> <body
> <p> God </p> <P
ID="test"> </P> <p> great </p> </body> </html>
Regards,
Pranav Kumar Software Engineer Informica
India Pvt. Ltd. Noida, UP, India 91-118-4514702,3 http://www.informica.com
|
|
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format
RSS 2.0 |
|
Atom 0.3 |
|
|
Stylus Studio has published XML-DEV in RSS and ATOM formats,
enabling users to easily subcribe to the list from their preferred news reader application.
|
Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website.
they were not included by the author in the initial post. To view the content without the Sponsor Links please
click here.
|
|