Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
/*
 Copyright (c) 2013 eBay, Inc.
 This program is licensed under the terms of the eBay Common Development and
 Distribution License (CDDL) Version 1.0 (the "License") and any subsequent  version 
 thereof released by eBay.  The then-current version of the License can be found 
 at http://www.opensource.org/licenses/cddl1.php and in the eBaySDKLicense file that 
 is under the eBay SDK ../docs directory.
 */

import org.w3c.dom.Element;

import org.w3c.dom.Node;
import org.w3c.dom.NodeList;

public class Main {
    /**
     *
     * @param element Element
     * @param namespace String
     * @param childName String
     * @return String
     */
    public static String getChildStringNS(Element element, String namespace, String childName) {
        NodeList nodes = element.getElementsByTagNameNS(namespace, childName);
        if (nodes.getLength() > 0) {
            Node fnd = nodes.item(0).getFirstChild();
            if (fnd != null)
                return fnd.getNodeValue();
        }
        return "";
    }
}