Here you can find the source of getChildElement(Node start, String name)
Parameter | Description |
---|---|
start | __UNDOCUMENTED__ |
name | __UNDOCUMENTED__ |
public static Element getChildElement(Node start, String name)
//package com.java2s; /*//from w w w . j ava 2 s.com * Copyright (c) 2012. betterFORM Project - http://www.betterform.de * Licensed under the terms of BSD License */ import org.w3c.dom.*; public class Main { /** * __UNDOCUMENTED__ * * @param start __UNDOCUMENTED__ * @param name __UNDOCUMENTED__ * @return __UNDOCUMENTED__ */ public static Element getChildElement(Node start, String name) { // NodeList nl=start.getChildNodes(); NodeList nl = null; if (start.getNodeType() == Node.DOCUMENT_NODE) { nl = ((Document) start).getDocumentElement().getChildNodes(); } else { nl = start.getChildNodes(); } int len = nl.getLength(); Node n = null; for (int i = 0; i < len; i++) { n = nl.item(i); if (n.getNodeType() == Node.ELEMENT_NODE) { if (n.getNodeName().equals(name)) { return (Element) n; } } } return null; } }