java获取smil文件中某级节点下一级元素的值

/**
* 获取smil文件中某级节点下一级元素的值<br>
*
* @param node
*            节点对象
* @param subTagName
*            subTagName元素的标签名
* @return String 该标记元素的的内容
*/
public static String getSubTagValue(Node node, String subTagName) {
String returnString = "";
if ((node != null) && (subTagName != null)) {
NodeList children = node.getChildNodes();

for (int innerLoop = 0; innerLoop < children.getLength(); innerLoop++) {
Node child = children.item(innerLoop);

if ((child != null) && (child.getNodeName() != null)
&& (child.getNodeName().equals(subTagName))) {
Node grandChild = child.getFirstChild();
if (grandChild != null) {
return grandChild.getNodeValue();
}
}
}
}
return returnString;
}

你可能感兴趣的:(java)