Class BaseElement
- All Implemented Interfaces:
Serializable, Cloneable, Branch, Element, Node
- Direct Known Subclasses:
NonLazyElement
BaseElement is a useful base class for implemementation
inheritence of an XML element.
- Version:
- $Revision: 1.9 $
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionlist of attributesList of content nodes.private BranchStores the parent branch of this node which is either a Document if this element is the root element in a document, or another Element if it is a child of the root document, or null if it has not been added to a document yet.private QNameTheQNamefor this elementFields inherited from class AbstractElement
USE_STRINGVALUE_SEPARATOR, VERBOSE_TOSTRINGFields inherited from class AbstractBranch
DEFAULT_CONTENT_LIST_SIZEFields inherited from class AbstractNode
NODE_TYPE_NAMESFields inherited from interface Node
ANY_NODE, ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_NODE, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_REFERENCE_NODE, MAX_NODE_TYPE, NAMESPACE_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE, UNKNOWN_NODE -
Constructor Summary
ConstructorsConstructorDescriptionBaseElement(String name) BaseElement(String name, Namespace namespace) BaseElement(QName qname) -
Method Summary
Modifier and TypeMethodDescriptionDOCUMENT ME!attributeList(int size) DOCUMENT ME!voidClears the content for this branch, removing anyNodeinstances this branch may contain.DOCUMENT ME!getDocumentreturns theDocumentthat thisNodeis part of if this node supports the parent relationship.getParentreturns the parentElementif this node supports the parent relationship or null if it is the root element or does not support the parent relationship.getQName()Returns theQNameof this element which represents the local name, the qualified name and theNamespace.protected voidsetAttributeList(List<Attribute> attributeList) voidsetAttributes(List<Attribute> attributes) Sets the attributes that this element containsvoidsetContent(List<Node> content) Sets the contents of this branch as aListofNodeinstances.voidsetDocument(Document document) setDocumentsets the document of this node if the parent relationship is supported or does nothing if the parent relationship is not supported.voidsetParentsets the parent relationship of this node if the parent relationship is supported or does nothing if the parent relationship is not supported.voidSets theQNameof this element which represents the local name, the qualified name and theNamespace.booleansupportsParentreturns true if this node supports the parent relationship.Methods inherited from class AbstractElement
accept, add, add, add, add, add, add, add, add, add, addAttribute, addAttribute, addCDATA, addComment, addElement, addEntity, additionalNamespaces, additionalNamespaces, addNamespace, addNewNode, addNewNode, addNode, addNode, addProcessingInstruction, addProcessingInstruction, addText, appendAttributes, asXML, attribute, attribute, attribute, attribute, attributeCount, attributeIterator, attributes, attributeValue, attributeValue, attributeValue, attributeValue, childAdded, childRemoved, createAttributeList, createAttributeList, createCopy, createCopy, createCopy, createElement, createElement, createSingleIterator, declaredNamespaces, element, element, element, elementIterator, elementIterator, elementIterator, elementIterator, elements, elements, elements, elements, elementText, elementText, elementTextTrim, elementTextTrim, ensureAttributesCapacity, getData, getDocumentFactory, getName, getNamespace, getNamespaceForPrefix, getNamespaceForURI, getNamespacePrefix, getNamespacesForURI, getNamespaceURI, getNodeType, getPath, getQName, getQualifiedName, getStringValue, getUniquePath, getXPathNameStep, getXPathResult, hasMixedContent, indexOf, isRootElement, isTextOnly, node, nodeCount, nodeIterator, normalize, processingInstruction, processingInstructions, processingInstructions, remove, remove, remove, remove, remove, remove, remove, remove, remove, removeNode, removeProcessingInstruction, setAttributes, setAttributeValue, setAttributeValue, setData, setName, setNamespace, setText, toString, writeMethods inherited from class AbstractBranch
addElement, addElement, addElement, appendContent, content, contentRemoved, createContentList, createContentList, createEmptyList, createResultList, createSingleResultList, elementByID, elementID, getContentAsStringValue, getContentAsText, getText, getTextTrim, hasContent, invalidNodeTypeAddException, isReadOnly, setProcessingInstructionsMethods inherited from class AbstractNode
asXPathResult, clone, createPattern, createXPath, createXPathFilter, createXPathResult, detach, getNodeTypeName, getPath, getUniquePath, matches, numberValueOf, selectNodes, selectNodes, selectNodes, selectObject, selectSingleNode, valueOfMethods inherited from class Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Branch
addElement, addElement, appendContent, content, elementByID, setProcessingInstructionsMethods inherited from interface Element
getText, getTextTrimMethods inherited from interface Node
asXPathResult, clone, createXPath, detach, getNodeTypeName, getPath, getUniquePath, hasContent, isReadOnly, matches, numberValueOf, selectNodes, selectNodes, selectNodes, selectObject, selectSingleNode, valueOf
-
Field Details
-
qname
TheQNamefor this element -
parentBranch
Stores the parent branch of this node which is either a Document if this element is the root element in a document, or another Element if it is a child of the root document, or null if it has not been added to a document yet. -
-
attributes
-
-
Constructor Details
-
BaseElement
-
BaseElement
-
BaseElement
-
-
Method Details
-
getParent
Description copied from interface:NodegetParentreturns the parentElementif this node supports the parent relationship or null if it is the root element or does not support the parent relationship.This method is an optional feature and may not be supported for all
Nodeimplementations.- Specified by:
getParentin interfaceNode- Overrides:
getParentin classAbstractNode- Returns:
- the parent of this node or null if it is the root of the tree or the parent relationship is not supported.
-
setParent
Description copied from interface:NodesetParentsets the parent relationship of this node if the parent relationship is supported or does nothing if the parent relationship is not supported.This method should only be called from inside an
Elementimplementation method and is not intended for general use.- Specified by:
setParentin interfaceNode- Overrides:
setParentin classAbstractNode- Parameters:
parent- is the new parent of this node.
-
getDocument
Description copied from interface:NodegetDocumentreturns theDocumentthat thisNodeis part of if this node supports the parent relationship.This method is an optional feature and may not be supported for all
Nodeimplementations.- Specified by:
getDocumentin interfaceNode- Overrides:
getDocumentin classAbstractNode- Returns:
- the document of this node or null if this feature is not
supported or the node is not associated with a
Document
-
setDocument
Description copied from interface:NodesetDocumentsets the document of this node if the parent relationship is supported or does nothing if the parent relationship is not supported.This method should only be called from inside a
Documentimplementation method and is not intended for general use.- Specified by:
setDocumentin interfaceNode- Overrides:
setDocumentin classAbstractNode- Parameters:
document- is the new document of this node.
-
supportsParent
public boolean supportsParent()Description copied from interface:NodesupportsParentreturns true if this node supports the parent relationship.Some XML tree implementations are singly linked and only support downward navigation through children relationships. The default case is that both parent and children relationships are supported though for memory and performance reasons the parent relationship may not be supported.
- Specified by:
supportsParentin interfaceNode- Overrides:
supportsParentin classAbstractNode- Returns:
- true if this node supports the parent relationship or false it is not supported
-
getQName
-
setQName
-
clearContent
public void clearContent()Description copied from interface:BranchClears the content for this branch, removing anyNodeinstances this branch may contain. -
setContent
-
setAttributes
-
contentList
Description copied from class:AbstractBranchDOCUMENT ME!- Specified by:
contentListin classAbstractBranch- Returns:
- the internal List used to manage the content
-
attributeList
Description copied from class:AbstractElementDOCUMENT ME!- Specified by:
attributeListin classAbstractElement- Returns:
- the internal List used to store attributes or creates one if one is not available
-
attributeList
Description copied from class:AbstractElementDOCUMENT ME!- Specified by:
attributeListin classAbstractElement- Parameters:
size- DOCUMENT ME!- Returns:
- the internal List used to store attributes or creates one with the specified size if one is not available
-
setAttributeList
-