Author Topic: IXMLDOMDocument Reading from a web ...  (Read 2536 times)

0 Members and 1 Guest are viewing this topic.

SOFITO_SOFT

  • Guest
IXMLDOMDocument Reading from a web ...
« on: July 13, 2011, 03:31:57 PM »
Hello.....
The attached program can read and save a document from a web ...
Buttt...I do not know how to access the data it contains ....
Code: [Select]
(defun C:getIp (/ path http url web objXML file
;str    <<<<<<<<<< !!!!!!!!!
s1 s2)
  (setq path (strcat (getSpecialPath 1) "\\msxml6.dll"))
  (if (not xc-NODE_TEXT)
    (vlax-import-type-library
      :tlb-filename  path
      :methods-prefix "xm-"
      :properties-prefix "xp-"
      :constants-prefix "xc-"
    )
  )
  (setq web ( strcat
               "http://maps.google.com/maps/api/geocode/xml?address=28%20de%20enero+anaco&sensor=false"
                )
   )

  (setq objXML (vlax-create-object "MSXML2.ServerXMLHTTP"))
  (xm-open objXML "GET" web :vlax-false)
  (xm-send objXML)
  (setq str (xp-get-responseXML objXML)) ;(xp-get-responseXML http)
;(xp-get-responseStream http)
;(xp-get-responseBody http)
  (setq file (vl-filename-mktemp "c:\\1.html"))
  (setq file (open file "W"))
  (princ str file)
  (close file)
  (vlax-release-object objXML)
  (princ)
)

The temporary file ( vl-filename-mktemp "c:\\1.html" )  only contains  :-o

#<VLA-OBJECT IXMLDOMDocument2 02ee4100>
 
Any help will be welcome all guests ... :-) :-) :-)

Greetings.

yarik

  • Newt
  • Posts: 32
Re: IXMLDOMDocument Reading from a web ...
« Reply #1 on: July 13, 2011, 04:25:54 PM »
Hi SOFITO, try

Code: [Select]
(princ (vlax-get str 'xml) file)

Lee Mac

  • Seagull
  • Posts: 12915
  • London, England
Re: IXMLDOMDocument Reading from a web ...
« Reply #2 on: July 13, 2011, 06:03:45 PM »
Perhaps this will help you. 

SOFITO_SOFT

  • Guest
Re: IXMLDOMDocument Reading from a web ...
« Reply #3 on: July 14, 2011, 04:50:09 AM »
Hello:
This is really interesting to download  beautiful drawings of Google.maps  :-), but I lack technique! :-(
Thank you all.
Greetings.... :-) :-)

dgorsman

  • Water Moccasin
  • Posts: 2437
Re: IXMLDOMDocument Reading from a web ...
« Reply #4 on: July 14, 2011, 02:00:58 PM »
Once you have a DOMDocument object, you should be able to use its methods and properties to navigate the contents as needed, e.g. documentElement property to get the document element, then SelectSingleNode, SelectNodes methods off of the document element.
If you are going to fly by the seat of your pants, expect friction burns.

try {GreatPower;}
   catch (notResponsible)
      {NextTime(PlanAhead);}
   finally
      {MasterBasics;}

Lee Mac

  • Seagull
  • Posts: 12915
  • London, England
Re: IXMLDOMDocument Reading from a web ...
« Reply #5 on: July 14, 2011, 03:19:55 PM »

SOFITO_SOFT

  • Guest
Re: IXMLDOMDocument Reading from a web ...
« Reply #6 on: July 15, 2011, 07:36:39 AM »
HelloooOOO.... :)
interesting links, but something is wrong with my DLLs or APIs or consumed my brain or I do not know why.  :|
Any attempt to read just a "invalid characters in file ...." In Spanish! a very rare thing.  :-o :-o :-o
Thanks anyway for your interest. I'll do the old method ... open, read-line, remove "<", to put here ... "(", over there ... change quotes in brackets ... You know that I speak.  :lol:

Greetings from Madrid. :-)

Lee Mac

  • Seagull
  • Posts: 12915
  • London, England
Re: IXMLDOMDocument Reading from a web ...
« Reply #7 on: July 15, 2011, 07:56:29 AM »
Here is an example in which I used the XML functions, perhaps it will help you understand the correct implementation.

SOFITO_SOFT

  • Guest
Re: IXMLDOMDocument Reading from a web ...
« Reply #8 on: July 15, 2011, 10:21:36 AM »
Spectacular! .... I had seen it a few months ago ... but just a look ... did not know you use XML forms. My error came from trying to apply these functions to a file down the hard drive.
Really not that complex. I have already made ​​a large part, on the other hand, the more difficult is to manage the list of sublists generated ... I have to read latitude and longitude (geographic coordinates), manipulate and convert them into UTM coordinates so .... it is hard to organize the data after the XML ... Anyway I will read more carefully you WEATHER program ....
Thanks again and best regards ...

SOFITO_SOFT

  • Guest
Re: IXMLDOMDocument Reading from a web ...
« Reply #9 on: July 15, 2011, 03:06:32 PM »
Hellosss ...
Another alternative is JSON specification ...  :-o
the data file is much like a nested list ... 
Perhaps there will come sooner ...:wink:
I enclose a copy
Regards  :-)

SOFITO_SOFT

  • Guest
Re: IXMLDOMDocument Reading from a web ...
« Reply #10 on: July 15, 2011, 04:07:01 PM »
Hellosssss
this JSON format much easier .... and recommended by Google!  :-)
Greetingssss  :-D