Very good points. I'm sure we will address this in a blog posting in the near future, and perhaps improve the documentation in this area as well.
to try to help you immediately:
Download an XML file:
xfer=createobject("rourltransfer")
xfer.seturl("http://myserver.com/data.xml")
RawXMLData=xfer.gettostring()
In parsing the file, it is helpful to know what it looks like, and what you want to map the data to, for example, if you want to parse data that will wind up on a roPosterScreen (and most other components that have a SetContentList method), you would want to map images to the SDPosterURL and HDPosterURL, and the title and subtitle of the content to the ShortDescriptionLine1 and ShortDescriptionLine2 fields, so say you have some XML that looks like this:
<items>
<item>
<title>This is a test</title>
<subtitle>This is a subtitle of the test title</subtitle>
<hdThumbnail>http://server.com/hdimage.jpg</hdThumbnail>
<sdThumbnail>http://server.com/sdimage.jpg</sdThumbnail>
<itemdescription>This is a long description of this item it is so long it goes on and on</itemdescription>
</item>
<item>
<title>This is also a test</title>
<subtitle>This is also a subtitle of the test title</subtitle>
<hdThumbnail>http://server.com/hdimage2.jpg</hdThumbnail>
<sdThumbnail>http://server.com/sdimage2.jpg</sdThumbnail>
<itemdescription>This is another long description of this item it is so long it goes on and on</itemdescription>
</item>
</items>
So assuming you have downloaded this xml from the server and it is stored as a string in the RawXMLData variable, then you would want to parse it:
xml=createobject("roXMLElement")
list=createobject("roArray",1,true)
if xml.parse(RawXMLData) then
for each obj in xml.item
currentitem=createobject("roAssociativeArray")
currentitem.shortdescriptionLine1=obj.title.gettext()
currentitem.shortdescriptionLine2=obj.subtitle.gettext()
currentitem.hdposterurl=obj.hdThumbnail.gettext()
currentitem.sdposterurl=obj.sdThumbnail.gettext()
currentitem.title=currentitem.shortdescriptionLine1
list.push(currentitem)
end for
else
print "parse failed"
end if
Assuming there are no bugs in the code and the xml parses, you will now have a variable, "list" which you can display on the screen:
screen=createobject("roposterscreen")
screen.show()
screen.setcontentlist(list)
while true
'prevent the program from exiting to the home screen
end while
If your xml has underscores or dashes in it, you would use currentitem=getNamedElements("tag_name").gettext()
*edit*:
further, if your xml has an element like:
<item publishdate="04/22/1999" duration="3600">
you would probably access that data as:
currentitem.pubdate=obj@publishdate
currentitem.duration=obj@duration
- Joel