Solved

Create XML with some data dynamically and retrieve data from xml using ASP.

Posted on 2004-04-26
1
220 Views
Last Modified: 2012-06-27
I have 2 tasks to do using ASP.

1. To create XML dynamically with some data and store them in any specified directory in the web server.
2. To retrieve data from any specified xml and display them using HTML elements for better GUI.  

Please answer them with sample code asap. Thanks.


0
Comment
Question by:Justlogin
1 Comment
 
LVL 26

Accepted Solution

by:
rdcpro earned 250 total points
ID: 10923181
Pretty vague requirements, but this:

<%@language=VBScript%>
<%
Set xmlDoc = Server.CreateObject("Msxml2.DomDocument")
Set oNode = xmlDoc.createElement("myTime")
oNode.text = CStr(Now)
xmlDoc.appendChild oNode
xmlDoc.save Server.MapPath("currentTime.xml")

Set xmlSource = Server.CreateObject("Msxml2.DomDocument")
xmlSource.async = true
xmlSource.load Server.MapPath("currentTime.xml")

Set xslDoc = Server.CreateObject("Msxml2.DomDocument")
xslDoc.async = true
xslDoc.load Server.MapPath("TimeTest.xslt")
xmlDoc.transformNodeToObject xslDoc, Response
%>

along with this XSLT:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
      <xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
      <xsl:template match="/">
            <h1><xsl:value-of select="myTime"/></h1>
      </xsl:template>
</xsl:stylesheet>

does what you ask, producing this output:

<h1>4/26/2004 3:30:46 PM</h1>


Regards,
Mike Sharp
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

The Client Need Led Us to RSS I recently had an investment company ask me how they might notify their constituents about their newsworthy publications.  Probably you would think "Facebook" or "Twitter" but this is an interesting client.  Their cons…
Many times as a report developer I've been asked to display normalized data such as three rows with values Jack, Joe, and Bob as a single comma-separated string such as 'Jack, Joe, Bob', and vice versa.  Here's how to do it. 
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question