[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

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

Posted on 2004-04-26
1
Medium Priority
?
224 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 1000 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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. 
Integration Management Part 2
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses
Course of the Month18 days, left to enroll

830 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