i just checked how this will be done in Python - it would be to ask for the
.tail of the
<a> element, like so:
>>> 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 '
Simplifying the BRS example even more:
BrightScript Debugger> x = CreateObject("roXMLElement")
BrightScript Debugger> x.parse("<xml> foo <tag> bar </tag> qux </xml>")
BrightScript Debugger> ? x.genXML(false)
<xml><tag> bar </tag></xml>
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?
PS. in
sample python libraries, "foo" will be made .text to <xml/>, "qux" is .tail to <tag/>, all is preserved/accessible.
PPS. i can think of alternative representation too, in which <xml/> will have 3 children, [0] being the string "foo" (or element with empty getName and "foo" as getText), then [1] is <tag> as usual, [2] the "qux" text (string or another empty tag). Then ifXMLElement.getText() will have to be clarified to "returns
the first text contained in the element". This is less hacky and more to the spirit of xml but likely requires more changes in parser and may surprise some existing BRS code that is very stuck up on the sequence list it gets from getChildElements().