Returns normalized text content for XML node. - Java XML

Java examples for XML:DOM Node

Description

Returns normalized text content for XML node.

Demo Code


//package com.java2s;
import org.w3c.dom.*;

public class Main {
    /**//  w  w  w.  j a v a  2 s . c  o  m
     * Returns normalized text content for a node.
     * @param node
     * @return text content of child node, trimmed
     */
    public static String getTextContent(Node node) {
        return node.getTextContent().trim();
    }
}

Related Tutorials