Results 1 to 3 of 3

Thread: How to retrieve XML data & display on the page in the table?

  1. #1
    Join Date
    Feb 2009
    Posts
    12

    How to retrieve XML data & display on the page in the table?

    Hello!

    How to retrieve XML data & display on the page in the table?
    Yes, I will be using asp to retrieve the data from the DB.

    Regards,

  2. #2
    Join Date
    Apr 2008
    Posts
    2,005

    Re: How to retrieve XML data & display on the page in the table?

    Hey I have this example for you!

    Code:
    <table border="1">
    	<tr>
    		<td><b>Title</b></td>
    		<td><b>Grade</b></td>
    	</tr>
    <%
    	xmlStr = "<QoE>" & _
    	"<Qual><Title>BTEC%20first%20diploma/GNVQ%20Inter%20ICT</Title><Grade>Pass</Grade> </Qual>" & _
    	"<Qual><Title>Communication%20(KS)</Title><Grade>L2</Grade></Qual>" & _
    	"<Qual><Title>AoN</Title><Grade>L1</Grade></Qual>" & _
    	"</QoE>"
     
    	Set objXML = Server.CreateObject("Microsoft.XMLDOM")
    	
    	objXML.loadXML(xmlStr)
    	Set oNodes = objXML.selectNodes("//QoE/*")
    	For Each oChild In oNodes
    		Response.Write "<tr><td>" & oChild.childNodes(0).text & "</td><td>" & oChild.childNodes(1).text & "</td></tr>"
    	Next
    %>
    </table>
    I hope this helps you!

  3. #3
    Join Date
    May 2008
    Posts
    2,297

    Re: How to retrieve XML data & display on the page in the table?

    A simple example of using the managed classes for getting XML output from the SQL Server database is given below. This code uses the XML AUTO mode for generating the XML data.

    static string xmlstr = "Provider=SQLOLEDB;Server=(local);database=Orders;";
    public static void SampleSqlXml ()
    {
    Stream objStr = Console.OpenStandardOutput();
    SqlXmlCommand sqlcmd = new SqlXmlCommand(xmlstr);
    sqlcmd.Root = "Orders";
    sqlcmd.CommandType = SqlXmlCommandType.Sql;
    sqlcmd.CommandText = "SELECT OrderNo, OrderValue FROM Orders FOR XML AUTO";
    strm = sqlcmd.ExecuteToStream(objStr);
    objStr.Close();
    }

    For more information and samples on the managed classes that are used for retrieving data in XML format from SQL Server you can refer to the MSDN documentation.

Similar Threads

  1. Unable to retrieve page in kindle based on page numbers
    By rUChIRr in forum Portable Devices
    Replies: 6
    Last Post: 08-07-2011, 10:02 PM
  2. Replies: 3
    Last Post: 19-07-2010, 04:23 PM
  3. Retrieve selected Data From a Table
    By samualres in forum Software Development
    Replies: 5
    Last Post: 30-01-2010, 10:04 AM
  4. Display dynamic data in a table using Ajax
    By Hamlet in forum Software Development
    Replies: 4
    Last Post: 05-12-2009, 08:57 PM
  5. How to copy one table data into another table directly?
    By ComPaCt in forum Software Development
    Replies: 3
    Last Post: 22-09-2009, 03:54 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,710,825,850.75339 seconds with 17 queries