Here you can find the source of getLastNodeChild(Node node)
Parameter | Description |
---|---|
node | org.w3c.dom.Node The node |
public static Node getLastNodeChild(Node node)
//package com.java2s; /******************************************************************************* * Copyright (c) 2003, 2006 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors:/*from w w w . j a va 2 s .c om*/ * IBM Corporation - initial API and implementation *******************************************************************************/ import org.w3c.dom.Node; public class Main { /** * Get the last non-text child of a node. * * @return org.w3c.dom.Node The last non-text child node of * @node. * @param node * org.w3c.dom.Node The node */ public static Node getLastNodeChild(Node node) { if (node == null) return null; Node child = node.getLastChild(); while (child != null && child.getNodeType() == Node.TEXT_NODE) child = child.getPreviousSibling(); return child; } }