responseXML

responseXML

Postby Natter » Fri May 12, 2017 6:52 pm

Hi, all !

I make a request to the site and want to get the DOM document

TRY
oHttp:= CreateObject( "MSXML2.XMLHTTP" )
CATCH
oHttp:= CreateObject( "microsoft.XMLHTTP" )
END

oHttp:Open( "GET", MyURL, 1)
oHttp:setRequestHeader( 'Content-type', 'text/xml')
oHttp:Send(NIL)

fl:=int(gettickcount()/1000)
do while .T.
if oHttp:readyState=4.and.oHttp:Status=200
cTxt:=oHttp:responseText
oDc:=oHttp:responseXML
exit
endif
millisec(50)
enddo

Everything works fine. oHttp:responseText returns an html text page, but the responseXML is empty. What am I doing wrong ?
Natter
 
Posts: 1215
Joined: Mon May 14, 2007 9:49 am

Re: responseXML

Postby Enrico Maria Giordano » Fri May 12, 2017 9:06 pm

Try with

Code: Select all  Expand view
oHttp:ResponseBody


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8713
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: responseXML

Postby Natter » Sat May 13, 2017 6:52 am

Thank you, Enrico, for your help. However responceBody returns HTML, but not the document
Natter
 
Posts: 1215
Joined: Mon May 14, 2007 9:49 am

Re: responseXML

Postby Enrico Maria Giordano » Sat May 13, 2017 8:43 am

What do you mean with "the document"? XML is a text, just like html body.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8713
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: responseXML

Postby Natter » Sat May 13, 2017 10:13 am

WEB document-page website. Respobsetext/Responsebody return a html page. ResponseXML returns a DOM-compatible document page, which you can parse with DOM tools.
For example oHttp:responseXML:getElementById("ABC")
Natter
 
Posts: 1215
Joined: Mon May 14, 2007 9:49 am

Re: responseXML

Postby Enrico Maria Giordano » Sat May 13, 2017 11:14 am

Ok. Try

Code: Select all  Expand view
oHttp:Open( "GET", MyURL, .T.)


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8713
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: responseXML

Postby Natter » Sat May 13, 2017 1:47 pm

In fact oHttp:Open( "GET", MyURL, 1), no different from oHttp:Open( "GET", MyURL, .T.) :D
It's still not working
Natter
 
Posts: 1215
Joined: Mon May 14, 2007 9:49 am

Re: responseXML

Postby Enrico Maria Giordano » Sat May 13, 2017 2:25 pm

Ok. I don't know why ResponseXML it's empty, sorry. :-(

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8713
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: responseXML

Postby darioflores » Sun May 14, 2017 4:38 pm

try with: oHttp:responseText
darioflores
 
Posts: 17
Joined: Tue Oct 06, 2015 7:06 am


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 100 guests