iTech College - Internet Technology, Online Education, E-Learning, Technician Training, Tech Tutorials, Distance Education, Virtual Learning XML Course: Save XML File on Server - www.itechcollege.com XML Course: Save XML File on Server - www.itechcollege.com
Free Courses
HTML
JavaScript
CSS
ASP
PHP
JSP
C++
ASP.NET
SQL
AJAX
FTP
XML

courses > XML > Save XML File on Server

Save XML File on Server

When you create an XML file and display it on your browser, you may want ot save it on your server. There is a simple way to save your XML file. If you created an XML file and displayed on your brower, you may directly go to "View" > "Source", and then save the source code of the XML file to your local computer.

Or you can use XML DOM to save it on your server. The following example shows how to use ASP to save an XML file on the server:

<%
text="<email>"
text=text & "<to>John</to>"
text=text & "<from>Michael</from>"
text=text & "<subject>Hi</subject>"
text=text & "<body>Hello my friend!</body>"
text=text & "</email>"

set xmlDoc=Server.CreateObject("Microsoft.XMLDOM")
xmlDoc.async="false"
xmlDoc.loadXML(text)

xmlDoc.Save("email.xml")
%>

The third method to save an XML file is using Filesystem Functions to write and save an XML file. The following is an example using PHP:

<?php
$text ='<?xml version="1.0" encoding="UTF-8"?>';
$text .='<GPS>';
$text .='<Item>';
$text .='<name>TomTom XL 330S 4.3-Inch Touchscreen Traffic-Ready Portable GPS Navigator</name>';
$text .='<price>$299.95</price>';
$text .='<link>http://www.selectagps.com/TomTom-XL-330S-4-3-Inch-Touchscreen-Traffic-Ready-Portable-GPS-Navigator-Electronics--d_B0016ORQDI.html</link>';
$text .='</Item>';
$text .='</GPS>';
$file = fopen('gps.xml', 'w');
fwrite($file, $text);
fclose($file);
?>

As you can see, we don't have to use DOM and XSLT to create an XML file and save it on the server.



  Back to Index Page
 Next Page:  

XML Introduction
XML Format and Structure
XML Elements
XML Attributes
XML Syntax 1
XML Syntax 2
XML Naming Rules and Practices
XML Using CDATA for Dealing with HTML Tags
Displaying XML into HTML
XML Parser
XML DOM
XMLHttpRequest Object 1
XMLHttpRequest Object 2
XMLHttpRequest Object 3
Create an XML File From a Database 1
Create an XML File From a Database 2
Save XML File on Server


Online Education, Online Training for Your Job, Distance Education, E-learning Programs for Your Career!Online Colleges, Online Universities, E-learning & Distance Education for Your Career! Easy Job Training & Online Courses.


   Email A Friend  
 
Earn Online Degree
for Your Job
I found a job after I earned an online degree!
Online classes for finding a Job. Online College, Online University, Degrees, E-learning school, online certificate Earn your
online degree now!
Online Training
for Good Job
Why I work so hard but earn so little? Why I cannot find a high paying job?
Online training for a Good Jobs. Online Degree, E-learning school, online certificate Go to
online school now!

Copyright ©2024, itechcollege.com. All rights reserved
iTechCollege | About iTech | Contact iTech