如图所示,我如何才能获得指定ContentItem节点下child2节点下的标签及内容,及获得
<body>
<p>helloworld</p>
<input type='text'>
</body>
然后将这段作为String输出。
目前我操作节点获取节点内容使用的方法是:
Document doc = null;
DocumentBuilder db = null;
DocumentBuilderFactory dbf = null;
String xxx = null;
try{
dbf = DocumentBuilderFactory.newInstance();
dbf.setValidating(false);
db = dbf.newDocumentBuilder();
doc = db.parse(xmlFile);
xxx = doc.getELementByTagName("xxx").item(0).getTextContent()
}finally{
....
}