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
mutations are caught loudly rather than silently corrupting a shared
instance.-
Nested Class Summary
Nested classes/interfaces inherited from class org.htmlunit.cyberneko.xerces.util.XMLAttributesImpl
XMLAttributesImpl.Attribute, XMLAttributesImpl.EmptyXMLAttributesImpl -
Field Summary
Fields -
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 of the attributes.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 is specified in the instance document or not.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
-
-
Method Details
-
addAttribute
Description copied from class:XMLAttributesImplAdds 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 thesetSpecifiedmethod.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 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
Description copied from class:XMLAttributesImplAdds 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 thesetSpecifiedmethod.This method differs from
addAttributein 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
addAttributeunless it has been determined that all the attribute names are unique.- Overrides:
addAttributein classXMLAttributesImpl- Parameters:
name- the attribute nametype- the attribute typevalue- the attribute valuespecified- the specified attribute value
-
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 the 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 of the attributes. This method will also remove all entities associated to 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 changes the indexes of all attributes following the attribute at the specified index.
- Specified by:
removeAttributeAtin interfaceXMLAttributes- Overrides:
removeAttributeAtin classXMLAttributesImpl- Parameters:
i- The 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 attribute index.q- The new attribute name.
-
setValue
Description copied from class:XMLAttributesImplSets the value of the attribute at the specified index. This method will overwrite the non-normalized value of the attribute.- Specified by:
setValuein interfaceXMLAttributes- Overrides:
setValuein classXMLAttributesImpl- Parameters:
i- The attribute index.v- The new attribute value.
-
setSpecified
public void setSpecified(int i, boolean s) Description copied from class:XMLAttributesImplSets whether an attribute is specified in the instance document or not.- Specified by:
setSpecifiedin interfaceXMLAttributes- Overrides:
setSpecifiedin classXMLAttributesImpl- Parameters:
i- The attribute index.s- True if the attribute is specified in the instance document.
-