Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


problems getting nodes from XML

 
Logged in as: Guest
arrSession:exec spGetSession 2,3,46119
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> ASP >> problems getting nodes from XML
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 problems getting nodes from XML - 4/19/2007 7:24:43 AM   
  kelphis

 

Posts: 10
Score: 0
Joined: 4/19/2007
Status: offline
im having the toughest time getting my selectSingleNode function to work.  It doesnt want to select anything.  I keep getting this error :
Error Type:
Microsoft VBScript runtime (0x800A01A8)
Object required: '[object]'
/VBSportal/welcome.asp, line 66
 
The red line is the one that is failing.  what am i doing wrong.
 

      



This is my xml :
the blue tag is what I want to select so that I can create a select box of all the DIV items.
<DSIOUT>
   <DATE>04-19-2007 15:14:31</DATE>
   <XMLVERSION>1.0</XMLVERSION>
   <XMLENCODING>UTF-8</XMLENCODING>
   <DATA>
        <DIVS>
           <DIV>P-PACCAR</DIV>
           <DIV>B-MERCEDES</DIV>
           <DIV>F-FREIGHTLINER</DIV>
           <DIV>M-MACK</DIV>
           <DIV>C-CUMMINS</DIV>
           <DIV>D-DETROIT</DIV>
        </DIVS>
   </DATA>
</DSIOUT>
 
 
Post #: 1
 
 RE: problems getting nodes from XML - 4/20/2007 1:40:15 AM   
  kelphis

 

Posts: 10
Score: 0
Joined: 4/19/2007
Status: offline
I think this is an encoding issue.  Im getting my XML from a web service.  i took the code from the web service and pasted it directly into the script and it works.  however when the exact same code is returned from the web service it doesnt work.  can this be an encoding issue?

(in reply to kelphis)
 
 
Post #: 2
 
 RE: problems getting nodes from XML - 4/21/2007 7:11:16 AM   
  dm_4ever


Posts: 2313
Score: 34
Joined: 6/29/2006
From: Orange County, California
Status: offline
What if you tried this:
divXML.selectsinglenode("//DSIOUT/DATA/DIVS").childNodes

_____________________________

dm_4ever

My philosophy: K.I.S.S - Keep It Simple Stupid
Read Me: http://www.visualbasicscript.com/m_24727/tm.htm
Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to kelphis)
 
 
Post #: 3
 
 RE: problems getting nodes from XML - 4/23/2007 12:17:38 AM   
  kelphis

 

Posts: 10
Score: 0
Joined: 4/19/2007
Status: offline
I think I tried that.  I really think its an encoding issue.   I could be wrong but the reason that I think this is because if I copy the xml as a static string into the program it works fine.  but when the web service returns this I cant select anything.


Error Type:
Microsoft VBScript runtime (0x800A01A8)
Object required: 'divXML.selectsinglenode(...)'
/VBSportal/functions.asp, line 33

note:

i had the program response.write() out the output that I recieve from the web service without doing the LoadXML().  this is what is returned from the web service:
<?xml version="1.0" encoding="utf-8"?>
<string xmlns="&lt;DIVS&gt;&lt;DV&gt;P-PACCAR&lt;/DV&gt;&lt;DV&gt;B-MERCEDES&lt;/DV&gt;&lt;DV&gt;F-FREIGHTLINER&lt;/DV&gt;&lt;DV&gt;M-MACK&lt;/DV&gt;&lt;DV&gt;C-CUMMINS&lt;/DV&gt;&lt;DV&gt;D-DETROIT&lt;/DV&gt;&lt;DV&gt;K-CATERPILLAR&lt;/DV&gt;&lt;DV&gt;W-VOLVO/GM&lt;/DV&gt;&lt;DV&gt;X-MISCELLANEOUS&lt;/DV&gt;&lt;DV&gt;R-REBUILT&lt;/DV&gt;&lt;DV&gt;H-HARDWARE&lt;/DV&gt;&lt;DV&gt;O-GAS'>http://localhost/DSWebService/WebService">&lt;DIVS&gt;&lt;DV&gt;P-PACCAR&lt;/DV&gt;&lt;DV&gt;B-MERCEDES&lt;/DV&gt;&lt;DV&gt;F-FREIGHTLINER&lt;/DV&gt;&lt;DV&gt;M-MACK&lt;/DV&gt;&lt;DV&gt;C-CUMMINS&lt;/DV&gt;&lt;DV&gt;D-DETROIT&lt;/DV&gt;&lt;DV&gt;K-CATERPILLAR&lt;/DV&gt;&lt;DV&gt;W-VOLVO/GM&lt;/DV&gt;&lt;DV&gt;X-MISCELLANEOUS&lt;/DV&gt;&lt;DV&gt;R-REBUILT&lt;/DV&gt;&lt;DV&gt;H-HARDWARE&lt;/DV&gt;&lt;DV&gt;O-GAS, OIL AND GREASE&lt;/DV&gt;&lt;DV&gt;Y-YAMAHA&lt;/DV&gt;&lt;DV&gt;S-DIRECT SHIP PACCAR&lt;/DV&gt;&lt;DV&gt;N-NISSAN&lt;/DV&gt;&lt;DV&gt;I-INTERNATIONAL&lt;/DV&gt;&lt;DV&gt;V-VOLVO&lt;/DV&gt;&lt;DV&gt;Z-ZEBRA&lt;/DV&gt;&lt;DV&gt;U-ISUZU&lt;/DV&gt;&lt;DV&gt;a-stuff&lt;/DV&gt;&lt;/DIVS&gt;</string>


Update:  I just realized that I should tell  you that I made a change to the xml.  notice that the DIV tags are now DV.  a co worker pointed out that DIV is already a used tag so I changed it.

< Message edited by kelphis -- 4/23/2007 12:24:04 AM >

(in reply to dm_4ever)
 
 
Post #: 4
 
 RE: problems getting nodes from XML - 4/23/2007 3:19:48 AM   
  kelphis

 

Posts: 10
Score: 0
Joined: 4/19/2007
Status: offline
i found a work around and I dont like it but it works.  i have to do 2 loads of the XML and it works.

       divXML.LoadXml(ws.QueryWebService())
       divXML.LoadXml(divXML.text)

does this help anyone kinda figure out what im doing wrong?

(in reply to kelphis)
 
 
Post #: 5
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> ASP >> problems getting nodes from XML Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts