Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Level 7

roXMLElement GetBody() and GetchildElement() methods

I've finally gotten around to trying to consume some XML from within BrightScript.
The documentation on the roXMLElement object is a bit light.

Can someone explain to me the difference between roXMLElement.GetBody() and roXMLElement.GetChildElements()?

They seem to be used interchangeably in the VideoPlayer sample.

Thanks,

D.
0 Kudos
6 Replies
Highlighted
Level 7

Re: roXMLElement GetBody() and GetchildElement() methods

"vaxace" wrote:
I've finally gotten around to trying to consume some XML from within BrightScript.
The documentation on the roXMLElement object is a bit light.

Can someone explain to me the difference between roXMLElement.GetBody() and roXMLElement.GetChildElements()?

They seem to be used interchangeably in the VideoPlayer sample.

Thanks,

D.


I just started working with this too, last night. I think GetBody(), along with GetText() gives you the contents of the element in string form, which GetChildElements() returns an roXMLList or roXMLElement if there's only one.
-- GandK Labs
Check out Reversi! in the channel store!
0 Kudos
Highlighted
Level 9

Re: roXMLElement GetBody() and GetchildElement() methods

If I'm remembering correctly, I believe GetChildElements() actually returns and array of roXMLElements instead of an roXMLList as you might expect.
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
Highlighted
Level 7

Re: roXMLElement GetBody() and GetchildElement() methods

Actually, I just tested it in the debugger.
They both return an roXMLList.

Go figure :?

D.
0 Kudos
Highlighted
Level 9

Re: roXMLElement GetBody() and GetchildElement() methods

"vaxace" wrote:
Actually, I just tested it in the debugger.
They both return an roXMLList.

Go figure :?

D.

Hrmm.. I wonder if it was GetNamedElements() that returned an array... I know I ran across one of the roXMLElement methods that returned an array. I swear! Smiley Tongue
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
Highlighted
Level 9

Re: roXMLElement GetBody() and GetchildElement() methods

GetChildElements() reurns an roXMLList. If there are no children, it returns an empty list.

GetBody() returns an roXMLList if the body is not a leaf. If the body is a leaf node, it returns a string.

--Kevin
0 Kudos
Highlighted
Level 7

Re: roXMLElement GetBody() and GetchildElement() methods

Ahh. A subtle, but distinct difference.

Thanks!
0 Kudos