Reading XML file with ASP
Write a Review
Add to My Favorite
Refer it to Friend
Report Broken Link
Other links at ASP > Tips and Tutorials > XML and ASP
By now, most of our readers are familiar, at least in principle, with XML - the w3c's platform neutral data markup language. However not everyone knows how to use XML with ASP. In this article, I'll run you through using ASP and JScript to open and read XML files. in the next article, I'll show you how to create and modify XML with ASP.
The example I'm going to show you is in use on my office intranet, for the purposes of identifying who is logged in. since all the machines in the office have a static, unique IP, I've used Request.ServerVariables("remote_host") to identify the machine, and XML to map machine to user. It's a little courtesy app, and also allows me to restrict administrative functions to only five machines in the entire office.
Category:
RSS files can be generated using Active Server Pages (ASP). It is OK for an RSS file to have a .asp suffix. In this example an RSS 0.91 file is generated, but it could easily be applied to other RSS versions. Similarly in this case the site stores its articles in a Microsoft Access database, but the database connection could be changed to reflect a Microsoft SQL Server database.
You can follow the example below or if you prefer you can download it in a text file here. You may get an XML error when you try and open the text file, just view source to get the code
Category:
A brief introduction to working with the XMLDom in ASP and XPath. Complete with examples and desriptions of everything. First part of several upcoming articles.
Category:
Dim BlnLinkBack, sReciprocalURL, sReciprocalLinkURLText
BlnLinkBack=False
sLinkBackURL="www.codefixer.com" 'this is the URL we wish to check for
sReciprocalURL= "www.codefixer.com/tutorials/index.asp" 'This is the URL
'we are going to check against
Category:
This solution presents several limitations both on the client and server side. We must use the POST method (because the GET can't manage this type of data), and we have no solutions to trigger a POST processing without using an HTML form. When we send data to the TargetURL, the browser loads this page as the new current page and we have an undesirable "context switch."
The ENCTYPE property defines the Multipurpose Internet Mail Extensions (MIME) encoding for the form and must be set to "multipart/form-data" for file upload forms. When we set this property to "multipart/form-data" we obtain a different structure of the POST buffer (which is also more complex) and the Request ASP object can't access the form contents. Therefore, we can read the POST buffer using the Request.binaryRead method, but we can't use scripting languages to do this. The Request.binaryRead method returns a VTarray (which is a variant array of unsigned one byte characters) while scripting languages can manage only variant variables. We can resolve this problem only by using a specific, custom ASP component or ISAPI extension, such as CPSHOST.DLL. This behavior is by design.
Category: