We help IT Professionals succeed at work.
Get Started

ASP and Extracting XML

Overthere
Overthere asked
on
178 Views
Last Modified: 2017-04-01
I have a snippet of coding which worked fine in my test page. Extracted everything I asked for.
I inserted it into my program and it does not extract my data
All of my other routines work well.
I did not receive any script errors, nothing in debugger, nothing in IE developer tools. Did not even write out my response.write statement.
There is nothing that should have caused this since my test page loads the same xml file.
I realize that saying I took it from my test page and inserted it into my going-to-be-production is subject to well, comments that there must be something transpiring that is causing the problem. But there isn't.
I have posted my snippet of coding and an example of the xml I am extracting. The only thing I can think of is that there are two sections that have passengers - I will post what that looks. I thought maybe it was getting confused. But that could not be because if it was, then my test page would not have worked - they are both using the same xml file.
All I receive is the "Passengers Next" and it just skips right over it the extraction rtn and hits the response.end line.
Any help appreciated.
Below is the coding from my test page and it works just fine. I get the first and last name for each one.
'extract passengers only if BID=NEW
        if (Session("BID") = "NEW") and  (xdDoc.parseError = 0) then
	        Set colNodes = xdDoc.selectNodes("//PASSENGERLIST/PASSENGER") 
	 	    'if xdDoc.parseError = 0 then
	  	    'extract item info
			 for each objItem in colNodes
			    vlname = objItem.selectSingleNode("LASTNAME").text
			    vfname = objItem.selectSingleNode("FIRSTNAME").text
			    response.write "<BR>PASSENGER:" & vfname & " " & vlname
			 next	
			 set colNodes = nothing
	         'end if
		else
        ' display error message
        end if 	 

Open in new window

This is what I have in nearly-to-go-production page - you will notice I tried several definitions
 response.write "<BR>PASSENGERS NEXT"
 		if xdDoc.parseError = 0 then
            if (Session("BID") = "NEW") then
			    vcounter = 1
	                 ' Set colNodes = xdDoc.selectNodes("//PASSENGERLIST/PASSENGER") 
			  ' Set colChildNodes = xdDoc.selectNodes("SERVICECARD/SERVICE/PASSENGERLIST/PASSENGER")
			    Set colChildNodes = xdDoc.selectNodes("SERVICECARD/SERVICE/PASSENGERLIST")
	  	        'extract item info
			    for each objItem in colChildNodes
		           response.write "INSIDE PASSENGERS LOOP<BR>"
			       vlname = objItem.selectSingleNode("LASTNAME").text
			       vfname = objItem.selectSingleNode("FIRSTNAME").text
			       response.write "<BR>PASSENGER:" & vfname & " " & vlname
				  ' vpassid = MkPassengers(vcounter,vlname,vfname)
				   vcounter = (vcounter + 1)
			  next	
			 set colChildNodes = nothing
		    end if
        end if 	

response.end

Open in new window


this is what the xml section looks like:
<PASSENGERLIST>
      <PASSENGER>
        <LASTNAME>Rustler</LASTNAME>
        <FIRSTNAME>Ted</FIRSTNAME>
        </PASSENGER>
       <PASSENGER>
        <LASTNAME>Johnston</LASTNAME>
        <FIRSTNAME>Hartley</FIRSTNAME>
        </PASSENGER>
     </PASSENGERLIST>

Open in new window

Comment
Watch Question
CERTIFIED EXPERT
Commented:
This problem has been solved!
Unlock 1 Answer and 7 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE