|
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 |
Methods inherited from interface org.w3c.dom.Node |
cloneNode, getAttributes, getChildNodes, getFirstChild, getLastChild, getNextSibling, getNodeValue, getOwnerDocument, getParentNode, getPreviousSibling, hasChildNodes, setNodeValue |
Constructor Detail |
public DocumentImpl(org.w3c.dom.DocumentType docType)
public DocumentImpl()
Method Detail |
public org.w3c.dom.Node cloneNode()
cloneNode
in class NodeImpl
protected short[] getAllowableChildrenTypes()
getAllowableChildrenTypes
in class NodeImpl
com.beasys.commerce.util.dom.NodeImpl
public short getNodeType()
getNodeType
in interface org.w3c.dom.Node
getNodeType
in class NodeImpl
public java.lang.String getNodeName()
getNodeName
in interface org.w3c.dom.Node
getNodeName
in class NodeImpl
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.
appendChild
in interface org.w3c.dom.Node
appendChild
in class NodeImpl
child
- the child to append.org.w3c.dom.DOMException
- thrown if the child cannot be added.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.
insertBefore
in interface org.w3c.dom.Node
insertBefore
in class NodeImpl
newChild
- the child to insert.refChild
- the child to insert before.org.w3c.dom.DOMException
- thrown if the child cannot be added.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.
removeChild
in interface org.w3c.dom.Node
removeChild
in class NodeImpl
child
- the child to remove.org.w3c.dom.DOMException
- thrown if the child cannot be removed.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.
replaceChild
in interface org.w3c.dom.Node
replaceChild
in class NodeImpl
newChild
- the new child.oldChild
- the child to replace.org.w3c.dom.DOMException
- thrown if the child cannot be replaced.public org.w3c.dom.Attr createAttribute(java.lang.String name)
createAttribute
in interface org.w3c.dom.Document
name
- the attribute name.AttrImpl
public org.w3c.dom.CDATASection createCDATASection(java.lang.String data)
createCDATASection
in interface org.w3c.dom.Document
data
- the character data.CDATASectionImpl
public org.w3c.dom.Comment createComment(java.lang.String data)
createComment
in interface org.w3c.dom.Document
data
- the character data.CommentImpl
public org.w3c.dom.DocumentFragment createDocumentFragment()
createDocumentFragment
in interface org.w3c.dom.Document
DocumentFragmentImpl
public org.w3c.dom.Element createElement(java.lang.String tagName)
createElement
in interface org.w3c.dom.Document
tagName
- the tagName.ElementImpl
public org.w3c.dom.EntityReference createEntityReference(java.lang.String name)
createEntityReference
in interface org.w3c.dom.Document
name
- the name of the entity to reference.EntityReference
public org.w3c.dom.ProcessingInstruction createProcessingInstruction(java.lang.String target, java.lang.String data)
createProcessingInstruction
in interface org.w3c.dom.Document
target
- the target of the PI.data
- the data of the PI.ProcessingInstruction
public org.w3c.dom.Text createTextNode(java.lang.String data)
createTextNode
in interface org.w3c.dom.Document
data
- the text.Text
public org.w3c.dom.DocumentType getDoctype()
getDoctype
in interface org.w3c.dom.Document
public org.w3c.dom.Element getDocumentElement()
getDocumentElement
in interface org.w3c.dom.Document
public org.w3c.dom.NodeList getElementsByTagName(java.lang.String tagName)
getElementsByTagName
in interface org.w3c.dom.Document
public org.w3c.dom.DOMImplementation getImplementation()
getImplementation
in interface org.w3c.dom.Document
public boolean hasFeature(java.lang.String feature, java.lang.String version)
This implementation only supports XML v1.0.
hasFeature
in interface org.w3c.dom.DOMImplementation
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 |