Java XML Node Sibiling containsSiblings(org.w3c.dom.Node node)

Here you can find the source of containsSiblings(org.w3c.dom.Node node)

Description

contains Siblings

License

Open Source License

Declaration

static boolean containsSiblings(org.w3c.dom.Node node) 

Method Source Code

//package com.java2s;
/*/*from  ww  w .jav  a2 s .  co m*/
 * Copyright (c) 2011 Miguel Ceriani
 * miguel.ceriani@gmail.com
    
 * This file is part of Semantic Web Open datatafloW System (SWOWS).
    
 * SWOWS is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of
 * the License, or (at your option) any later version.
    
 * SWOWS is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
    
 * You should have received a copy of the GNU Affero General
 * Public License along with SWOWS.  If not, see <http://www.gnu.org/licenses/>.
 */

import org.w3c.dom.NodeList;

public class Main {
    static boolean containsSiblings(org.w3c.dom.Node node) {
        NodeList childNodes = node.getChildNodes();
        if (childNodes != null)
            if (childNodes.getLength() > 1)
                return true;
            else if (containsSiblings(childNodes.item(0)))
                return true;
        return false;
    }
}

Related

  1. getFirstElementSibling(Node node)
  2. getFirstSiblingElmt(Node aNode)
  3. getFirstSiblingNamed(Node node, String name)
  4. getLocHomoSibling(Node aNode)