Class NamespaceBindings

java.lang.Object
org.jsoup.internal.NamespaceBindings

public final class NamespaceBindings extends Object
Tracks namespace prefix bindings across nested element scopes. Jsoup internal; API subject to change.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates an empty binding set.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Applies namespace declarations from an attribute set.
    void
    Clears all bindings and scopes for reuse.
    static @Nullable String
    declarationPrefix(String key)
    Returns the prefix declared by an xmlns key, or null if it is not a declaration.
    @Nullable String
    get(String prefix)
    Returns the namespace URI bound to a prefix, or null if unbound.
    static boolean
    isDeclaration(String key)
    Tests whether a key is an xmlns declaration.
    void
    Closes the current scope and restores its parent bindings.
    void
    Opens a namespace scope.
    void
    put(String prefix, String namespace)
    Binds a prefix in the current scope, or at the root if no scope is open.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • NamespaceBindings

      public NamespaceBindings()
      Creates an empty binding set.
  • Method Details

    • clear

      public void clear()
      Clears all bindings and scopes for reuse.
    • pushScope

      public void pushScope()
      Opens a namespace scope.
    • popScope

      public void popScope()
      Closes the current scope and restores its parent bindings.
    • put

      public void put(String prefix, String namespace)
      Binds a prefix in the current scope, or at the root if no scope is open.
    • get

      public @Nullable String get(String prefix)
      Returns the namespace URI bound to a prefix, or null if unbound.
    • applyDeclarations

      public void applyDeclarations(Attributes attributes)
      Applies namespace declarations from an attribute set.
    • isDeclaration

      public static boolean isDeclaration(String key)
      Tests whether a key is an xmlns declaration.
    • declarationPrefix

      public static @Nullable String declarationPrefix(String key)
      Returns the prefix declared by an xmlns key, or null if it is not a declaration.