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

xml Parse() fails on certain text

Hi,
first time post 🙂

I am parsing an xml file that has a hash in it and I am seeing the Parse() function fail.
It looks like the leading "7e" is the point of failure.

calling Parse() on this file fails:

<result>
<mystuff>
<7ea94c240691311dc0916a2a91eb7c3db2c6f3e4>
<name>This is my name</name>
</7ea94c240691311dc0916a2a91eb7c3db2c6f3e4>
</mystuff>
</result>

this one passes

<result>
<mystuff>
<bba94c240691311dc0916a2a91eb7c3db2c6f3e4>
<name>This is my name</name>
</bba94c240691311dc0916a2a91eb7c3db2c6f3e4>
</mystuff>
</result>


Any ideas of how I can work around this issue (can't change the hash!).

Thanks,
Joe
0 Kudos
1 REPLY 1
RokuChris
Roku Employee
Roku Employee

Re: xml Parse() fails on certain text

Element names that begin with numbers are not valid XML. This is a handy tool for validating any XML you're trying to parse: http://www.w3schools.com/xml/xml_validator.asp

One workaround would be to just prepend some static string to each hash when generating the XML.

Or, arguably, the more correct approach would be to not use the hash as an element name at all, but to do something like <item id="hash_value">
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.