wlwest82
12 years agoVisitor
XML Orphaned Text
I'm having trouble getting some text out of parsed XML. For the most part, everything I need is visible as I walk through the xml, but in the following instance, I can't get to the text. Let's say I have an object Parser (type roXMLElement), and a string xml which contains the following:
After parsing this as Parser.Parse(xml), Parser.tag1@class would return "class1", Parser.tag1.a@href would return "http://www.google.com", and Parser.tag1.a.getText() would return "Google!". The problem I'm having is getting to the "Some more text goes here". I thought that using Parser.tag1.getText() would return that, but it's returning empty. Am I doing this correctly? Is there a way to get to that text?
<xml>
<tag1 class="class1">
<a href="http://www.google.com">Google!</a>
Some more text goes here
</tag1>
</xml>
After parsing this as Parser.Parse(xml), Parser.tag1@class would return "class1", Parser.tag1.a@href would return "http://www.google.com", and Parser.tag1.a.getText() would return "Google!". The problem I'm having is getting to the "Some more text goes here". I thought that using Parser.tag1.getText() would return that, but it's returning empty. Am I doing this correctly? Is there a way to get to that text?