Class XMLAttributesImpl.EmptyXMLAttributesImpl

java.lang.Object
org.htmlunit.cyberneko.xerces.util.XMLAttributesImpl
org.htmlunit.cyberneko.xerces.util.XMLAttributesImpl.EmptyXMLAttributesImpl
All Implemented Interfaces:
XMLAttributes, Attributes, Attributes2
Enclosing class:
XMLAttributesImpl

public static final class XMLAttributesImpl.EmptyXMLAttributesImpl extends XMLAttributesImpl
An immutable, empty XMLAttributesImpl used as a flyweight for synthesized elements. Any attempt to mutate it throws UnsupportedOperationException so that accidental downstream mutations are caught loudly rather than silently corrupting a shared instance.
  • Field Details

  • Method Details

    • addAttribute

      public int addAttribute(QName name, String type, String value)
      Description copied from class: XMLAttributesImpl
      Adds an attribute. The attribute's non-normalized value of the attribute will have the same value as the attribute value. Also, the added attribute will be marked as specified in the XML instance document unless set otherwise using the setSpecified method.

      Note: This implementation does not check whether an attribute of the same name already exists. If duplicate prevention is required, the caller must verify uniqueness before calling this method.

      Specified by:
      addAttribute in interface XMLAttributes
      Overrides:
      addAttribute in class XMLAttributesImpl
      Parameters:
      name - The attribute name.
      type - The attribute type. The type name is determined by the type specified for this attribute in the DTD. For example: "CDATA", "ID", "NMTOKEN", etc. However, attributes of type enumeration will have the type value specified as the pipe ('|') separated list of the enumeration values prefixed by an open parenthesis and suffixed by a close parenthesis. For example: "(true|false)".
      value - The attribute value.
      Returns:
      Returns the attribute index.
      See Also:
    • addAttribute

      public void addAttribute(QName name, String type, String value, boolean specified)
      Description copied from class: XMLAttributesImpl
      Adds an attribute. The attribute's non-normalized value of the attribute will have the same value as the attribute value. Also, the added attribute will be marked as specified in the XML instance document unless set otherwise using the setSpecified method.

      This method differs from addAttribute in that it does not check if an attribute of the same name already exists in the list before adding it. In order to improve performance of namespace processing, this method allows uniqueness checks to be deferred until all the namespace information is available after the entire attribute specification has been read.

      Caution: If this method is called it should not be mixed with calls to addAttribute unless it has been determined that all the attribute names are unique.

      Overrides:
      addAttribute in class XMLAttributesImpl
      Parameters:
      name - the attribute name
      type - the attribute type
      value - the attribute value
      specified - the specified attribute value
    • addAttribute

      public void addAttribute(QName name, String type, String value, String nonNormalizedValue, boolean specified)
      Description copied from class: XMLAttributesImpl
      Adds an attribute together with its non-normalized (plain) value.

      This variant stores both the normalized value and the original nonNormalizedValue so that downstream consumers can access the raw attribute text via XMLAttributesImpl.getNonNormalizedValue(int).

      Like the other addAttribute overloads, this method does not check for duplicate attribute names.

      Overrides:
      addAttribute in class XMLAttributesImpl
      Parameters:
      name - the attribute name
      type - the attribute type (e.g. "CDATA")
      value - the normalized attribute value
      nonNormalizedValue - the original, non-normalized attribute value
      specified - true if the attribute was specified in the instance document
    • removeAllAttributes

      public void removeAllAttributes()
      Description copied from class: XMLAttributesImpl
      Removes all of the attributes. This method will also remove all entities associated to the attributes.
      Specified by:
      removeAllAttributes in interface XMLAttributes
      Overrides:
      removeAllAttributes in class XMLAttributesImpl
    • removeAttributeAt

      public void removeAttributeAt(int i)
      Description copied from class: XMLAttributesImpl
      Removes the attribute at the specified index.

      Note: This operation changes the indexes of all attributes following the attribute at the specified index.

      Specified by:
      removeAttributeAt in interface XMLAttributes
      Overrides:
      removeAttributeAt in class XMLAttributesImpl
      Parameters:
      i - The attribute index.
    • setName

      public void setName(int i, QName q)
      Description copied from class: XMLAttributesImpl
      Sets the name of the attribute at the specified index.
      Specified by:
      setName in interface XMLAttributes
      Overrides:
      setName in class XMLAttributesImpl
      Parameters:
      i - The attribute index.
      q - The new attribute name.
    • setValue

      public void setValue(int i, String v)
      Description copied from class: XMLAttributesImpl
      Sets the value of the attribute at the specified index. This method will overwrite the non-normalized value of the attribute.
      Specified by:
      setValue in interface XMLAttributes
      Overrides:
      setValue in class XMLAttributesImpl
      Parameters:
      i - The attribute index.
      v - The new attribute value.
    • setSpecified

      public void setSpecified(int i, boolean s)
      Description copied from class: XMLAttributesImpl
      Sets whether an attribute is specified in the instance document or not.
      Specified by:
      setSpecified in interface XMLAttributes
      Overrides:
      setSpecified in class XMLAttributesImpl
      Parameters:
      i - The attribute index.
      s - True if the attribute is specified in the instance document.