Here you can find the source of getTextContent(final Node node, final String defaultValue)
Parameter | Description |
---|---|
node | can be <code>null</code> |
defaultValue | the value to return if the node is <code>null</code> |
null
public static String getTextContent(final Node node, final String defaultValue)
//package com.java2s; //License from project: Open Source License import org.w3c.dom.Node; public class Main { /**//from w w w. ja va2 s . c om * Returns the text content of the given {@link Node}, null safe. * * @param node can be <code>null</code> * @param defaultValue the value to return if the node is <code>null</code> * @return the given default value if the node is <code>null</code> * @see Node#getTextContent() * @since 1.2.0 */ public static String getTextContent(final Node node, final String defaultValue) { if (node == null) { return defaultValue; } return node.getTextContent(); } }