Here you can find the source of getNodeValue(Node node)
Parameter | Description |
---|---|
node | node which value is to be returned |
public static String getNodeValue(Node node)
//package com.java2s; /*//www . j a v a2 s . c o m * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" * which accompanies this distribution, and is available * at the URL "http://www.eclipse.org/legal/epl-v10.html". * * Initial Contributors: * Nokia Corporation - initial contribution. * * Contributors: * * Description: * */ import org.w3c.dom.*; public class Main { /** * Returns the value of given node * @param node node which value is to be returned * @return the value of given node */ public static String getNodeValue(Node node) { String retval = ""; try { Node firstChild = node.getFirstChild(); if (firstChild != null) retval = firstChild.getNodeValue(); } catch (Exception e) { return ""; } return retval; } }