Ryan's District
August 29, 2008, 08:38:24 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length

There are currently users in chat
News: Ryan's District Lottery: Claim your ticket or check
Jackpot details  
 
   Home   Help Search Chat Calendar Chess Shop Login Register  
Digg This!
Pages: [1]   Go Down
  Send this topic  |  Print  
Author Topic: Save Data to an XML File  (Read 1912 times)
0 Members and 1 Guest are viewing this topic.
ben2ong2
Quality Poster
Paid
Hero Member
*****

Reputation: 17
Offline Offline

Gender: Male
Posts: 2374
9976.80 RD$

View Inventory
Send Money to ben2ong2

View Profile Awards
« on: October 06, 2006, 03:39:41 PM »

Usually, we save data in databases. However, if we want to make the data more portable, we can store the data in an XML file.
 
Create and Save an XML File
Storing data in XML files is useful if the data is to be sent to applications on non-Windows platforms. Remember that XML is portable across all platforms and the data will not need to be converted!
First we will learn how to create and save an XML file. The XML file below will be named "test.xml" and will be stored in the c directory on the server. We will use ASP and Microsoft's XMLDOM object to create and save the XML file:
<%Dim xmlDoc, rootEl, child1, child2, p'Create an XML documentSet xmlDoc = Server.CreateObject("Microsoft.XMLDOM")'Create a root element and append it to the documentSet rootEl = xmlDoc.createElement("root")xmlDoc.appendChild rootEl'Create and append child elementsSet child1 = xmlDoc.createElement("child1")Set child2 = xmlDoc.createElement("child2")rootEl.appendChild child1rootEl.appendChild child2'Add an XML processing instruction'and insert it before the root elementSet p=xmlDoc.createProcessingInstruction("xml","version='1.0'")xmlDoc.insertBefore p,xmlDoc.childNodes(0)'Save the XML file to the c directoryxmlDoc.Save "c:\test.xml"%>
If you open the saved XML file it will look something like this ("test.xml"):
<?xml version="1.0"?><root>  <child1 />  <child2 /></root>
Logged

You are not allowed to view links.
Register or Login
Free Paid Survey & Home Business Resources.

You are not allowed to view links.
Register or Login
Free Article Directory | Quality Content
Ryan's District
   

 Logged
Pages: [1]   Go Up
  Send this topic  |  Print  
 
Jump to:  

Archive - WAP2 - WAP - imode
Sponsors: TOP SEO Directory - Online Job Maker - List of Advertisers - BIG VENUE

Powered by MySQL Powered by PHP Powered by SMF 1.1.5 | SMF © 2006-2008, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 0.166 seconds with 28 queries.

Google visited last this page August 24, 2008, 12:55:09 AM