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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

new to XML

Status
Not open for further replies.

vlitim

Programmer
Sep 2, 2000
393
GB
I am working on a project where by I am getting an xml feed from a site using the below code:

Code:
Dim objXMLHTTP, xml, toSend
	Set xml = Server.CreateObject("Microsoft.XMLHTTP")
	
	toSend = "<?xml version=""1.0"" ?>"&VbCrLf
	toSend = toSend&"<!DOCTYPE web-app PUBLIC ""-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"" ""[URL unfurl="true"]http://java.sun.com/j2ee/dtds/web-app_2_2.dtd"">"&VbCrLf[/URL]
	toSend = toSend&"<document>"&VbCrLf
	toSend = toSend&"<title>"&name&"</title>"&VbCrLf
	toSend = toSend&"<body>"&VbCrLf
	toSend = toSend&""&description&""&VbCrLf
	toSend = toSend&"</body>"&VbCrLf
	toSend = toSend&"<partner>PARTNERNAME</partner>"&VbCrLf
	toSend = toSend&"</document>"

	xml.Open "POST", "[URL unfurl="true"]http://websitetogetinfo/categorise.pl",[/URL] False
	xml.Send "XML_INPUT="&toSend
	
	Response.Write "<textarea style=""width:480px; height:100px"">"&xml.responseText&"</textarea>"
	
	Set xml = Nothing

which is returning an xml document:


<?xml version="1.0" ?>
<results name="processdocument">
<METAS>
<META>
<ATTRIB NAME="CONTENT">Results1</ATTRIB>
<ATTRIB NAME="SCHEME">WEB</ATTRIB>
</META>
<META>
<ATTRIB NAME="CONTENT">Results2</ATTRIB>
<ATTRIB NAME="SCHEME">NEWS</ATTRIB>
</META>
</METAS>
</results>

now I need to get this information into something I can work with, ie lloking around the nodes checking what they are and assigning them to a variable, but I am completely confused about how to go about this,

please help

Cheers

tim
 
It sounds as if your loking for the XMLDOM. Basically you will want to instantiate a Microsoft.XMLDOM object, load in the ResponseText of your XMLHTTP object, then manipulate the nodes exactly as you mentioned. There is some info on this object in the tutorials and a huige amount of info on the net in general for this object. Probably more than I could easily convey in a single post :)

Another option, if you are only need to get the values and output them in some structured format, would be to use an XSL sheet to transform the XML into HTML output. This would still require using the XMLDOM object, but can be done in a few short lines of code without any direct node manipulation or searching.

-T

barcode_1.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top