Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XML
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
XML General XML discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XML section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 28th, 2003, 06:29 PM
Registered User
 
Join Date: Oct 2003
Location: , , .
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to calculate the number of XML data sets?

Hi,

Sorry I am not so familiar with XML. Could somebody help me figure out my problem? Thanks in advance.

I am modifying some asp files running xml objects written by our consultants.

ASP file creates xml object by following code where strURL is search criteria variable:

set xmlhttp = server.CreateObject("Msxml2.XMLHTTP")
xmlhttp.open "GET", strURL, False
xmlhttp.send

GenerateListing = xmlhttp.responseText

My question is that GenerateListing is one variable containing XML data. How do I calculate how many data set (kind of data record in SQL database) in GenerateListing?

Reply With Quote
  #2 (permalink)  
Old October 29th, 2003, 05:20 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Not sure what your xml looks like, can you show the structure and define what the datasets are?
You should try to use the prog id "Msxml2.XMLHTTP.4.0" if you can, if version four is not on the machine try version three, "Msxml2.XMLHTTP.3.0".

If the call to send succeeds then your response will be xml so use the xml dom:
Code:
set xmlhttp = server.CreateObject("Msxml2.XMLHTTP.4.0") 'see above
xmlhttp.open "GET", strURL, False
xmlhttp.send
If xmlhttp.status = 200 Then
  Response.contentType = "text/xml"
  xmlhttp.responseXML.save Response
Else
  Response.write "Error: " + xmlhttp.statusText
End If
Response.end
Joe (MVP - xml)
Reply With Quote
  #3 (permalink)  
Old October 29th, 2003, 10:44 AM
Registered User
 
Join Date: Oct 2003
Location: , , .
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Joe:

Thank you for your response. I copied some block of code written by our consultants last July that doesn't show version number of XML. The code mainly search our service company within 1-999 miles for specified location such one zip code or detailed address throught MapQuest search engine which returns xml format data if given zip code or address from a user. The returned xml data contains variable datasets. What I want to do is how to get the number of datasets?



private sub caller()
dim strServiceURL, strReturnURL

strServiceURL = p_ASPURLLib.GenerateURL("scripts/mqinterconnect.exe?link=CMSmap&closestn=10&closest prox=1&miles=999&streetaddress=" & server.URLEncode(Request.Form("Street Address")) & Server.URLEncode(Request.QueryString("StreetAddres s")) & "&city=" & Request.Form("City") & Request.QueryString("City") & "&state=" & sState & Request.QueryString("State") & "&zip=" & Request.Form("Postal Code") & Request.QueryString("Postal Code") & "&iconid=32",Array(),Array())

Call GenerateListing(strServiceURL)
end Sub

Public Sub GenerateListing(strURL)

Dim xmlhttp, objDocXML, strThisURL, strReplace, selNodes, item, GenerateListing

set xmlhttp = server.CreateObject("Msxml2.XMLHTTP")

If Request.QueryString("level") <> "" then
   strURL = strURL & "&level=" & Request.QueryString("level")
Else
   strURL = strURL & "&level=9"
End If

If Request.QueryString("lat") <> "" then
   strURL = strURL & "&lat=" & Request.QueryString("lat")
End If

If Request.QueryString("lng") <> "" then
   strURL = strURL & "&lng=" & Request.QueryString("lng")
End If

If Request.QueryString("event") <> "" then
   strURL = strURL & "&event=" & Request.QueryString("event")
End If

If Request.QueryString("ml") <> "" then
   strURL = strURL & "&ml=" & Request.QueryString("ml")
End If

If Request.QueryString("orig_lat") <> "" then
   strURL = strURL & "&orig_lat=" & Request.QueryString("orig_lat")
End If

If Request.QueryString("orig_lng") <> "" then
   strURL = strURL & "&orig_lng=" & Request.QueryString("orig_lng")
End If

If Request.QueryString("orig_name") <> "" then
   strURL = strURL & "&orig_name=" & Request.QueryString("orig_name")
End If

If Request.QueryString("so") <> "" then
   strURL = strURL & "&so=" & Request.QueryString("so")
End If

If Request.QueryString("ss") <> "" then
   strURL = strURL & "&ss=" & Request.QueryString("ss")
End If

If Request.QueryString("si") <> "" then
   strURL = strURL & "&si=" & Request.QueryString("si")
End If

xmlhttp.open "GET", strURL, False
xmlhttp.send

GenerateListing = xmlhttp.responseText

'-- Clean up the xml returned from Mapquest so the load won't fail.
GenerateListing = replace(GenerateListing,"&","&amp;")
GenerateListing = replace(GenerateListing,"""","&quot;")
GenerateListing = replace(GenerateListing,"'","&apos;")

set xmlHTTP = nothing

GenerateListing = "<MAPQUEST><GARBAGE><![CDATA[" & GenerateListing
GenerateListing = replace(GenerateListing,chr(10) & chr(10),"")
GenerateListing = replace(GenerateListing,"<! $GEO_LOOP END closest_pois>","")

GenerateListing = ChangeGenerateListing(GenerateListing)

Reply With Quote
  #4 (permalink)  
Old October 29th, 2003, 11:45 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

But can you show an example of the returned xml, preferably one that has at least two datasets and with any irrelevant stuff removed?

Joe (MVP - xml)
Reply With Quote
  #5 (permalink)  
Old October 29th, 2003, 12:10 PM
Registered User
 
Join Date: Oct 2003
Location: , , .
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

By now our ftp engine is blocked by new firewall. Once it sets up, I will show the returned result. Thanks!

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Union of Two data Sets tusharnarayan SQL Language 7 November 4th, 2008 05:23 PM
calculate a number between two dates in time t400 SQL Server 2000 8 September 5th, 2006 01:14 PM
How to calculate a number of days between 2 date windy417 Pro JSP 1 July 20th, 2006 07:09 PM
using 2 sets of xml data from 1 xslt davepass XSLT 2 April 1st, 2005 06:31 PM



All times are GMT -4. The time now is 02:27 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.