List<String> result = new ArrayList<String>();
for (Node node : nodes)
{
if (node instanceof HasText)
{
HasText textNode = (HasText) node;
String text = textNode.getText(whitespaceHandling);
result.add(text);
}
}
return result.toArray(new String[] {});
}