<?xml .... ?>
<feed>
<foo att="something">
<bar>text</bar>
<test>text</test>
</foo>
<foo att="something2">
<bar>text2</bar>
<test>text2</test>
</foo>
</feed>
rsp = CreateObject("roXMLElement")
rsp.Parse(html)
"DukeOfMarshall" wrote:
I know you can call it like "rsp.foo[1]" and "rsp.foo[1].bar, but how do you extend that to attributes?
Member function not found in BrightScript Component or interface
print "Image => "+rsp.foo[0]@att.gettext()
print "Image => "+rsp.foo[0]@att.tostr()
o.SDPosterUrl = rsp.foo[0]@att.gettext()
o.HDPosterUrl = rsp.foo[0]@att.tostr()
hd_image = rsp.foo[0]@att
o.HDPosterUrl = hd_image
"DukeOfMarshall" wrote:
So here's a follow up. Why does this not work when simply printing to the debugger
print "Image => "+rsp.foo[0]@att.gettext()
But this DOES work when printing to debugger
print "Image => "+rsp.foo[0]@att.tostr()
But neither work when setting the attribute
o.SDPosterUrl = rsp.foo[0]@att.gettext()
o.HDPosterUrl = rsp.foo[0]@att.tostr()
Instead I have to do this
hd_image = rsp.foo[0]@att
o.HDPosterUrl = hd_image
What in the world?
o.SDPosterUrl = rsp.foo[0]@att
o.HDPosterUrl = rsp.foo[0]@att
[and then can access as
{ },
{ att: "something", bar: "text", test: "text" },
{ att: "something2", bar: "text2", test: "text2" }
]
o.HDPosterUrl = rsp[1].att