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.Document;

import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;

public class Main {
    public static String getNamespaceURI(final Document doc, final String ns) {
        NamedNodeMap attr = doc.getDocumentElement().getAttributes();
        for (int i = 0; i < attr.getLength(); i++) {
            Node attrNode = attr.item(i);
            if (attrNode.getNodeName().indexOf(ns) != -1) {
                return (attrNode.getNodeValue());
            }
        }
        return null;
    }
}