我正在使用import org.jdom在java中编写应用程序.*;
我的XML有效,但有时它包含HTML标记.例如,像这样:
<program-title>Anatomy & Physiology</program-title>
<overview>
<content>
For more info click <a href="page.html">here</a>
<p>Learn more about the human body. Choose from a variety of Physiology (A&P) designed for complementary therapies.&#160; Online studies options are available.</p>
</content>
</overview>
<key-information>
<category>Health & Human Services</category>
Run Code Online (Sandbox Code Playgroud)
所以我的问题是overview.content节点内的<p>标签.
我希望这段代码可行:
Element overview = sds.getChild("overview");
Element content = overview.getChild("content");
System.out.println(content.getText());
Run Code Online (Sandbox Code Playgroud)
但它返回空白.
如何从overview.content节点返回所有文本(嵌套标签和所有文本)?
谢谢