Page 1 of 1

base:GetXmlDate()

Posted: Wed Apr 15, 2015 11:36 pm
by djrikki
Here is another XML parse function with a different set of pairs, in the instance <date>:

Code: Select all

Global base
base = {}

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

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