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: 
SamZ
Visitor

XML encoding

Is there a[n easy] way to encode a string with " and other special characters? Even if I could find the escape character ("\"" in JS) I could replace it ...
0 Kudos
5 REPLIES 5
RokuChris
Roku Employee
Roku Employee

Re: XML encoding

Not sure if this answers your question, but if you build an XML structure using roXMLElement, then call its GenXML() function, all the strings should be encoded properly in the result.
0 Kudos
SamZ
Visitor

Re: XML encoding

That might help, thank you! But in general, how can you escape double quotes in a string in Brightscript?
0 Kudos
TheEndless
Channel Surfer

Re: XML encoding

"SamZ" wrote:
That might help, thank you! But in general, how can you escape double quotes in a string in Brightscript?

Chr(34)
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
SamZ
Visitor

Re: XML encoding

BTW, BrightScriptReferenceManual.pdf says:
GenXML(gen_header As String) As String but passing a string to the function throws an error! It turns out the parameter has to be Boolean! Further down the doc has this:
"GenXML() takes one parameter (boolean) that indicates whether the generated xml should have the <?xml …> tag at the top."
0 Kudos
EnTerr
Roku Guru

Re: XML encoding

"SamZ" wrote:
BTW, BrightScriptReferenceManual.pdf says:
GenXML(gen_header As String) As String but passing a string to the function throws an error! It turns out the parameter has to be Boolean!

OK, this is kinda ridiculous: it has been almost two years and this has not been corrected. I just faced it

Glad searching the forum for GenXML pulled this info.

Two years! Seriously Roku dudes, fix it.
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.