marți, 16 iunie 2015

[OmniFaces utilities 2.1] Return the trimmed text content of given node


[OmniFaces utilities] The getTextContent() method returns the trimmed text content of given node. This uses the getFirstChild().getNodeValue() instead of getTextContent() to workaround some buggy JAXP implementations.

Method:
Usage:

We just loop the NodeList provided via the welcomeFileList (please see Xml#getNodeList()):

import org.omnifaces.util.Xml;
...
for (int i = 0; i < welcomeFileList.getLength(); i++) {
     String content = Xml.getTextContent(welcomeFileList.item(i));
     // do something with the content
}

Niciun comentariu:

Trimiteți un comentariu