<xml>
<tag1 class="class1">
<a href="http://www.google.com">Google!</a>
Some more text goes here
</tag1>
</xml>
<xml>
<tag1 class="class1">
<a href="http://www.google.com">Google!</a>
<span>Some more text goes here</span>
</tag1>
</xml>
"joetesta" wrote:
I bet you can get it if you put another wrapper around it; assuming you need to maintain html compatibility I'd use <span>
>>> import xml.etree.ElementTree as et
>>> e = et.fromstring('<xml> <tag1 class="class1"> <a href="http://www.google.com">Google!</a> Some more text goes here </tag1> </xml>')
>>> e
<Element xml at 442968>
>>> e[0]
<Element tag1 at 4427d8>
>>> e[0][0]
<Element a at 4429b8>
>>> e[0][0].tail
' Some more text goes here '
>>> et.tostring(e[0][0])
'<a href="http://www.google.com">Google!</a> Some more text goes here '
BrightScript Debugger> x = CreateObject("roXMLElement")genXML should have reconstituted (more or less) the original but seems Foo and Qux have been lost in translation. Even Foo, that should've been the getText() to <xml>. Bugs?
BrightScript Debugger> x.parse("<xml> foo <tag> bar </tag> qux </xml>")
BrightScript Debugger> ? x.genXML(false)
<xml><tag> bar </tag></xml>
"EnTerr" wrote:"joetesta" wrote:
I bet you can get it if you put another wrapper around it; assuming you need to maintain html compatibility I'd use <span>
No, the question was how to work with the XML as given, not to mangle it server-side.
"joetesta" wrote:"EnTerr" wrote:"joetesta" wrote:
I bet you can get it if you put another wrapper around it; assuming you need to maintain html compatibility I'd use <span>
No, the question was how to work with the XML as given, not to mangle it server-side.
It may be well formed XML and I may not have answered the question, but if you need this to happen now, I bet double or nothing my solution works.
"joetesta" wrote:
I bet you can get it if you put another wrapper around it; assuming you need to maintain html compatibility I'd use <span><xml>
<tag1 class="class1">
<a href="http://www.google.com">Google!</a>
<span>Some more text goes here</span>
</tag1>
</xml>
and see if you can get it with Parser.tag1.span.getText()
<xml>
<tag1 class="class1">
<a href="http://www.google.com">Google!</a>
</tag1>
<tag1 class="text">
Some more text goes here
</tag1>
</xml>
"gonzotek" wrote:"joetesta" wrote:
It may be well formed XML and I may not have answered the question, but if you need this to happen now, I bet double or nothing my solution works.
Sure, if you have control over the server side. What if the XML is coming from some embedded device or other server you have no control over?
"EnTerr" wrote:
... Simplifying the BRS example even more:BrightScript Debugger> x = CreateObject("roXMLElement")genXML should have reconstituted (more or less) the original but seems Foo and Qux have been lost in translation. Even Foo, that should've been the getText() to <xml>. Bugs?
BrightScript Debugger> x.parse("<xml> foo <tag> bar </tag> qux </xml>")
BrightScript Debugger> ? x.genXML(false)
<xml><tag> bar </tag></xml>
<p><person>Tony Blair</person> is <function>Prime Minister</function> of <location><country>Great Britain</country></location></p>
We’re upgrading Roku Community to bring you a faster, more mobile-friendly experience. You may notice limited functionality or read-only access during this time. Read more here.
Planned Downtime:
Community will be unavailable for up to 24–48 hours during the upgrade window during the week of May 12, or you may notice reduced functionality.
In the meantime, for additional assistance, visit our Support Site.
Thanks for your patience — we’re excited to share what’s next!