java.lang.Object
org.tquadrat.foundation.xml.builder.spi.NamespaceSupport
Direct Known Subclasses:
AttributeSupport

@ClassVersion(sourceVersion="$Id: NamespaceSupport.java 980 2022-01-06 15:29:19Z tquadrat $") @API(status=MAINTAINED, since="0.0.5") public sealed class NamespaceSupport extends Object permits AttributeSupport

This class provides the support for namespaces to elements.

Elements that also do support attributes should use AttributeSupport instead; that includes support for namespaces. In fact, that class extends this one.

Author:
Thomas Thrien (thomas.thrien@tquadrat.org)
Version:
$Id: NamespaceSupport.java 980 2022-01-06 15:29:19Z tquadrat $
Since:
0.0.5
UML Diagram
UML Diagram for "org.tquadrat.foundation.xml.builder.spi.NamespaceSupport"

UML Diagram for "org.tquadrat.foundation.xml.builder.spi.NamespaceSupport"

UML Diagram for "org.tquadrat.foundation.xml.builder.spi.NamespaceSupport"
  • Field Details

  • Constructor Details

    • NamespaceSupport

      public NamespaceSupport(Element owner)
      Creates a new NamespaceSupport instance.
      Parameters:
      owner - The element that owns this NamespaceSupport instance.
  • Method Details

    • getNamespaces

      Provides access to the namespaces for this element; the returned collection is not modifiable.
      Returns:
      A reference the children of this element; if the element does not have children, an empty collection will be returned.
    • getOwner

      protected final Element getOwner()
      Returns the reference to the owner of this instance of NamespaceSupport.
      Returns:
      The owner.
    • setNamespace

      public final void setNamespace(Namespace... namespace)
      Sets the given namespace.
      Parameters:
      namespace - The namespace.
    • setNamespace

      public final void setNamespace(URI identifier)
      Sets the given namespace.
      Parameters:
      identifier - The namespace identifier.
    • setNamespace

      public final void setNamespace(String identifier) throws URISyntaxException
      Sets the given namespace.
      Parameters:
      identifier - The namespace identifier.
      Throws:
      URISyntaxException - The provided URI String is invalid.
    • setNamespace

      public final void setNamespace(String prefix, URI identifier)
      Sets the given namespace.

      The given prefix is validated using the method that is provided by XMLBuilderUtils.getPrefixValidator().
      Parameters:
      prefix - The namespace prefix.
      identifier - The namespace identifier.
    • setNamespace

      public final void setNamespace(String prefix, String identifier) throws URISyntaxException
      Sets the given namespace.

      The given prefix is validated using the method that is provided by XMLBuilderUtils.getPrefixValidator().
      Parameters:
      prefix - The namespace prefix.
      identifier - The namespace identifier.
      Throws:
      URISyntaxException - The provided URI String is invalid.
    • toString

      @MountPoint public String toString(int indentationLevel, boolean prettyPrint)
      Returns the namespaces as a single formatted string.
      Parameters:
      indentationLevel - The indentation level.
      prettyPrint - The pretty print flag.
      Returns:
      The attributes string.