|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.xerces.dom.NodeImpl
org.apache.xerces.dom.ChildNode
org.apache.xerces.dom.ParentNode
org.apache.xerces.dom.CoreDocumentImpl
org.apache.xerces.dom.DocumentImpl
org.apache.html.dom.HTMLDocumentImpl
Implements an HTML document. Provides access to the top level element in the document, its body and title.
Several methods create new nodes of all basic types (comment, text, element,
etc.). These methods create new nodes but do not place them in the document
tree. The nodes may be placed in the document tree using Node.appendChild(org.w3c.dom.Node)
or Node.insertBefore(org.w3c.dom.Node, org.w3c.dom.Node)
, or
they may be placed in some other document tree.
Note: <FRAMESET> documents are not supported at the moment, neither
are direct document writing (open()
, write(java.lang.String)
) and HTTP attribute
methods (getURL()
, getCookie()
).
HTMLDocument
,
Serialized Form
Field Summary |
Fields inherited from class org.apache.xerces.dom.DocumentImpl |
eventListeners, iterators, mutationEvents, ranges |
Fields inherited from class org.apache.xerces.dom.CoreDocumentImpl |
actualEncoding, allowGrammarAccess, changes, docElement, docType, encoding, errorChecking, fDocumentURI, identifiers, standalone, userData, version, xmlVersionChanged |
Fields inherited from class org.apache.xerces.dom.ParentNode |
firstChild, fNodeListCache, ownerDocument |
Fields inherited from class org.apache.xerces.dom.ChildNode |
nextSibling, previousSibling |
Fields inherited from class org.apache.xerces.dom.NodeImpl |
DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_IS_CONTAINED, DOCUMENT_POSITION_PRECEDING, ELEMENT_DEFINITION_NODE, FIRSTCHILD, flags, HASSTRING, ID, IGNORABLEWS, NORMALIZED, OWNED, ownerNode, READONLY, SPECIFIED, SYNCCHILDREN, SYNCDATA, TREE_POSITION_ANCESTOR, TREE_POSITION_DESCENDANT, TREE_POSITION_DISCONNECTED, TREE_POSITION_EQUIVALENT, TREE_POSITION_FOLLOWING, TREE_POSITION_PRECEDING, TREE_POSITION_SAME_NODE |
Fields inherited from interface org.w3c.dom.Node |
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_POSITION_CONTAINED_BY, DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_PRECEDING, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE |
Constructor Summary | |
HTMLDocumentImpl()
|
Method Summary | |
org.w3c.dom.Node |
cloneNode(boolean deep)
Returns a duplicate of this node, i.e., serves as a generic copy constructor for nodes. |
void |
close()
Closes a document stream opened by open() and forces
rendering. |
org.w3c.dom.Attr |
createAttribute(java.lang.String name)
Creates an Attribute having this Document as its OwnerDoc. |
org.w3c.dom.Element |
createElement(java.lang.String tagName)
Creates an element of the type specified. |
org.w3c.dom.Element |
createElementNS(java.lang.String namespaceURI,
java.lang.String qualifiedName)
Creates an element of the given qualified name and namespace URI. |
org.w3c.dom.Element |
createElementNS(java.lang.String namespaceURI,
java.lang.String qualifiedName,
java.lang.String localpart)
Xerces-specific constructor. |
org.w3c.dom.html.HTMLCollection |
getAnchors()
A collection of all the anchor ( A ) elements in a document
with a value for the name attribute.Note. |
org.w3c.dom.html.HTMLCollection |
getApplets()
A collection of all the OBJECT elements that includeapplets
and APPLET (deprecated) elements ina document. |
org.w3c.dom.html.HTMLElement |
getBody()
The element that contains the content for the document. |
java.lang.String |
getCookie()
The cookies associated with this document. |
org.w3c.dom.Element |
getDocumentElement()
This is a convenience attribute that allows direct access to the child node that is the document element of the document. |
java.lang.String |
getDomain()
The domain name of the server that served the document, or a nullstring if the server cannot be identified by a domain name. |
org.w3c.dom.Element |
getElementById(java.lang.String elementId)
Returns the Element whose id is given by elementId. |
org.w3c.dom.NodeList |
getElementsByName(java.lang.String elementName)
Returns the (possibly empty) collection of elements whose name
value is given by elementName . |
org.w3c.dom.NodeList |
getElementsByTagName(java.lang.String tagName)
Returns a NodeList of all the Elements in
document order with a given tag name and are contained in the
document. |
org.w3c.dom.NodeList |
getElementsByTagNameNS(java.lang.String namespaceURI,
java.lang.String localName)
Returns a NodeList of all the Elements with a
given local name and namespace URI in document order. |
org.w3c.dom.html.HTMLCollection |
getForms()
A collection of all the forms of a document. |
org.w3c.dom.html.HTMLElement |
getHead()
Obtains the <HEAD> element in the document, creating one if does not exist before. |
org.w3c.dom.html.HTMLCollection |
getImages()
A collection of all the IMG elements in a document.The
behavior is limited to IMG elements forbackwards
compatibility. |
org.w3c.dom.html.HTMLCollection |
getLinks()
A collection of all AREA elements andanchor (A )
elements in a documentwith a value for the href attribute. |
java.lang.String |
getReferrer()
Returns the URI of the page that linked to this page. |
java.lang.String |
getTitle()
The title of a document as specified by the TITLE element in
the head of the document. |
java.lang.String |
getURL()
The complete URI of the document. |
void |
open()
Note.This method and the ones following allow a user to add to or replace the structuremodel of a document using strings of unparsed HTML. |
void |
setBody(org.w3c.dom.html.HTMLElement newBody)
|
void |
setCookie(java.lang.String cookie)
|
void |
setTitle(java.lang.String newTitle)
|
void |
write(java.lang.String text)
Write a string of text to a document stream opened by open() . |
void |
writeln(java.lang.String text)
Write a string of text followed by a newline character to a document stream opened by open() . |
Methods inherited from class org.apache.xerces.dom.DocumentImpl |
addEventListener, copyEventListeners, createEvent, createNodeIterator, createNodeIterator, createRange, createTreeWalker, createTreeWalker, dispatchAggregateEvents, dispatchAggregateEvents, dispatchEvent, dispatchEventToSubtree, dispatchingEventToSubtree, getEventListeners, getImplementation, removeEventListener, saveEnclosingAttr, setEventListeners |
Methods inherited from class org.apache.xerces.dom.CoreDocumentImpl |
abort, adoptNode, changed, changes, checkDOMNSErr, checkNamespaceWF, checkQName, clearIdentifiers, clone, cloneNode, createAttributeNS, createAttributeNS, createCDATASection, createComment, createDocumentFragment, createDocumentType, createElementDefinition, createEntity, createEntityReference, createNotation, createProcessingInstruction, createTextNode, getAsync, getBaseURI, getDoctype, getDocumentURI, getDomConfig, getEncoding, getErrorChecking, getFeature, getIdentifier, getIdentifiers, getInputEncoding, getNodeName, getNodeNumber, getNodeNumber, getNodeType, getOwnerDocument, getStandalone, getStrictErrorChecking, getTextContent, getUserData, getUserData, getUserDataRecord, getVersion, getXmlEncoding, getXmlStandalone, getXmlVersion, importNode, insertBefore, isKidOK, isValidQName, isXMLName, load, loadXML, normalizeDocument, putIdentifier, removeChild, removeIdentifier, renameNode, replaceChild, saveXML, setAsync, setDocumentURI, setEncoding, setErrorChecking, setInputEncoding, setStandalone, setStrictErrorChecking, setTextContent, setUserData, setUserData, setVersion, setXmlEncoding, setXmlStandalone, setXmlVersion, undeferChildren |
Methods inherited from class org.apache.xerces.dom.ParentNode |
getChildNodes, getChildNodesUnoptimized, getFirstChild, getLastChild, getLength, hasChildNodes, isEqualNode, item, normalize, setReadOnly, synchronizeChildren |
Methods inherited from class org.apache.xerces.dom.ChildNode |
getNextSibling, getParentNode, getPreviousSibling |
Methods inherited from class org.apache.xerces.dom.NodeImpl |
addEventListener, appendChild, compareDocumentPosition, compareTreePosition, dispatchEvent, getAttributes, getContainer, getLocalName, getNamespaceURI, getNodeValue, getPrefix, getReadOnly, getUserData, getUserData, getUserDataRecord, hasAttributes, isDefaultNamespace, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, needsSyncChildren, removeEventListener, setNodeValue, setPrefix, setUserData, setUserData, synchronizeData, toString |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.w3c.dom.Document |
adoptNode, createAttributeNS, createCDATASection, createComment, createDocumentFragment, createEntityReference, createProcessingInstruction, createTextNode, getDoctype, getDocumentURI, getDomConfig, getImplementation, getInputEncoding, getStrictErrorChecking, getXmlEncoding, getXmlStandalone, getXmlVersion, importNode, normalizeDocument, renameNode, setDocumentURI, setStrictErrorChecking, setXmlStandalone, setXmlVersion |
Methods inherited from interface org.w3c.dom.Node |
appendChild, compareDocumentPosition, getAttributes, getBaseURI, getChildNodes, getFeature, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, getTextContent, getUserData, hasAttributes, hasChildNodes, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, removeChild, replaceChild, setNodeValue, setPrefix, setTextContent, setUserData |
Constructor Detail |
public HTMLDocumentImpl()
Method Detail |
public org.w3c.dom.Element getDocumentElement()
org.w3c.dom.Document
getDocumentElement
in interface org.w3c.dom.Document
public org.w3c.dom.html.HTMLElement getHead()
getDocumentElement()
. If the element does not exist, one
is created.
Called by getTitle()
, setTitle(java.lang.String)
, getBody()
and
setBody(org.w3c.dom.html.HTMLElement)
to assure the document has the <HEAD> element
correctly placed.
public java.lang.String getTitle()
org.w3c.dom.html.HTMLDocument
TITLE
element in
the head of the document.
getTitle
in interface org.w3c.dom.html.HTMLDocument
public void setTitle(java.lang.String newTitle)
setTitle
in interface org.w3c.dom.html.HTMLDocument
public org.w3c.dom.html.HTMLElement getBody()
org.w3c.dom.html.HTMLDocument
BODY
contents, returns the BODY
element, and in
frameset documents, this returns the outermostFRAMESET
element.
getBody
in interface org.w3c.dom.html.HTMLDocument
public void setBody(org.w3c.dom.html.HTMLElement newBody)
setBody
in interface org.w3c.dom.html.HTMLDocument
public org.w3c.dom.Element getElementById(java.lang.String elementId)
org.w3c.dom.html.HTMLDocument
id
is given by elementId. If no
such element exists, returns null
. Behavior is not defined
if more than one element has this id
.
getElementById
in interface org.w3c.dom.html.HTMLDocument
CoreDocumentImpl.getIdentifier(java.lang.String)
public org.w3c.dom.NodeList getElementsByName(java.lang.String elementName)
org.w3c.dom.html.HTMLDocument
name
value is given by elementName
.
getElementsByName
in interface org.w3c.dom.html.HTMLDocument
elementName
- The name
attribute value for an element.
public final org.w3c.dom.NodeList getElementsByTagName(java.lang.String tagName)
org.w3c.dom.Document
NodeList
of all the Elements
in
document order with a given tag name and are contained in the
document.
getElementsByTagName
in interface org.w3c.dom.Document
tagName
- The type of Element we want to gather. "*" will be
taken as a wildcard, meaning "all elements in the document."DeepNodeListImpl
public final org.w3c.dom.NodeList getElementsByTagNameNS(java.lang.String namespaceURI, java.lang.String localName)
org.w3c.dom.Document
NodeList
of all the Elements
with a
given local name and namespace URI in document order.
getElementsByTagNameNS
in interface org.w3c.dom.Document
namespaceURI
- The namespace URI of the elements to match
on. The special value "*" matches all
namespaces. When it is null or an empty
string, this method behaves like
getElementsByTagName.localName
- The local name of the elements to match on.
The special value "*" matches all local names.
public org.w3c.dom.Element createElementNS(java.lang.String namespaceURI, java.lang.String qualifiedName, java.lang.String localpart) throws org.w3c.dom.DOMException
namespaceURI
- The namespace URI of the element to
create.qualifiedName
- The qualified name of the element type to
instantiate.localpart
- The local name of the attribute to instantiate.
org.w3c.dom.DOMException
- INVALID_CHARACTER_ERR: Raised if the specified
name contains an invalid character.public org.w3c.dom.Element createElementNS(java.lang.String namespaceURI, java.lang.String qualifiedName)
org.w3c.dom.Document
null
as the
namespaceURI parameter for methods if they wish to have no namespace.
createElementNS
in interface org.w3c.dom.Document
namespaceURI
- The namespace URI of the element to
create.qualifiedName
- The qualified name of the element type to
instantiate.
public org.w3c.dom.Element createElement(java.lang.String tagName) throws org.w3c.dom.DOMException
org.w3c.dom.Document
Element
interface, so attributes
can be specified directly on the returned object.
Attr
nodes representing them are automatically created
and attached to the element.
createElementNS
method.
createElement
in interface org.w3c.dom.Document
tagName
- The name of the element type to instantiate. For
XML, this is case-sensitive. For HTML, the tagName parameter may
be provided in any case, but it must be mapped to the canonical
uppercase form by the DOM implementation.
org.w3c.dom.DOMException
public org.w3c.dom.Attr createAttribute(java.lang.String name) throws org.w3c.dom.DOMException
CoreDocumentImpl.createAttribute(java.lang.String)
and returns
and attribute whose name is lower case.
createAttribute
in interface org.w3c.dom.Document
name
- The name of the attribute
DOMException(INVALID_NAME_ERR)
- if the attribute name
is not acceptable
org.w3c.dom.DOMException
public java.lang.String getReferrer()
org.w3c.dom.html.HTMLDocument
getReferrer
in interface org.w3c.dom.html.HTMLDocument
public java.lang.String getDomain()
org.w3c.dom.html.HTMLDocument
getDomain
in interface org.w3c.dom.html.HTMLDocument
public java.lang.String getURL()
org.w3c.dom.html.HTMLDocument
getURL
in interface org.w3c.dom.html.HTMLDocument
public java.lang.String getCookie()
org.w3c.dom.html.HTMLDocument
name=value;expires=date
.
getCookie
in interface org.w3c.dom.html.HTMLDocument
public void setCookie(java.lang.String cookie)
setCookie
in interface org.w3c.dom.html.HTMLDocument
public org.w3c.dom.html.HTMLCollection getImages()
org.w3c.dom.html.HTMLDocument
IMG
elements in a document.The
behavior is limited to IMG
elements forbackwards
compatibility.
getImages
in interface org.w3c.dom.html.HTMLDocument
public org.w3c.dom.html.HTMLCollection getApplets()
org.w3c.dom.html.HTMLDocument
OBJECT
elements that includeapplets
and APPLET
(deprecated) elements ina document.
getApplets
in interface org.w3c.dom.html.HTMLDocument
public org.w3c.dom.html.HTMLCollection getLinks()
org.w3c.dom.html.HTMLDocument
AREA
elements andanchor (A
)
elements in a documentwith a value for the href
attribute.
getLinks
in interface org.w3c.dom.html.HTMLDocument
public org.w3c.dom.html.HTMLCollection getForms()
org.w3c.dom.html.HTMLDocument
getForms
in interface org.w3c.dom.html.HTMLDocument
public org.w3c.dom.html.HTMLCollection getAnchors()
org.w3c.dom.html.HTMLDocument
A
) elements in a document
with a value for the name
attribute.Note. For reasons of
backwardscompatibility, the returned set of anchors only contains those
anchors created with the name
attribute, not those created
with the id
attribute.
getAnchors
in interface org.w3c.dom.html.HTMLDocument
public void open()
org.w3c.dom.html.HTMLDocument
open
in interface org.w3c.dom.html.HTMLDocument
public void close()
org.w3c.dom.html.HTMLDocument
open()
and forces
rendering.
close
in interface org.w3c.dom.html.HTMLDocument
public void write(java.lang.String text)
org.w3c.dom.html.HTMLDocument
open()
.
The text is parsed into the document's structuremodel.
write
in interface org.w3c.dom.html.HTMLDocument
text
- The string to be parsed into some structure in the document
structuremodel.public void writeln(java.lang.String text)
org.w3c.dom.html.HTMLDocument
open()
. The text is parsed into the
document's structure model.
writeln
in interface org.w3c.dom.html.HTMLDocument
text
- The string to be parsed into some structure in the document
structuremodel.public org.w3c.dom.Node cloneNode(boolean deep)
org.w3c.dom.Node
parentNode
is null
) and no user data. User
data associated to the imported node is not carried over. However, if
any UserDataHandlers
has been specified along with the
associated data these handlers will be called with the appropriate
parameters before this method returns.
Element
copies all attributes and their
values, including those generated by the XML processor to represent
defaulted attributes, but this method does not copy any children it
contains unless it is a deep clone. This includes text contained in
an the Element
since the text is contained in a child
Text
node. Cloning an Attr
directly, as
opposed to be cloned as part of an Element
cloning
operation, returns a specified attribute (specified
is
true
). Cloning an Attr
always clones its
children, since they represent its value, no matter whether this is a
deep clone or not. Cloning an EntityReference
automatically constructs its subtree if a corresponding
Entity
is available, no matter whether this is a deep
clone or not. Cloning any other type of node simply returns a copy of
this node.
EntityReference
clone are readonly
. In addition, clones of unspecified Attr
nodes are
specified. And, cloning Document
,
DocumentType
, Entity
, and
Notation
nodes is implementation dependent.
cloneNode
in interface org.w3c.dom.Node
deep
- boolean, iff true replicate children
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |