Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

parsing XML using ASP

Status
Not open for further replies.

cm80

Technical User
May 3, 2001
85
0
0
US

Hi,
I want to parse an XML file using ASP and I have no idea where to start.
Does anyone have any pointers or know of any tutorials that would get me started,

thanks, any help would be appreciated,
 
The following should load the XML file and allow you to start manipulating it:

======================================================



Dim oDocument
Dim sXMLFile
Dim bLoaded

sXMLFile = "Whatever.xml"

'Create instance of XML document object
Set oDocument = Server.CreateObject("MSXML2.FreeThreadedDOMDocument.3.0")
If oDocument is Nothing Then
Response.Write &quot;oDocument object not created<br>&quot;
Else
If Err Then
Response.Write &quot;XML DomDocument Object Creation Error - <BR>&quot;
Response.write Err.Description
Else
'Load up the XML document into the XML object
oDocument.async = False
bLoaded = oDocument.load(Server.MapPath(sXMLFile))

If (bLoaded = False) Then
'Failed to parse so write out an error
Else
'Everything worked, do what you want with it
End If
End If
End If
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top