ASP XMLDom Functions
I had the extreme privilege to work on a project recently which utilized ASP and the XMLDom object to transfer data from a remote location into a local database. Yes, I would rather use PHP for this type of thing, but I didn’t have much say in the matter.
Doing some research on the XMLDom for ASP, I found some good Web sites to use as reference when doing your own projects. However, I was hard pressed to find any well documented pre-built functions to use for my project, and so I thought I would offer my code to the public, in hopes that I can help out someone else facing a similar project.
Please realize, that while these functions are commented and have been used in a live project, they may not be the most-well-written functions you’ve ever seen. Several factors lead me to say this.
- I’m not the best ASP programmer on the planet.
- I was working with time constraints.
- They’re free, so shut it.
The Functions
I figured I would create a separate function for each type of activity typically used when working with XML. By no means are these functions the say-all or be-all for using ASP and XML, but these should get you started. The functions include:
- Requesting a remote XML doc (getXML)
- Saving XML file locally (saveXML)
- Opening / Parsing Local XML file (getXML/parseXML)
- Finding and Reporting errors in XML doc (getXMLError)
I have other functions, which allow for parsing an XML document and inserting each individual record into a database, but I don’t feel that the code I created for this is generic enough for someone to use. However, I plan on writing an entry in the near future explaining the best way, I’ve found, to do this properly using ASP.
I have included a few functions which are not documented, commented or even thoroughly tested. However, these functions are a good start on performing some relatively low-level XML tasks. There is also a sample XML file included, which you can use to play around with.
Download and use
If you are working on a project which utilizes the above technologies, then by all means use these files as a head start to getting your project done quickly. If you should make any significant changes to these functions, or know of a better way to handle these tasks, please comment on this entry with your findings.
Related sites
Recent features
Coheed and Cambria - The Velorium Camper II: Backend Of Forever
Leah Andreone - Break Your Fall
The Format - Give It Up
Song of the week
Sara Bareilles - Between the Lines
Sara Bareilles' "Between the Lines" is the Song of the Week for April 20 to 26.
