回答編集履歴
1
コード修正
answer
CHANGED
@@ -39,9 +39,9 @@
|
|
39
39
|
|
40
40
|
static List<String> getTextContentList(Document document, String expression) throws XPathExpressionException {
|
41
41
|
XPathExpression expr = XPathFactory.newInstance().newXPath().compile(expression);
|
42
|
+
NodeList nodeList = (NodeList)expr.evaluate(document, XPathConstants.NODESET);
|
42
43
|
|
43
44
|
List<String> list = new ArrayList<>();
|
44
|
-
NodeList nodeList = (NodeList)expr.evaluate(document, XPathConstants.NODESET);
|
45
45
|
for(int i=0; i<nodeList.getLength(); i++) {
|
46
46
|
list.add(((Element)nodeList.item(i)).getTextContent());
|
47
47
|
}
|