Java XML Node Namespace getNamespaceUri(Node node)

Here you can find the source of getNamespaceUri(Node node)

Description

Get the namespace URI of a given node.

License

Apache License

Parameter

Parameter Description
node The node to get the namespace URI of.

Return

The namespace URI, or the null namespace URI if the node has none.

Declaration

public static String getNamespaceUri(Node node) 

Method Source Code

//package com.java2s;
// Licensed under the Apache License, Version 2.0 (the "License");

import org.w3c.dom.Node;

import javax.xml.XMLConstants;

public class Main {
    /**//from   www .ja va 2  s  . c o m
     * Get the namespace URI of a given node.
     *
     * @param node The node to get the namespace URI of.
     * @return The namespace URI, or the null namespace URI if the node has none.
     */
    public static String getNamespaceUri(Node node) {
        String namespace = node.getNamespaceURI();
        return (namespace != null) ? namespace : XMLConstants.NULL_NS_URI;
    }
}

Related

  1. getNamespaces(Node node, Map list)
  2. getNamespaceURI(@Nullable final Node aNode)
  3. getNamespaceURI(final org.w3c.dom.Node n, final String prefix)
  4. getNamespaceURI(Node node)
  5. getNamespaceURI(Node node)
  6. getNameSpaceUri(Node node, String content, String namespaceURI)
  7. getNamespaceURI(Node node, String searchPrefix)
  8. getNodeName(Node node, NamespaceContext namespaceContext)
  9. getNodeString(Node node, NamespaceContext context)