Solved

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

Posted on 2004-04-26
1
217 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
Comment Utility
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
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.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now