Class ExtAttributes

    • Constructor Detail

      • ExtAttributes

        public ExtAttributes()
        Creates a new empty ExtAttributes object.
      • ExtAttributes

        public ExtAttributes​(ExtAttributes original)
        Copy constructor.
        Parameters:
        original - the original object to duplicate.
    • Method Detail

      • getAttributeValue

        public String getAttributeValue​(String namespaceURI,
                                        String localName)
        Gets the value for a given attribute name of a given namespace.
        Parameters:
        namespaceURI - the namespace URI of the attribute.
        localName - the name of the attribute.
        Returns:
        the value (can be null), or null if not found.
      • getAttribute

        public ExtAttribute getAttribute​(String namespaceURI,
                                         String localName)
        Gets an attribute if it exists.
        Parameters:
        namespaceURI - the namespace URI of the attribute QName.
        localName - the local name of the attribute.
        Returns:
        the attribute or null.
      • setAttribute

        public ExtAttribute setAttribute​(ExtAttribute attribute)
        Sets a given attribute in this set. If an attribute with the same name and namespace URI already exists, the value of the existing one is replaced by the new one, but the attribute object itself is not changed.
        Parameters:
        attribute - the attribute to add/set.
        Returns:
        the set/added attribute (may be the attribute passed, or the existing one).
      • setAttribute

        public ExtAttribute setAttribute​(String namespaceURI,
                                         String localName,
                                         String value)
        Sets an attribute in this set. If an attribute with the same name and namespace URI already exists, the value of the existing one is replaced by the new one, but the attribute object itself is not changed.
        Parameters:
        namespaceURI - the namespace URI of the attribute.
        localName - the name of the attribute.
        value - the value of the attribute.
        Returns:
        the set/added attribute.
      • setAttribute

        public ExtAttribute setAttribute​(String localName,
                                         String value)
        Sets an attribute without namespace for this set. (this means the attribute will be part of the namespace of the element where it is defined).
        Parameters:
        localName - the name of the attribute.
        value - the value of the attribute.
        Returns:
        the new attribute.
      • deleteAttribute

        public void deleteAttribute​(String namespaceURI,
                                    String localName)
        Removes an attribute from this set. If the attribute is not found, nothing is done.
        Parameters:
        namespaceURI - the namespace URI of the attribute.
        localName - the name of the attribute.
      • isEmpty

        public boolean isEmpty()
        Indicates if this set is empty or not.
        Returns:
        true if this set is empty, false if not.
      • size

        public int size()
        Gets the number of attributes in this set.
        Returns:
        the number of attributes in this set.
      • setNamespace

        public void setNamespace​(String prefix,
                                 String namespaceURI)
        Sets a namespace in this set.
        Parameters:
        prefix - the namespace prefix.
        namespaceURI - the namsepace URI.
      • getNamespacePrefix

        public String getNamespacePrefix​(String namespaceURI)
        Gets the prefix for a given namespace URI.
        Parameters:
        namespaceURI - the namespace URI.
        Returns:
        the prefix for the given namespace URI, or null if not found.
      • hasNamespace

        public boolean hasNamespace()
        Indicates if this set has at least one namespace defined.
        Returns:
        true if this set has at least one namespace defined, false otherwise.
      • getNamespaces

        public Set<String> getNamespaces()
        Gets the set of keys for the namespaces in this object.
        Returns:
        the set of keys for the namespaces in this object.