Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import org.w3c.dom.Element;

import org.w3c.dom.NodeList;

public class Main {
    /**
     * Gets the first child Element with a given name
     * 
     * @param n
     *            the node get the children from
     * @param namespace
     *            the namespace of the child element
     * @param elementName
     *            the name of the child elements
     * @return the first child Element with a given name
     */
    public static Element getElementByQualifiedName(Element n, String namespace, String elementName) {
        NodeList subNodes = n.getElementsByTagNameNS(namespace, elementName);
        int sz = subNodes.getLength();
        if (sz > 0)
            return (Element) subNodes.item(0);
        return null;
    }
}