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 modifications fail fast.
  • 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 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 XMLAttributesImpl.setSpecified(int, boolean) 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 (e.g., "CDATA", "ID", "NMTOKEN", etc.). Enumeration types will have the type value specified as a pipe-separated list enclosed in parentheses, for example: "(true|false)".
      value - the attribute value
      Returns:
      the zero-based 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 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 XMLAttributesImpl.setSpecified(int, boolean) method.

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

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

      Overrides:
      addAttribute in class XMLAttributesImpl
      Parameters:
      name - the attribute name
      type - the attribute type
      value - the attribute value
      specified - true if the attribute was specified in the instance document
    • 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 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 attributes from the collection. This method also removes all entities associated with 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 shifts the indices of all attributes following the specified index.

      Specified by:
      removeAttributeAt in interface XMLAttributes
      Overrides:
      removeAttributeAt in class XMLAttributesImpl
      Parameters:
      i - the zero-based 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 zero-based 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 also overwrites the non-normalized value of the attribute.
      Specified by:
      setValue in interface XMLAttributes
      Overrides:
      setValue in class XMLAttributesImpl
      Parameters:
      i - the zero-based attribute index
      v - the new attribute value
    • setSpecified

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