[Gambas-user] Parsing a xml file from internet

Caveat Gambas at ...1950...
Sat Aug 7 12:22:24 CEST 2010


Hi Mato,

I have put together a quick demonstration project which parses a String
(out of a TextArea on the Form) of XML and places the result into a
TreeView (on the same Form).

Attached you will find a tar file of the project, plus a screen shot.

The code is based on an article I found at
http://es.wikibooks.org/wiki/Gambas/Manipular_documentos_XML (Thanks and
all credit to the original author!!!)

I made some slight changes as the code didn't quite work in its original
form with the XML as given.

Regards,
Caveat




On Wed, 2010-08-04 at 08:50 -0300, Matías Manuel Grandi wrote:
> Hi guys! First of all...I'm new to gambas!
> I'm traying to parse a xml from
> http://8tracks.com/sets/460486803/play.xml?mix_id=2000
> I can get the file with the following code:
> 
> ' Gambas class file
> PUBLIC url AS String
> 
> PUBLIC SUB Form_Open()
>   DIM reader AS XmlReader
>   DIM h AS HttpClient
>   DIM buffer AS String
>   DIM doc AS XmlDocument
>   h = NEW HttpClient AS "h"
>   h.URL = "http://8tracks.com/sets/460486803/play.xml?mix_id=2000"
>   h.Async = FALSE
>   h.Timeout = 60
>   h.Get
>   IF h.Status < 0 THEN
>     PRINT "ERROR"
>   ELSE
>     ' Success - read the data
>     IF Lof(h) THEN READ #h, buffer, Lof(h)
>   END IF
> 
> 
> The xml file is now in a varaible called "buffer". How can I get it
> from xmlread object?
> 
> Thanks!
> Mato.-
> 
> ------------------------------------------------------------------------------
> The Palm PDK Hot Apps Program offers developers who use the
> Plug-In Development Kit to bring their C/C++ apps to Palm for a share
> of $1 Million in cash or HP Products. Visit us here for more details:
> http://p.sf.net/sfu/dev2dev-palm
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screenshot-Test Project 3 - XML.png
Type: image/png
Size: 97042 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20100807/bb2e6be4/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TestProject3.tar.gz
Type: application/x-compressed-tar
Size: 10794 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20100807/bb2e6be4/attachment.bin>


More information about the User mailing list