[Gambas-user] Return an array in a function
Matías Manuel Grandi
matiasgrandi at ...626...
Sat Aug 7 18:25:27 CEST 2010
Sorry, hi goes again!!!
-----------------------------------------------------------------
Hi Guys!
I have a problem when calling a function, which receive an xmlreader
and returns an array.
The function is geturl and the error gambas give me is "Type Mismatch:
Wanted an Array, got an Array instead"
The code is (a bit simplified):
PUBLIC SUB btnPopular_Click()
DIM GetUrlFromXml AS Array
xml8tracks = NEW XmlReader
xml8tracks = urlDownload("http://8tracks.com/mixes.xml?sort=popular")
GetUrlFromXml = GetUrl(xml8tracks)
END
PUBLIC FUNCTION GetUrl(reader AS XmlReader) AS Array
DIM smix[10, 4] AS String
DIM id AS Integer
DO WHILE TRUE
TRY reader.Read()
IF reader.Eof THEN BREAK
IF reader.Node.Type = XmlReaderNodeType.Element THEN
SELECT CASE reader.Node.Name
CASE "name"
id = id + 1
reader.Read()
smix[id, 0] = reader.Node.Value
PRINT id & "Nombre: " & smix[0, 0]
CASE "restful-url"
reader.Read()
smix[id, 1] = reader.Node.Value
PRINT id & "restful-url: " & smix[id, 1]
END SELECT
ENDIF
LOOP
reader.Close()
IF ERROR THEN
Message.Error("Error when trying to open the Heroes.XML file!")
RETURN
ENDIF
RETURN smix
END
Thanks!
Mato.-
2010/8/7 M. Cs. <mohareve at ...626...>
>
> It's not readable! Can you resend it without weblinks?
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by
>
> Make an app they can't live without
> Enter the BlackBerry Developer Challenge
> http://p.sf.net/sfu/RIM-dev2dev
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
More information about the User
mailing list