Generating XML file using PHP and ASP

XML files, as we know by now, are plain text files just like the HTML files. Hence, just like HTML, XML can also be easily stored and generated by a standard web server. For example, consider the following piece of code:

The above code would save the file on your web server with a proper name like “note.xml”.

As an alternative method, XML can be generated on a server without any installed XML software. To undertake this task, you need to take help from ASP. To generate an XML response from the server – simply write the following code and save it as an ASP file on the web server:

The content type of the response must be set to “text/xml”. Finally, one can also generate an XML response file from the server using PHP. Utilization of PHP is perhaps the simpler way, considering the easy syntax of PHP and ease and simplicity of the language.  The following piece of code would generate an XML response from the server using PHP:

Once again, the content type of the response header must be set to “text/xml”. Finally, we can also use ASP to save XML files on the server. For example, the following piece of ASP code creates a simple XML document and saves it on the server:

So basically, what we see is that it is easier to save XML files on the server utilizing ASP and PHP, particularly PHP. This shows the power of these web programming languages.

Looking for a quality hosting service? here are a few I suggest.
BlueHost | HostGator | Media Temple
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.