public class AttrImpl extends NodeImpl implements OMAttribute, Attr
org.w3c.dom.Attr
and org.apache.axiom.om.OMAttribute
Modifier and Type | Field and Description |
---|---|
protected boolean |
isId
Flag used to mark an attribute as per the DOM Level 3 specification
|
protected ParentNode |
parent
Owner of this attribute
|
builder, done, factory, FIRSTCHILD, flags, NORMALIZED, OWNED, ownerNode, READONLY, SPECIFIED
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_POSITION_CONTAINED_BY, DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_PRECEDING, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
DTD_NODE, PI_NODE, SPACE_NODE
Modifier | Constructor and Description |
---|---|
protected |
AttrImpl(DocumentImpl ownerDocument,
OMFactory factory) |
|
AttrImpl(DocumentImpl ownerDocument,
String name,
OMFactory factory) |
|
AttrImpl(DocumentImpl ownerDocument,
String localName,
OMNamespace namespace,
OMFactory factory) |
|
AttrImpl(DocumentImpl ownerDocument,
String localName,
OMNamespace ns,
String value,
OMFactory factory) |
|
AttrImpl(DocumentImpl ownerDocument,
String name,
String value,
OMFactory factory) |
Modifier and Type | Method and Description |
---|---|
Node |
cloneNode(boolean deep) |
OMNode |
detach()
Not supported: Cannot detach attributes.
|
void |
discard()
Not supported: Cannot discard attributes.
|
boolean |
equals(Object obj)
An instance of
AttrImpl can act as an OMAttribute and as well as an
org.w3c.dom.Attr . |
String |
getAttributeType()
Returns the attribute value.
|
String |
getAttributeValue()
Returns the attribute value.
|
String |
getLocalName()
Returns the attribute name.
|
String |
getName() |
OMNamespace |
getNamespace()
Returns the namespace of the attribute as an
OMNamespace . |
String |
getNamespaceURI()
Returns the namespace URI of this attr node.
|
String |
getNodeName()
Returns the name of this attribute.
|
short |
getNodeType()
Returns the node type.
|
String |
getNodeValue()
Returns the value of this attribute.
|
OMElement |
getOwner()
Returns the owner element of this attribute
|
Element |
getOwnerElement()
Returns the owner element.
|
OMContainer |
getParent()
Returns the parent node of this attribute.
|
String |
getPrefix()
Returns the namespace prefix of this attr node.
|
QName |
getQName()
Returns a qname representing the attribute.
|
TypeInfo |
getSchemaTypeInfo() |
boolean |
getSpecified() |
int |
getType()
Returns the type of this attribute node.
|
String |
getValue()
Returns the value of this attribute.
|
int |
hashCode() |
void |
internalSerialize(javax.xml.stream.XMLStreamWriter writer,
boolean cache)
This is not supported since attributes serialization is handled by the serialization of the
owner nodes.
|
boolean |
isId() |
protected boolean |
isUsed() |
void |
setAttributeType(String attrType)
Sets the attribute value.
|
void |
setAttributeValue(String value)
Sets the attribute value.
|
void |
setLocalName(String localName)
Sets the name of attribute.
|
void |
setOMNamespace(OMNamespace omNamespace)
Sets the namespace of this attribute node.
|
void |
setParent(OMContainer element)
Sets the parent element to the given OMContainer.
|
void |
setType(int nodeType)
Sets the type.
|
protected void |
setUsed(boolean used) |
void |
setValue(String value)
Sets the value of the attribute.
|
String |
toString() |
appendChild, build, buildWithAttachments, close, compareDocumentPosition, getAttributes, getBaseURI, getChildNodes, getFeature, getFirstChild, getLastChild, getLength, getNextOMSibling, getNextOMSiblingIfAvailable, getNextSibling, getOMFactory, getOwnerDocument, getParentNode, getPreviousOMSibling, getPreviousSibling, getTextContent, getUserData, hasAttributes, hasChildNodes, insertBefore, insertSiblingAfter, insertSiblingBefore, internalSerialize, internalSerializeAndConsume, isComplete, isDefaultNamespace, isEqualNode, isSameNode, isSupported, item, lookupNamespaceURI, lookupPrefix, normalize, removeChild, replaceChild, serialize, serialize, serialize, serialize, serialize, serialize, serializeAndConsume, serializeAndConsume, serializeAndConsume, serializeAndConsume, serializeAndConsume, setComplete, setNextOMSibling, setNodeValue, setOwnerDocument, setPrefix, setPreviousOMSibling, setTextContent, setUserData
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getOMFactory
appendChild, compareDocumentPosition, getAttributes, getBaseURI, getChildNodes, getFeature, getFirstChild, getLastChild, getNextSibling, getOwnerDocument, getParentNode, getPreviousSibling, getTextContent, getUserData, hasAttributes, hasChildNodes, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, removeChild, replaceChild, setNodeValue, setPrefix, setTextContent, setUserData
protected ParentNode parent
protected boolean isId
protected AttrImpl(DocumentImpl ownerDocument, OMFactory factory)
public AttrImpl(DocumentImpl ownerDocument, String localName, OMNamespace ns, String value, OMFactory factory)
public AttrImpl(DocumentImpl ownerDocument, String name, String value, OMFactory factory)
public AttrImpl(DocumentImpl ownerDocument, String name, OMFactory factory)
public AttrImpl(DocumentImpl ownerDocument, String localName, OMNamespace namespace, OMFactory factory)
public String getNodeName()
getNodeName
in interface Node
public short getNodeType()
getNodeType
in interface Node
Node.getNodeType()
public String getNodeValue() throws DOMException
getNodeValue
in interface Node
getNodeValue
in class NodeImpl
DOMException
Node.getNodeValue()
public String getValue()
getValue
in interface Attr
Attr.getValue()
public Element getOwnerElement()
getOwnerElement
in interface Attr
Attr.getOwnerElement()
public boolean getSpecified()
getSpecified
in interface Attr
public OMNode detach() throws OMException
detach
in interface OMNode
detach
in class NodeImpl
OMException
- If a node is not complete, the detach can trigger further parsing, which may
cause an exception.OMNode.detach()
public void discard() throws OMException
discard
in interface OMNode
OMException
OMNode.discard()
public int getType()
getType
in interface OMNode
OMNode.ELEMENT_NODE
, OMNode.TEXT_NODE
, OMNode.CDATA_SECTION_NODE
,
OMNode.COMMENT_NODE
, OMNode.DTD_NODE
, OMNode.PI_NODE
, OMNode.ENTITY_REFERENCE_NODE
or OMNode.SPACE_NODE
.OMNode.getType()
public void internalSerialize(javax.xml.stream.XMLStreamWriter writer, boolean cache) throws javax.xml.stream.XMLStreamException
internalSerialize
in interface OMNodeEx
cache
- indicates if caching should be enabledjavax.xml.stream.XMLStreamException
public OMNamespace getNamespace()
OMNamespace
.getNamespace
in interface OMAttribute
OMAttribute.getNamespace()
public QName getQName()
getQName
in interface OMAttribute
OMAttribute.getQName()
public String getAttributeValue()
getAttributeValue
in interface OMAttribute
OMAttribute.getAttributeValue()
public String getAttributeType()
getAttributeType
in interface OMAttribute
OMAttribute.getAttributeType()
public void setLocalName(String localName)
setLocalName
in interface OMAttribute
OMAttribute.setLocalName(String)
public void setOMNamespace(OMNamespace omNamespace)
setOMNamespace
in interface OMAttribute
(org.apache.axiom.om.OMNamespace)
public void setAttributeValue(String value)
setAttributeValue
in interface OMAttribute
OMAttribute.setAttributeValue(String)
public void setAttributeType(String attrType)
setAttributeType
in interface OMAttribute
OMAttribute.setAttributeType(String)
public void setParent(OMContainer element)
setParent
in interface OMNodeEx
(org.apache.axiom.om.OMContainer)
public void setType(int nodeType) throws OMException
setType
in interface OMNodeEx
OMException
OMNodeEx.setType(int)
protected boolean isUsed()
protected void setUsed(boolean used)
used
- The used to set.public void setValue(String value) throws DOMException
setValue
in interface Attr
DOMException
Attr.setValue(String)
public OMContainer getParent()
getParent
in interface OMNode
getParent
in class NodeImpl
OMContainer
of the node.OMNode.getParent()
public String getLocalName()
getLocalName
in interface OMAttribute
getLocalName
in interface Node
getLocalName
in class NodeImpl
Node.getLocalName()
public String getNamespaceURI()
getNamespaceURI
in interface Node
getNamespaceURI
in class NodeImpl
Node.getNamespaceURI()
public String getPrefix()
getPrefix
in interface Node
getPrefix
in class NodeImpl
Node.getPrefix()
public Node cloneNode(boolean deep)
public TypeInfo getSchemaTypeInfo()
getSchemaTypeInfo
in interface Attr
public OMElement getOwner()
getOwner
in interface OMAttribute
public boolean equals(Object obj)
AttrImpl
can act as an OMAttribute
and as well as an
org.w3c.dom.Attr
. So we first check if the object to compare with (obj
)
is of type OMAttribute
(this includes instances of OMAttributeImpl
or
AttrImpl
(instances of this class)). If so we check for the equality
of namespaces first (note that if the namespace of this instance is null then for the obj
to be equal its namespace must also be null). This condition solely doesn't determine the equality.
So we check for the equality of names and values (note that the value can also be null in which case
the same argument holds as that for the namespace) of the two instances. If all three conditions are
met then we say the two instances are equal.
If obj
is of type org.w3c.dom.Attr
then we perform the same equality check
as before. Note that, however, the implementation of the test for equality in this case is little different
than before.
If obj
is neither of type OMAttribute
nor of type org.w3c.dom.Attr
then we return false.
Copyright © 2004-2013 The Apache Software Foundation. All Rights Reserved.