Java XML Element Namespace getNamespace(Element element)

Here you can find the source of getNamespace(Element element)

Description

get Namespace

License

Apache License

Declaration

public static QName getNamespace(Element element) 

Method Source Code


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

import org.w3c.dom.*;

import javax.xml.namespace.QName;

public class Main {
    public static QName getNamespace(Element element) {
        String uri = element.getNamespaceURI();
        String prefix = element.getPrefix() == null ? "" : element.getPrefix();
        if (uri == null) {
            return new QName("");
        } else {// ww w .j av a 2  s.co m
            return new QName(uri, element.getLocalName(), prefix);
        }
    }
}

Related

  1. createElement(String namespaceURI, String name)
  2. createNamespace(Element el, String ns)
  3. getAllNamespaceDeclarations(Element element)
  4. getElementListNS(String namespace, Element element, String name)
  5. getElementNS(String namespace, Element element, String name)
  6. getNamespaceDeclarationOrNull(String localName, Element element)
  7. getNamespaceForPrefix(String prefix, Element element)
  8. getNamespaceURI(Element element, String prefix)
  9. getNamespaceUriDeclaration(Element ele)