Reading them is easy. They are just text files so open them with FileOpPen and read each line with FileRead.Is there any way to read xml files with basic4ppc;
Yes i mean parse the xml file.:signOops:Reading them is easy. They are just text files so open them with FileOpPen and read each line with FileRead.
Parsing them is a different matter. You will have to write that yourself!
Very useful.Thank'sHi stratus,
Please have a look at help for the regex library.
And then at this...
http://www.regular-expressions.info/examples.html
"Grabbing HTML Tags"
This expression can be used for parsing XML tags, too.
url = ParseXML(x, "<url>", "</url>")
Sub ParseXML(p, t1, t2)
'Extracts a string embraced in t1 an t2 tags
Dim l, r1, r2
l = StrLength(t1)
r1 = StrIndexOf(p, t1, 0)
If r1 > 0 Then 'if the start tag is found then...
r2 = StrIndexOf(p, t2, r1 + 1) 'look for the end tag
p = SubString(p, r1 + l, r2 - r1 - l) 'extract the string between the tags
Return p 'Return the wanted string
End If
End Sub
FileOpen(c1,"myfile.xml")
x = FileReadToEnd (c1)
FileClose(c1)