Java XML Node Text Value getStrElementValue(Node node)

Here you can find the source of getStrElementValue(Node node)

Description

get Str Element Value

License

Open Source License

Parameter

Parameter Description
node node

Return

String ret string

Declaration

public static String getStrElementValue(Node node) 

Method Source Code


//package com.java2s;
/*//from   ww w .j  av  a 2 s .co m
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
 *
 * Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved.
 *
 * The contents of this file are subject to the terms of the Common 
 * Development and Distribution License ("CDDL")(the "License"). You 
 * may not use this file except in compliance with the License.
 *
 * You can obtain a copy of the License at
 * https://open-dm-mi.dev.java.net/cddl.html
 * or open-dm-mi/bootstrap/legal/license.txt. See the License for the 
 * specific language governing permissions and limitations under the  
 * License.  
 *
 * When distributing the Covered Code, include this CDDL Header Notice 
 * in each file and include the License file at
 * open-dm-mi/bootstrap/legal/license.txt.
 * If applicable, add the following below this CDDL Header, with the 
 * fields enclosed by brackets [] replaced by your own identifying 
 * information: "Portions Copyrighted [year] [name of copyright owner]"
 */

import org.w3c.dom.Node;

public class Main {
    /**
     * @param node node
     * @return String ret string
     */
    public static String getStrElementValue(Node node) {
        Node tnode = node.getFirstChild();

        if (null != tnode) {
            return tnode.getNodeValue();
        } else {
            return "";
        }
    }
}

Related

  1. getPropText(Node node)
  2. getRawContent(Node n)
  3. getSimpleElementText(final Node node)
  4. getSimpleNodeValue(Node node)
  5. getSingleNodeTextContent(Node node, String path)
  6. getString(final Node node, final String default_value)
  7. getString(Node node)
  8. getStringValue(NamedNodeMap values, String name)
  9. getStringValue(Node node)