Class NamespaceResolver

java.lang.Object
eu.maveniverse.domtrip.NamespaceResolver

public class NamespaceResolver extends Object
Utility class for resolving namespace information in XML elements. Provides methods to resolve namespace URIs, prefixes, and build namespace contexts.
  • Method Details

    • resolveNamespaceURI

      public static String resolveNamespaceURI(Element element, String prefix)
      Resolves the namespace URI for a given prefix in the context of an element. Walks up the element tree to find namespace declarations.
    • resolvePrefix

      public static String resolvePrefix(Element element, String namespaceURI)
      Resolves a prefix for a given namespace URI in the context of an element. Returns the first prefix found that maps to the URI.
    • isNamespaceInScope

      public static boolean isNamespaceInScope(Element element, String namespaceURI)
      Checks if a namespace URI is in scope for the given element.
    • buildNamespaceContext

      public static NamespaceContext buildNamespaceContext(Element element)
      Builds a complete namespace context for the given element. Includes all namespace declarations from the element and its ancestors.
    • splitQualifiedName

      public static String[] splitQualifiedName(String qualifiedName)
      Splits a qualified name into prefix and local name parts. Returns an array where [0] is prefix (or null) and [1] is local name.
    • createQualifiedName

      public static String createQualifiedName(String prefix, String localName)
      Creates a qualified name from prefix and local name.