Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
EnTerr
Roku Guru

roXML... no GetChildNodes() on fw3?

Just tried testing my code on fw3 (3.1.1198) and it crashes with this:
Member function not found in BrightScript Component or interface. (runtime error &hf4) in ...zY/pkg:/source/somethingSomething.brs(175)

175: children = xml.GetChildNodes()
Backtrace:
Function xhtml2text(xml As ) As

I trusted the function exists - there is no compatibility notice of any kind in the manual for GetChildNodes( ).
But suddenly it is not there! And without it the XML parser is useless to me.
Good grief you guys - what am i supposed to do now?? :oops:
0 Kudos
5 REPLIES 5
destruk
Streaming Star

Re: roXML... no GetChildNodes() on fw3?

You would probably have to use GetChildElements() instead. since they are almost the same thing.
0 Kudos
EnTerr
Roku Guru

Re: roXML... no GetChildNodes() on fw3?

"destruk" wrote:
You would probably have to use GetChildElements() instead. since they are almost the same thing.

Nope. Without GetChildElements() i am boned, on perfectly good XML:
BrightScript Debugger> ? xml.parse("<x> a <b> c </b> d </x>")
true
BrightScript Debugger> ? xml.getChildElements()
<Component: roXMLElement>
'fair enough, array with 1 roXML
BrightScript Debugger> ? xml.getChildElements()[0].genXML(0)
<b> c </b> 'as expected
BrightScript Debugger> ? ">" xml.getText() "<"
>< 'huh?
BrightScript Debugger> ? xml.genXML(0)
<x><b> c </b></x> 'WAT!
0 Kudos
EnTerr
Roku Guru

Re: roXML... no GetChildNodes() on fw3?

Answer from RokuCo, please?
Will getChildNotes() be coming to fw 3?

Or will roXML be able to sustain both text and sub-elements on 3.x?
(me experimenting with setBody() / addElement() _seems_ to show it can keep only 1 thing at a time in its head)
0 Kudos
RokuKC
Roku Employee
Roku Employee

Re: roXML... no GetChildNodes() on fw3?

"EnTerr" wrote:
Answer from RokuCo, please?
Will getChildNotes() be coming to fw 3?


roXMLElement.GetChildNodes() is only supported for devices running modern firmware.

This has been noted on the documentation.
0 Kudos
EnTerr
Roku Guru

Re: roXML... no GetChildNodes() on fw3?

"RokuKC" wrote:
roXMLElement.GetChildNodes() is only supported for devices running modern firmware.
This has been noted on the documentation.

And thank you for adding that note... eventually.

Version incompatibility was undocumented for four months. In the mean time i discovered the method added to the docs and started using it - all July i worked on a channel that depended on it, then beginning of August when testing on fw3, it turned out method is not there - and hence me crying in this thread. And so i had to go back to the drawing board and spend most of August writing my own XML parser because of July's sunk cost. Pardon me if i am unhappy with whoever added the method but "forgot" to note compatibility.

So was i right above that a roXmlElement on fw3 cannot hold both text and sub-elements, at the same time?

The unfortunate thing in that would be i won't be able to use the convenient "dot-filtering" abilities of roXmlElement (i.e. do `xhtml.body.article.section.table.tr.td.div` to zero-in on the content i need) - and will have to re-invent the wheel for doing selection in the tree. Otherwise even if i have to do my own parsing, i could re-construct the result as roXmlElement/roXmlList and use dot-subsetting.
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.