|
BEA Systems, Inc. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.beasys.commerce.util.dom.DOMBase | +--com.beasys.commerce.util.dom.NodeImpl | +--com.beasys.commerce.util.dom.DocumentImpl
An implementation of the W3C's DOM Document object.
Although we store the DocType and the root Element in instance variables, we also store them as children. Therefore, this will override the adding children methods to guarentee that the instance variables are also set. I'm also assuming that a document can only have 1 DocumentType child, as well as only 1 Element child.
Fields inherited from interface org.w3c.dom.Node |
ATTRIBUTE_NODE,
CDATA_SECTION_NODE,
COMMENT_NODE,
DOCUMENT_FRAGMENT_NODE,
DOCUMENT_NODE,
DOCUMENT_TYPE_NODE,
ELEMENT_NODE,
ENTITY_NODE,
ENTITY_REFERENCE_NODE,
NOTATION_NODE,
PROCESSING_INSTRUCTION_NODE,
TEXT_NODE |
Constructor Summary | |
DocumentImpl()
Constructor. |
|
DocumentImpl(org.w3c.dom.DocumentType docType)
Constructor. |
Method Summary | |
org.w3c.dom.Node |
appendChild(org.w3c.dom.Node child)
Override to check if the new node is an element or document-type. |
org.w3c.dom.Node |
cloneNode()
Clone this node. |
org.w3c.dom.Attr |
createAttribute(java.lang.String name)
Create an Attribute. |
org.w3c.dom.CDATASection |
createCDATASection(java.lang.String data)
Create a CDATASection. |
org.w3c.dom.Comment |
createComment(java.lang.String data)
Create a Comment. |
org.w3c.dom.DocumentFragment |
createDocumentFragment()
Create a DocumentFragment. |
org.w3c.dom.Element |
createElement(java.lang.String tagName)
Create an Element. |
org.w3c.dom.EntityReference |
createEntityReference(java.lang.String name)
Create an EntityReference. |
org.w3c.dom.ProcessingInstruction |
createProcessingInstruction(java.lang.String target,
java.lang.String data)
Create a ProcessingInstruction. |
org.w3c.dom.Text |
createTextNode(java.lang.String data)
Create a Text node. |
protected short[] |
getAllowableChildrenTypes()
Get the allowable children types. |
org.w3c.dom.DocumentType |
getDoctype()
Get the DocType of the document. |
org.w3c.dom.Element |
getDocumentElement()
Get the document element. |
static org.w3c.dom.NodeList |
getElementsByTagName(org.w3c.dom.Node node,
java.lang.String tagName)
Get a NodeList of all Elements under a node with the given tag name. |
static void |
getElementsByTagName(org.w3c.dom.Node node,
java.lang.String tagName,
java.util.Vector list)
Get all the Elements under a node with the given tag name and put them into the specified Vector. |
org.w3c.dom.NodeList |
getElementsByTagName(java.lang.String tagName)
Find all the children Elements with the given tagName. |
org.w3c.dom.DOMImplementation |
getImplementation()
Get the DOMImplementation object. |
static java.util.Vector |
getNodeListVector(org.w3c.dom.NodeList list)
Get a copy of a NodeList as a Vector. |
java.lang.String |
getNodeName()
Return #document. |
short |
getNodeType()
Return Node.DOCUMENT_NODE. |
boolean |
hasFeature(java.lang.String feature,
java.lang.String version)
Tests if the DOM implementation implements a specific feature. |
org.w3c.dom.Node |
insertBefore(org.w3c.dom.Node newChild,
org.w3c.dom.Node refChild)
Override to check if the new node is an element or document-type. |
static void |
normalize(org.w3c.dom.Node node)
Normalize (tree-recursive) any adjacent Text nodes under the supplied node. |
org.w3c.dom.Node |
removeChild(org.w3c.dom.Node child)
Override to check if the new node is an element or document-type. |
org.w3c.dom.Node |
replaceChild(org.w3c.dom.Node newChild,
org.w3c.dom.Node oldChild)
Override to check if the new node is an element or document-type. |
Methods inherited from class com.beasys.commerce.util.dom.NodeImpl |
allowsChildren,
appendChildren,
checkAllowChild,
cloneNode,
getAttributes,
getChildNodes,
getFirstChild,
getLastChild,
getNextSibling,
getNodeType,
getNodeValue,
getParentNode,
getPreviousSibling,
hasChildNodes,
insertChildrenBefore,
isAncestor,
setNodeValue,
setParentNode |
Methods inherited from class com.beasys.commerce.util.dom.DOMBase |
checkOwnerDocument,
checkReadOnly,
getOwnerDocument,
isReadOnly,
setReadOnly |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public DocumentImpl(org.w3c.dom.DocumentType docType)
public DocumentImpl()
Method Detail |
public org.w3c.dom.Node cloneNode()
protected short[] getAllowableChildrenTypes()
public short getNodeType()
public java.lang.String getNodeName()
public org.w3c.dom.Node appendChild(org.w3c.dom.Node child) throws org.w3c.dom.DOMException
If the new node is an Element, we will remove the previous documentElement, and then set documentElement to the new Element. Similarily, if the new node is a DocumentType, we will remove the previous docType, and then set docType to tne new DocumentType.
child
- the child to append.public org.w3c.dom.Node insertBefore(org.w3c.dom.Node newChild, org.w3c.dom.Node refChild) throws org.w3c.dom.DOMException
If the new node is an Element, we will remove the previous documentElement, and then set documentElement to the new Element. Similarily, if the new node is a DocumentType, we will remove the previous docType, and then set docType to tne new DocumentType.
newChild
- the child to insert.refChild
- the child to insert before.public org.w3c.dom.Node removeChild(org.w3c.dom.Node child) throws org.w3c.dom.DOMException
If the removed child was our documentElement, we will clear our documentElement. If the remove child was our docType, we will clear our docType.
child
- the child to remove.public org.w3c.dom.Node replaceChild(org.w3c.dom.Node newChild, org.w3c.dom.Node oldChild) throws org.w3c.dom.DOMException
If the oldChild was our documentElement: if the newChild is an Element, we will set documentElement to it; otherwise, we will clear documentElement. If the oldChild was our docType: if the newChild is a docType, we will set docType to it; otherwise, we will clear docType.
newChild
- the new child.oldChild
- the child to replace.public org.w3c.dom.Attr createAttribute(java.lang.String name)
name
- the attribute name.AttrImpl
public org.w3c.dom.CDATASection createCDATASection(java.lang.String data)
data
- the character data.CDATASectionImpl
public org.w3c.dom.Comment createComment(java.lang.String data)
data
- the character data.CommentImpl
public org.w3c.dom.DocumentFragment createDocumentFragment()
DocumentFragmentImpl
public org.w3c.dom.Element createElement(java.lang.String tagName)
tagName
- the tagName.ElementImpl
public org.w3c.dom.EntityReference createEntityReference(java.lang.String name)
name
- the name of the entity to reference.EntityReference
public org.w3c.dom.ProcessingInstruction createProcessingInstruction(java.lang.String target, java.lang.String data)
target
- the target of the PI.data
- the data of the PI.ProcessingInstruction
public org.w3c.dom.Text createTextNode(java.lang.String data)
data
- the text.Text
public org.w3c.dom.DocumentType getDoctype()
public org.w3c.dom.Element getDocumentElement()
public org.w3c.dom.NodeList getElementsByTagName(java.lang.String tagName)
public org.w3c.dom.DOMImplementation getImplementation()
public boolean hasFeature(java.lang.String feature, java.lang.String version)
This implementation only supports XML v1.0.
public static org.w3c.dom.NodeList getElementsByTagName(org.w3c.dom.Node node, java.lang.String tagName)
getElementsByTagName(java.lang.String)
,
ElementImpl.getElementsByTagName(java.lang.String)
public static void getElementsByTagName(org.w3c.dom.Node node, java.lang.String tagName, java.util.Vector list)
public static java.util.Vector getNodeListVector(org.w3c.dom.NodeList list)
public static void normalize(org.w3c.dom.Node node)
|
BEA Systems, Inc. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |