我有以下 XML 和 Xpath 代码.. 使用 node.getContent() 我得到了完整 SUID 元素的字符串返回.. 获取每个元素并使用 recid、suid、group 构造新对象的最佳方法是什么
谢谢!
</newticket>
<suid>
<recid>8848DC1650664B0294B194B1D6F61AA0</recid>
<suid>RST40024</suid>
<grouplink_recid>C66A8FF92F0F4CE9825A4C42ADDBF09A</grouplink_recid>
</suid>
<suid>
<recid>AF12C557C9DD4EA087155CC263204668</recid>
<suid>uiuyiitest</suid>
<grouplink_recid>C66A8FF92F0F4CE9825A4C42ADDBF09A</grouplink_recid>
</suid>
</account>
</newticket>
XPathExpression escalationIdXpath = xpath.compile("//newticket/account/suid");
NodeList idNodes = (NodeList) escalationIdXpath.evaluate(doc.getDocumentElement(), XPathConstants.NODESET);
Node node;
String escalationId;
Element urlElem;
for (int i = 0; i < idNodes.getLength(); i++) {
SuidType suid = new SuidType();
node = idNodes.item(i);
fulltext= node.getTextContent();
System.out.println(fulltext);
}