Java Reference
In-Depth Information
Methods (continued)
Method Name
Description
Introduced
createComment(data)
Returns a new Comment object
with the specifi ed data.
Level 1
createCDATASection(data)
Returns a new CDATASection
object whose value is the speci-
fi ed data.
Level 1
createDocumentFragment()
Returns an empty
DocumentFragment object.
Level 1
createElement(tagName)
Returns a new Element object
with the specifi ed tag name.
Level 1
createElementNS(namespaceURI,
qualifiedName)
Returns an element of the
specifi ed qualifi ed name and
namespace URI. Not for
HTML DOMs.
Level 2
createTextNode(text)
Returns a new Text object con-
taining the specifi ed text.
Level 1
getElementById(elementId)
Returns the Element with the
specifi ed ID value. Returns null
if the element does not exist.
Level 2
getElementsByTagName(tagName)
Returns a NodeList of all
Element objects with the specifi ed
tag name in the order in which
they appear in the DOM tree.
Level 1
getElementsByTagNameNS(namespaceURI,
localName)
Returns a NodeList of all ele-
ments with the specifi ed local
name and namespace URI.
Elements returned are in the
order they appear in the DOM.
Level 2
importNode(importedNode, deep)
Imports a node from another
document. The source node is
not altered or removed from its
document. A copy of the source
is created. If deep is true , all
child nodes of the imported node
are imported. If false , only the
node is imported.
Level 2
DocumentFragment
The DocumentFragment object is a lightweight Document object. Its primary purpose is effi ciency.
Making many changes to the DOM tree, such as appending several nodes individually, is an expensive
Search WWH ::




Custom Search