Here's a quickly hacked together parse of the Wikipedia example of an Atom (which I saved to a file named feed.xml)
http://en.wikipedia.org/wiki/Atom_(standard)#Example_of_an_Atom_1.0_feed
sub main()
feed=readasciifile("pkg:/feed.xml")
xml=createobject("roXMLElement")
obj=createobject("roAssociativeArray")
if xml.parse(feed) then
obj.title=xml.title.gettext()
obj.subtitle=xml.subtitle.gettext()
obj.links=[]
for each link in xml.link
obj.links.push(link.getattributes())
end for
obj.id=xml.id.gettext()
obj.updated=xml.updated.gettext()
for each element in xml.author.getchildelements()
obj[element.getname()]=element.gettext()
end for
entry=xml.entry
obj["element"]=[]
for each item in entry.getchildelements()
arr={}
arr[item.getname()]=element.gettext()
arr[item.getname()+"_attribute"]=item.getattributes()
obj.element.push(arr)
end for
else
?"parse failed"
end if
stop
end sub
It manages, through a variety of ways, to get (I think) all the attributes into a variable of one sort or another.
One way I didn't include in this example, if I just wanted the href part of a link, I could have done:
for each link in xml.link
obj.links.push(link@href)
end for
When the code finishes running, print out the variable obj:
some examples:
BrightScript Debugger> print obj
name: John Doe
element: <Component: roArray>
email: johndoe@example.com
subtitle: A subtitle.
updated: 2003-12-13T18:30:02Z
id: urn:uuid:60a76c80-d399-11d9-b91C-0003939e0af6
title: Example Feed
links: <Component: roArray>
BrightScript Debugger> print obj.element
<Component: roAssociativeArray>
<Component: roAssociativeArray>
<Component: roAssociativeArray>
<Component: roAssociativeArray>
<Component: roAssociativeArray>
<Component: roAssociativeArray>
<Component: roAssociativeArray>
BrightScript Debugger> ?obj.element[0]
title: johndoe@example.com
title_attribute: <Component: roAssociativeArray>
BrightScript Debugger> ?obj.element[1]
link: johndoe@example.com
link_attribute: <Component: roAssociativeArray>
BrightScript Debugger> ?obj.element[1].link_attribute
href: http://example.org/2003/12/13/atom03
BrightScript Debugger> ?obj.links
http://example.org/feed/
http://example.org/