eksob
09-11-2008, 07:04 PM
I want to retreive data from an XML file using asp, here is my XML file:
<?xml version='1.0' encoding='UTF-8' ?>
<F>
<P1>
<business>My Company</business>
<name>Jack</name>
<address>123 street</address>
</P1>
</F>
This is the ASP code I am using that doesn't work:
<%
Option Explicit
Response.Buffer = True
Dim xml
Set xml = Server.CreateObject("Microsoft.XMLDOM")
xml.async = False
xml.load (Server.MapPath("test.xml"))
Dim business, name, address
business = xml.documentElement.childNodes(0).text
name = xml.documentElement.childNodes(1).text
address = xml.documentElement.childNodes(2).text
Set xml = Nothing
%>
<html>
<body>
<h3 align="center"><%= business %></h3>
<p align="center"><% = name %></p>
<div align="center"><%= address %></div>
</body>
</html>
If I remove the <F> tags from the XML file than it works fine. But I need the <F> tags to be there because this XML file is read by several programs.
Thanks in advance for your help
<?xml version='1.0' encoding='UTF-8' ?>
<F>
<P1>
<business>My Company</business>
<name>Jack</name>
<address>123 street</address>
</P1>
</F>
This is the ASP code I am using that doesn't work:
<%
Option Explicit
Response.Buffer = True
Dim xml
Set xml = Server.CreateObject("Microsoft.XMLDOM")
xml.async = False
xml.load (Server.MapPath("test.xml"))
Dim business, name, address
business = xml.documentElement.childNodes(0).text
name = xml.documentElement.childNodes(1).text
address = xml.documentElement.childNodes(2).text
Set xml = Nothing
%>
<html>
<body>
<h3 align="center"><%= business %></h3>
<p align="center"><% = name %></p>
<div align="center"><%= address %></div>
</body>
</html>
If I remove the <F> tags from the XML file than it works fine. But I need the <F> tags to be there because this XML file is read by several programs.
Thanks in advance for your help