TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: SOFITO_SOFT on July 13, 2011, 03:31:57 PM

Title: IXMLDOMDocument Reading from a web ...
Post by: SOFITO_SOFT 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.
Title: Re: IXMLDOMDocument Reading from a web ...
Post by: yarik on July 13, 2011, 04:25:54 PM
Hi SOFITO, try

Code: [Select]
(princ (vlax-get str 'xml) file)
Title: Re: IXMLDOMDocument Reading from a web ...
Post by: Lee Mac on July 13, 2011, 06:03:45 PM
Perhaps this (http://www.theswamp.org/index.php?topic=33750) will help you. 
Title: Re: IXMLDOMDocument Reading from a web ...
Post by: SOFITO_SOFT 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.... :-) :-)
Title: Re: IXMLDOMDocument Reading from a web ...
Post by: dgorsman 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.
Title: Re: IXMLDOMDocument Reading from a web ...
Post by: Lee Mac on July 14, 2011, 03:19:55 PM
This will also help you:

http://www.theswamp.org/index.php?topic=33065 (http://www.theswamp.org/index.php?topic=33065)
Title: Re: IXMLDOMDocument Reading from a web ...
Post by: SOFITO_SOFT 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. :-)
Title: Re: IXMLDOMDocument Reading from a web ...
Post by: Lee Mac on July 15, 2011, 07:56:29 AM
Here (http://www.theswamp.org/index.php?topic=37107) is an example in which I used the XML functions, perhaps it will help you understand the correct implementation.
Title: Re: IXMLDOMDocument Reading from a web ...
Post by: SOFITO_SOFT 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 ...
Title: Re: IXMLDOMDocument Reading from a web ...
Post by: SOFITO_SOFT 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  :-)
Title: Re: IXMLDOMDocument Reading from a web ...
Post by: SOFITO_SOFT on July 15, 2011, 04:07:01 PM
Hellosssss
this JSON format much easier .... and recommended by Google!  :-)
Greetingssss  :-D