Class XMLAttributesImpl.EmptyXMLAttributesImpl
- All Implemented Interfaces:
XMLAttributes,Attributes,Attributes2
- Enclosing class:
- XMLAttributesImpl
XMLAttributesImpl used as a flyweight for
synthesized elements. Any attempt to mutate it throws
UnsupportedOperationException so that accidental downstream
modifications fail fast.-
Nested Class Summary
Nested classes/interfaces inherited from class org.htmlunit.cyberneko.xerces.util.XMLAttributesImpl
XMLAttributesImpl.Attribute, XMLAttributesImpl.EmptyXMLAttributesImpl -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final XMLAttributesImpl.EmptyXMLAttributesImplShared singleton instance. -
Method Summary
Modifier and TypeMethodDescriptionintaddAttribute(QName name, String type, String value) Adds an attribute.voidaddAttribute(QName name, String type, String value, boolean specified) Adds an attribute.voidaddAttribute(QName name, String type, String value, String nonNormalizedValue, boolean specified) Adds an attribute together with its non-normalized (plain) value.voidRemoves all attributes from the collection.voidremoveAttributeAt(int i) Removes the attribute at the specified index.voidSets the name of the attribute at the specified index.voidsetSpecified(int i, boolean s) Sets whether an attribute was specified in the instance document.voidSets the value of the attribute at the specified index.Methods inherited from class org.htmlunit.cyberneko.xerces.util.XMLAttributesImpl
getAttributes, getIndex, getIndex, getLength, getLocalName, getName, getName, getNameRawName, getNonNormalizedValue, getQName, getType, getType, getType, getURI, getValue, getValue, getValue, isDeclared, isDeclared, isDeclared, isSpecified, isSpecified, isSpecified
-
Field Details
-
INSTANCE
Shared singleton instance.
-
-
Method Details
-
addAttribute
Description copied from class:XMLAttributesImplAdds 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 theXMLAttributesImpl.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:
addAttributein interfaceXMLAttributes- Overrides:
addAttributein classXMLAttributesImpl- Parameters:
name- the attribute nametype- 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
Description copied from class:XMLAttributesImplAdds 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 theXMLAttributesImpl.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
addAttributecalls unless it has been determined that all attribute names are unique.- Overrides:
addAttributein classXMLAttributesImpl- Parameters:
name- the attribute nametype- the attribute typevalue- the attribute valuespecified-trueif 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:XMLAttributesImplAdds an attribute together with its non-normalized (plain) value.This variant stores both the normalized
valueand the originalnonNormalizedValueso that downstream consumers can access the raw attribute text viaXMLAttributesImpl.getNonNormalizedValue(int).Like other
addAttributeoverloads, this method does not check for duplicate attribute names.- Overrides:
addAttributein classXMLAttributesImpl- Parameters:
name- the attribute nametype- the attribute type (e.g., "CDATA")value- the normalized attribute valuenonNormalizedValue- the original, non-normalized attribute valuespecified-trueif the attribute was specified in the instance document
-
removeAllAttributes
public void removeAllAttributes()Description copied from class:XMLAttributesImplRemoves all attributes from the collection. This method also removes all entities associated with the attributes.- Specified by:
removeAllAttributesin interfaceXMLAttributes- Overrides:
removeAllAttributesin classXMLAttributesImpl
-
removeAttributeAt
public void removeAttributeAt(int i) Description copied from class:XMLAttributesImplRemoves the attribute at the specified index.Note: This operation shifts the indices of all attributes following the specified index.
- Specified by:
removeAttributeAtin interfaceXMLAttributes- Overrides:
removeAttributeAtin classXMLAttributesImpl- Parameters:
i- the zero-based attribute index
-
setName
Description copied from class:XMLAttributesImplSets the name of the attribute at the specified index.- Specified by:
setNamein interfaceXMLAttributes- Overrides:
setNamein classXMLAttributesImpl- Parameters:
i- the zero-based attribute indexq- the new attribute name
-
setValue
Description copied from class:XMLAttributesImplSets the value of the attribute at the specified index. This method also overwrites the non-normalized value of the attribute.- Specified by:
setValuein interfaceXMLAttributes- Overrides:
setValuein classXMLAttributesImpl- Parameters:
i- the zero-based attribute indexv- the new attribute value
-
setSpecified
public void setSpecified(int i, boolean s) Description copied from class:XMLAttributesImplSets whether an attribute was specified in the instance document.- Specified by:
setSpecifiedin interfaceXMLAttributes- Overrides:
setSpecifiedin classXMLAttributesImpl- Parameters:
i- the zero-based attribute indexs-trueif the attribute is specified in the instance document
-