org.apache.xerces.dom
public final class: DeferredAttrImpl [javadoc |
source]
java.lang.Object
org.apache.xerces.dom.NodeImpl
org.apache.xerces.dom.AttrImpl
org.apache.xerces.dom.DeferredAttrImpl
All Implemented Interfaces:
DeferredNode, TypeInfo, Attr, Cloneable, Node, EventTarget, Serializable, NodeList
Attribute represents an XML-style attribute of an
Element. Typically, the allowable values are controlled by its
declaration in the Document Type Definition (DTD) governing this
kind of document.
If the attribute has not been explicitly assigned a value, but has
been declared in the DTD, it will exist and have that default. Only
if neither the document nor the DTD specifies a value will the
Attribute really be considered absent and have no value; in that
case, querying the attribute will return null.
Attributes may have multiple children that contain their data. (XML
allows attributes to contain entity references, and tokenized
attribute types such as NMTOKENS may have a child for each token.)
For convenience, the Attribute object's getValue() method returns
the string version of the attribute's value.
Attributes are not children of the Elements they belong to, in the
usual sense, and have no valid Parent reference. However, the spec
says they _do_ belong to a specific Element, and an INUSE exception
is to be thrown if the user attempts to explicitly share them
between elements.
Note that Elements do not permit attributes to appear to be shared
(see the INUSE exception), so this object's mutability is
officially not an issue.
DeferredAttrImpl inherits from AttrImpl which does not support
Namespaces. DeferredAttrNSImpl, which inherits from AttrNSImpl, does.
Also see:
- DeferredAttrNSImpl
- xerces.internal:
- author:
Andy - Clark, IBM
- author:
Arnaud - Le Hors, IBM
- version:
$ - Id: DeferredAttrImpl.java 447266 2006-09-18 05:57:49Z mrglavas $
- since:
PR-DOM-Level-1-19980818. -
| Field Summary |
|---|
| static final long | serialVersionUID | Serialization version. |
| protected transient int | fNodeIndex | Node index. |
| Fields inherited from org.apache.xerces.dom.NodeImpl: |
|---|
| TREE_POSITION_PRECEDING, TREE_POSITION_FOLLOWING, TREE_POSITION_ANCESTOR, TREE_POSITION_DESCENDANT, TREE_POSITION_EQUIVALENT, TREE_POSITION_SAME_NODE, TREE_POSITION_DISCONNECTED, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_PRECEDING, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_IS_CONTAINED, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, serialVersionUID, ELEMENT_DEFINITION_NODE, ownerNode, flags, READONLY, SYNCDATA, SYNCCHILDREN, OWNED, FIRSTCHILD, SPECIFIED, IGNORABLEWS, HASSTRING, NORMALIZED, ID |
| Constructor: |
DeferredAttrImpl(DeferredDocumentImpl ownerDocument,
int nodeIndex) {
//
// Constructors
//
super(ownerDocument, null);
fNodeIndex = nodeIndex;
needsSyncData(true);
needsSyncChildren(true);
}
This is the deferred constructor. Only the fNodeIndex is given here.
All other data, can be requested from the ownerDocument via the index. |
| Methods from org.apache.xerces.dom.AttrImpl: |
|---|
|
checkNormalizationAfterInsert, checkNormalizationAfterRemove, cloneNode, getChildNodes, getElement, getFirstChild, getLastChild, getLength, getName, getNodeName, getNodeType, getNodeValue, getOwnerElement, getSchemaTypeInfo, getSpecified, getTypeName, getTypeNamespace, getValue, hasChildNodes, insertBefore, internalInsertBefore, internalRemoveChild, isDerivedFrom, isEqualNode, isId, item, lastChild, lastChild, makeChildNode, normalize, removeChild, rename, replaceChild, setIdAttribute, setNodeValue, setOwnerDocument, setReadOnly, setSpecified, setType, setValue, synchronizeChildren, toString |
| Methods from org.apache.xerces.dom.NodeImpl: |
|---|
|
addEventListener, appendChild, changed, changes, cloneNode, compareDocumentPosition, compareTreePosition, dispatchEvent, getAttributes, getBaseURI, getChildNodes, getContainer, getElementAncestor, getFeature, getFirstChild, getLastChild, getLength, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeNumber, getNodeType, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, getReadOnly, getTextContent, getTextContent, getUserData, getUserData, getUserDataRecord, hasAttributes, hasChildNodes, hasStringValue, hasStringValue, insertBefore, internalIsIgnorableWhitespace, isDefaultNamespace, isEqualNode, isFirstChild, isFirstChild, isIdAttribute, isIdAttribute, isIgnorableWhitespace, isNormalized, isNormalized, isOwned, isOwned, isReadOnly, isReadOnly, isSameNode, isSpecified, isSpecified, isSupported, item, lookupNamespacePrefix, lookupNamespaceURI, lookupPrefix, needsSyncChildren, needsSyncChildren, needsSyncData, needsSyncData, normalize, ownerDocument, parentNode, previousSibling, removeChild, removeEventListener, replaceChild, setNodeValue, setOwnerDocument, setPrefix, setReadOnly, setTextContent, setUserData, setUserData, synchronizeData, toString |
| Method from org.apache.xerces.dom.DeferredAttrImpl Detail: |
public int getNodeIndex() {
return fNodeIndex;
}
|
protected void synchronizeChildren() {
DeferredDocumentImpl ownerDocument =
(DeferredDocumentImpl) ownerDocument();
ownerDocument.synchronizeChildren(this, fNodeIndex);
}
Synchronizes the node's children with the internal structure.
Fluffing the children at once solves a lot of work to keep
the two structures in sync. The problem gets worse when
editing the tree -- this makes it a lot easier. |
protected void synchronizeData() {
// no need to sync in the future
needsSyncData(false);
// fluff data
DeferredDocumentImpl ownerDocument =
(DeferredDocumentImpl) ownerDocument();
name = ownerDocument.getNodeName(fNodeIndex);
int extra = ownerDocument.getNodeExtra(fNodeIndex);
isSpecified((extra & SPECIFIED) != 0);
isIdAttribute((extra & ID) != 0);
int extraNode = ownerDocument.getLastChild(fNodeIndex);
type = ownerDocument.getTypeInfo(extraNode);
}
Synchronizes the data (name and value) for fast nodes. |