Page 1 of 1

base:GetXMLString()

Posted: Wed Apr 15, 2015 10:38 pm
by djrikki
This is the first of a handful of xml-based parsing routines.

Code: Select all

Global base
base = {}

;; base:GetXmlString(data,key)
; You should call this recursively in a While ... data = ReadLine(1)...Wend  structure; ex. call line$ = base:GetXmlString(data,"Album")
Function base:GetXmlString(data,key)
    Local result = ""

    If FindStr(data,"<key>") > -1
        If FindStr(data,key) > -1
            data = ReadLine(1)
            result = MidStr(data,FindStr(data,"<string>")+StrLen("<string>"),StrLen(data))
            result = UnleftStr(result,StrLen("</string>"))
        EndIf
    EndIf
    
    Return(result)
EndFunction