Quantcast

Storage and Manipulation of XML files on the Server

Since XML was designed to transport and store data, it is crucial that XML be easily stored and generated by a standard web server. Actually that is what the case in fact is. XML can easily be stored and generated by a standard web server. However, to go through this short article, you need to have knowledge of ASP and PHP. Additionally, XML can be generated on a server without any installed XML software. To generate an XML response from the server – simply write the following code and save it as an ASP file on the web server:

Note that the content type of the response must be set to “text/xml”.  Further, to generate an XML response from the server using PHP, use following code:

Once again, the content type of the response header must be set to “text/xml”. Other than being stored and manipulated on the server side, XML can also be transformed into XHTML file on the server side. Following ASP code can be sued to server this purpose:

In the above example:

  • The first block of code creates an instance of the Microsoft XML parser (XMLDOM), and loads the XML file into memory.
  • The second block of code creates another instance of the parser and loads the XSL file into memory.
  • The last line of code transforms the XML document using the XSL document, and sends the result as XHTML to your browser

XML is a bit advanced compared to HTML but it certainly contains a lot more advantages when it comes to web programming.

Looking for a quality hosting service? here are a few I suggest.
BlueHost | HostGator | Media Temple
Admin
Admin
Ali has been an entrepreneur in web, video and related technologies. Having worked with many business across the globe, Ali stands truly a great pillar in the business working with him.