How to generate XML data documents with ASP

Source: Internet
Author: User
Tags end reference version

One must find out what is needed in the end

Through ASP or other dynamic programming languages, we ultimately need XML-formatted data, which has nothing to do with the file carrier of the XML data, it can be a real XML file, such as: Http://www.dw8.cn/common/dw8.xml. It can also be an ASP document, such as: http://www.cnbruce.com/blog/rss2.asp

They are the embodiment of XML data, in order to realize the dynamic of XML data, so need to use a dynamic programming language, such as ASP to implement it.

Ii. How to generate a dynamic XML document

If the XML file is generated, the dynamic document is in ASP format, so you must use the FSO for the generation of XML files, such as:

The following is a reference fragment:
<%
Xmlfile=server.mappath ("Test1.xml")
Set fso = CreateObject ("Scripting.FileSystemObject")
Set MyFile = fso. CreateTextFile (Xmlfile,true)
MyFile.WriteLine ("")
MyFile.WriteLine ("< World >")
MyFile.WriteLine ("< hello >hello,world")
MyFile.WriteLine ("")
Myfile.close
%>

View XML File Contents

For an operation on the FSO see
http://www.cnbruce.com/blog/showlog.aspcat_id=26&log_id=440

In the case of generating dynamic XML data files, it is possible to control the name and value of the XML node by means of the program in the dynamic document by the MyFile.WriteLine related content.

Iii. how to generate XML data using dynamic documents

So if you're not generating an XML file and you're outputting XML data directly on a dynamic document, you need to declare the type of file (i.e. Response.ContentType)

<%response.contenttype = "Text/xml"%>

For example, directly browse the following dynamic ASP document, in the browser next to display as XML data tree

The following is a reference fragment:
<%
With Response
. ContentType = "Text/xml"
. Write ("")
. Write ("< World >")
. Write ("< hello >hello,world")
. Write ("")
End With
%>

The advantage of the generated XML file is that documents that process the XML data can be static documents, such as HTML files that parse XML through JavaScript, XMLDOM, and also ease data retention, while dynamic XML data on dynamic documents is not. However, in today's dynamic documents everywhere in the era, it seems that this advantage for some applications is not very influential, even, dynamic document XML data flow instead more advantages: more timely, more dynamic.



Related Article

Alibaba Cloud 10 Year Anniversary

With You, We are Shaping a Digital World, 2009-2019

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.