public Namespace getNamespace()

in sources/java-incremental-compilation/jvm-inc-builder/src/com/intellij/tools/build/bazel/org/jdom/Element.java [322:360]


  public Namespace getNamespace(final String prefix) {
    if (prefix == null) {
      return null;
    }

    if (NS_PREFIX_XML.equals(prefix)) {
      // Namespace "xml" is always bound.
      return Namespace.XML_NAMESPACE;
    }

    // Check if the prefix is the prefix for this element
    if (prefix.equals(getNamespacePrefix())) {
      return getNamespace();
    }

    // Scan the additional namespaces
    if (additionalNamespaces != null) {
      for (final Namespace ns : additionalNamespaces) {
        if (prefix.equals(ns.getPrefix())) {
          return ns;
        }
      }
    }

    if (attributes != null) {
      for (final Attribute a : attributes) {
        if (prefix.equals(a.getNamespacePrefix())) {
          return a.getNamespace();
        }
      }
    }

    // If we still don't have a match, ask the parent
    if (parent instanceof Element) {
      return ((Element)parent).getNamespace(prefix);
    }

    return null;
  }