Results 1 to 5 of 5

Thread: Reading XML file with ASP

  1. #1
    Join Date
    Jan 2009
    Posts
    57

    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.

  2. #2
    Join Date
    Apr 2008
    Posts
    1,949

    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>

  3. #3
    Join Date
    Apr 2008
    Posts
    2,010

    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.

  4. #4
    Join Date
    May 2008
    Posts
    2,015

    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.

  5. #5
    Join Date
    Oct 2005
    Posts
    2,394

    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:
      Code:
      XMLDom obj;
    • 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.

Similar Threads

  1. Reading some file using C language
    By Vaikuntam in forum Software Development
    Replies: 9
    Last Post: 01-09-2012, 02:13 PM
  2. Pdf file reading in Micromax Q7
    By rashed823 in forum Portable Devices
    Replies: 4
    Last Post: 06-03-2011, 11:33 PM
  3. Need some help reading part of a log file...
    By agangsto in forum Operating Systems
    Replies: 2
    Last Post: 09-07-2010, 12:44 PM
  4. Reading a file in loop
    By Xmen in forum Software Development
    Replies: 5
    Last Post: 09-01-2010, 01:23 PM
  5. Reading file bit by bit
    By John Wilson in forum Software Development
    Replies: 4
    Last Post: 14-12-2009, 12:49 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •