Reading XML file with ASP
Hello, I am working on the Asp.net. And now I want to know the details from which I will able to get to know program for Reading XML file with ASP. If you are having any kind of information from which I can able to get the solution then please provide that to me. I will be thankful to you.
Re: Reading XML file with ASP
Hello, I have the code below which will be helpful to you for getting the details about the reading xml file with asp:
Code:
<%
Option Explicit
Response.Buffer = True
Dim xml
Set xml = Server.CreateObject("Microsoft.XMLDOM")
xml.async = False
xml.load (Server.MapPath("page.xml"))
Dim name, subname, data, check
name = xml.documentElement.childNodes(0).text
subname = xml.documentElement.childNodes(1).text
data = xml.documentElement.childNodes(2).text
check = xml.documentElement.childNodes(3).text
Set xml = Nothing
%>
<html>
<head>
<name><%= name %></name>
</head>
<body>
<h3 align="center"><%= subname %></h3>
<p align="center"><% = data %></p>
<div align="center"><%= check %></div>
</body>
</html>
Re: Reading XML file with ASP
Hello, you want solution for the reading xml file with the help of the asp then it is quiet simple thing. You just need to make use of the Reading an XML file in ASP is very simple if you are using the xmldom object. For that you just need to create an xmldom object and that object need to be load the xml file that you want to read. And if you wan to load the xml file then it is necessary to to make use of the Load method which is present into the xmldoc object.
Re: Reading XML file with ASP
Reading the Contents of XML File using XmlDocument class from the code below:
Code:
XmlDocument xmldoc = new XmlDocument();
xmldoc.Load(Server.MapPath("test.xml"));
System.Xml namespace is having the class which is having name as XmlDocument. You can simply use this class for getting the read functionality for the xml files content. So, just make use of the code below and get your problem solved.
Re: Reading XML file with ASP
For reading the xml file from the asp you must need to use the following steps:
- First of all you need to create a class of the XMLDOM object with the help of ASP file to load the XML data. For that you can simply make use of the code below:
- Now you need to load that xml file into the DOM object with the help of the readXML method. For that you just need to use the code below:
Code:
obj.readXML("xmltest.xml");
- Now you need to use the documentElement.childNodes(n) for getting the value of the xml file elements.
- Display or manipulate the XML data for that by using the file from the class parameter in the asp page. In this the xml file value can be directly assigned to the field value of the same type.