public class HTMLDocumentImpl
extends org.apache.xerces.dom.DocumentImpl
implements org.w3c.dom.html.HTMLDocument
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 FormeventListeners, iteratorReferenceQueue, iterators, mutationEvents, rangeReferenceQueue, rangesactualEncoding, allowGrammarAccess, changes, docElement, docType, encoding, errorChecking, fDocumentURI, identifiers, standalone, userData, version, xmlVersionChangedfirstChild, fNodeListCache, ownerDocumentDOCUMENT_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_NODEATTRIBUTE_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 and Description |
|---|
HTMLDocumentImpl() |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
canRenameElements(java.lang.String newNamespaceURI,
java.lang.String newNodeName,
org.apache.xerces.dom.ElementImpl el) |
org.w3c.dom.Node |
cloneNode(boolean deep)
Deep-clone a document, including fixing ownerDoc for the cloned
children.
|
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)
Factory method; creates an Element having this Document
as its OwnerDoc.
|
org.w3c.dom.Element |
createElementNS(java.lang.String namespaceURI,
java.lang.String qualifiedName)
Introduced in DOM Level 2.
|
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()
Convenience method, allowing direct access to the child node
which is considered the root of the actual document content.
|
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)
Introduced in DOM Level 2
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)
Return a live collection of all descendent Elements (not just
immediate children) having the specified tag name.
|
org.w3c.dom.NodeList |
getElementsByTagNameNS(java.lang.String namespaceURI,
java.lang.String localName)
Introduced in DOM Level 2.
|
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
TITLEelement 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(). |
addEventListener, copyEventListeners, createEvent, createNodeIterator, createNodeIterator, createRange, createTreeWalker, createTreeWalker, dispatchAggregateEvents, dispatchAggregateEvents, dispatchEvent, dispatchEventToSubtree, dispatchingEventToSubtree, getEventListeners, getImplementation, removeEventListener, saveEnclosingAttr, setEventListenersabort, adoptNode, callUserDataHandlers, 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, undeferChildrengetChildNodes, getChildNodesUnoptimized, getFirstChild, getLastChild, getLength, hasChildNodes, isEqualNode, item, normalize, setOwnerDocument, setReadOnly, synchronizeChildrengetNextSibling, getParentNode, getPreviousSiblingaddEventListener, 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, toStringequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitadoptNode, createAttributeNS, createCDATASection, createComment, createDocumentFragment, createEntityReference, createProcessingInstruction, createTextNode, getDoctype, getDocumentURI, getDomConfig, getImplementation, getInputEncoding, getStrictErrorChecking, getXmlEncoding, getXmlStandalone, getXmlVersion, importNode, normalizeDocument, renameNode, setDocumentURI, setStrictErrorChecking, setXmlStandalone, setXmlVersionappendChild, 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, setUserDatapublic org.w3c.dom.Element getDocumentElement()
org.apache.xerces.dom.CoreDocumentImplgetDocumentElement in interface org.w3c.dom.DocumentgetDocumentElement in class org.apache.xerces.dom.CoreDocumentImplpublic 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.HTMLDocumentTITLEelement in
the head of the document.getTitle in interface org.w3c.dom.html.HTMLDocumentpublic void setTitle(java.lang.String newTitle)
setTitle in interface org.w3c.dom.html.HTMLDocumentpublic org.w3c.dom.html.HTMLElement getBody()
org.w3c.dom.html.HTMLDocumentBODY contents, returns the BODYelement, and in
frameset documents, this returns the outermostFRAMESET
element.getBody in interface org.w3c.dom.html.HTMLDocumentpublic void setBody(org.w3c.dom.html.HTMLElement newBody)
setBody in interface org.w3c.dom.html.HTMLDocumentpublic org.w3c.dom.Element getElementById(java.lang.String elementId)
org.apache.xerces.dom.CoreDocumentImplNote: The DOM implementation must have information that says which attributes are of type ID. Attributes with the name "ID" are not of type ID unless so defined. Implementations that do not know whether attributes are of type ID or not are expected to return null.
getElementById in interface org.w3c.dom.DocumentgetElementById in interface org.w3c.dom.html.HTMLDocumentgetElementById in class org.apache.xerces.dom.CoreDocumentImplelementId - The unique id value for an element.null if there is none.CoreDocumentImpl.getIdentifier(java.lang.String)public org.w3c.dom.NodeList getElementsByName(java.lang.String elementName)
org.w3c.dom.html.HTMLDocumentname
value is given by elementName.getElementsByName in interface org.w3c.dom.html.HTMLDocumentelementName - The name attribute value for an element.public final org.w3c.dom.NodeList getElementsByTagName(java.lang.String tagName)
org.apache.xerces.dom.CoreDocumentImplgetElementsByTagName in interface org.w3c.dom.DocumentgetElementsByTagName in class org.apache.xerces.dom.CoreDocumentImpltagName - The type of Element we want to gather. "*" will be
taken as a wildcard, meaning "all elements in the document."NodeList object containing all the matched
Elements.DeepNodeListImplpublic final org.w3c.dom.NodeList getElementsByTagNameNS(java.lang.String namespaceURI,
java.lang.String localName)
org.apache.xerces.dom.CoreDocumentImplReturns a NodeList of all the Elements with a given local name and namespace URI in the order in which they would be encountered in a preorder traversal of the Document tree.
getElementsByTagNameNS in interface org.w3c.dom.DocumentgetElementsByTagNameNS in class org.apache.xerces.dom.CoreDocumentImplnamespaceURI - 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
createElementNS in class org.apache.xerces.dom.CoreDocumentImplnamespaceURI - The namespace URI of the element to
create.qualifiedName - The qualified name of the element type to
instantiate.localpart - The local name of the element 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.apache.xerces.dom.CoreDocumentImplCreates an element of the given qualified name and namespace URI. If the given namespaceURI is null or an empty string and the qualifiedName has a prefix that is "xml", the created element is bound to the predefined namespace "http://www.w3.org/XML/1998/namespace" [Namespaces].
createElementNS in interface org.w3c.dom.DocumentcreateElementNS in class org.apache.xerces.dom.CoreDocumentImplnamespaceURI - 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.apache.xerces.dom.CoreDocumentImplcreateElement in interface org.w3c.dom.DocumentcreateElement in class org.apache.xerces.dom.CoreDocumentImpltagName - 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.Element object with the
nodeName attribute set to tagName, and
localName, prefix, and
namespaceURI set to null.org.w3c.dom.DOMException - INVALID_CHARACTER_ERR: Raised if the specified name is not an XML
name according to the XML version in use specified in the
Document.xmlVersion attribute.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.DocumentcreateAttribute in class org.apache.xerces.dom.CoreDocumentImplname - The name of the attributeDOMException(INVALID_NAME_ERR) - if the attribute name
is not acceptableorg.w3c.dom.DOMException - INVALID_CHARACTER_ERR: Raised if the specified name is not an XML
name according to the XML version in use specified in the
Document.xmlVersion attribute.public java.lang.String getReferrer()
org.w3c.dom.html.HTMLDocumentgetReferrer in interface org.w3c.dom.html.HTMLDocumentpublic java.lang.String getDomain()
org.w3c.dom.html.HTMLDocumentgetDomain in interface org.w3c.dom.html.HTMLDocumentpublic java.lang.String getURL()
org.w3c.dom.html.HTMLDocumentgetURL in interface org.w3c.dom.html.HTMLDocumentpublic java.lang.String getCookie()
org.w3c.dom.html.HTMLDocumentname=value;expires=date.getCookie in interface org.w3c.dom.html.HTMLDocumentpublic void setCookie(java.lang.String cookie)
setCookie in interface org.w3c.dom.html.HTMLDocumentpublic org.w3c.dom.html.HTMLCollection getImages()
org.w3c.dom.html.HTMLDocumentIMG elements in a document.The
behavior is limited to IMG elements forbackwards
compatibility.getImages in interface org.w3c.dom.html.HTMLDocumentpublic org.w3c.dom.html.HTMLCollection getApplets()
org.w3c.dom.html.HTMLDocumentOBJECT elements that includeapplets
and APPLET (deprecated) elements ina document.getApplets in interface org.w3c.dom.html.HTMLDocumentpublic org.w3c.dom.html.HTMLCollection getLinks()
org.w3c.dom.html.HTMLDocumentAREA elements andanchor (A)
elements in a documentwith a value for the href attribute.getLinks in interface org.w3c.dom.html.HTMLDocumentpublic org.w3c.dom.html.HTMLCollection getForms()
org.w3c.dom.html.HTMLDocumentgetForms in interface org.w3c.dom.html.HTMLDocumentpublic org.w3c.dom.html.HTMLCollection getAnchors()
org.w3c.dom.html.HTMLDocumentA) 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.HTMLDocumentpublic void open()
org.w3c.dom.html.HTMLDocumentopen in interface org.w3c.dom.html.HTMLDocumentpublic void close()
org.w3c.dom.html.HTMLDocumentopen()and forces
rendering.close in interface org.w3c.dom.html.HTMLDocumentpublic void write(java.lang.String text)
org.w3c.dom.html.HTMLDocumentopen().
The text is parsed into the document's structuremodel.write in interface org.w3c.dom.html.HTMLDocumenttext - The string to be parsed into some structure in the document
structuremodel.public void writeln(java.lang.String text)
org.w3c.dom.html.HTMLDocumentopen(). The text is parsed into the
document's structure model.writeln in interface org.w3c.dom.html.HTMLDocumenttext - The string to be parsed into some structure in the document
structuremodel.public org.w3c.dom.Node cloneNode(boolean deep)
org.apache.xerces.dom.DocumentImplcloneNode in interface org.w3c.dom.NodecloneNode in class org.apache.xerces.dom.DocumentImpldeep - boolean, iff true replicate children
Example: Cloning a Text node will copy both the node and the text it
contains.
Example: Cloning something that has children -- Element or Attr, for
example -- will _not_ clone those children unless a "deep clone"
has been requested. A shallow clone of an Attr node will yield an
empty Attr of the same name.
NOTE: Clones will always be read/write, even if the node being cloned
is read-only, to permit applications using only the DOM API to obtain
editable copies of locked portions of the tree.
protected boolean canRenameElements(java.lang.String newNamespaceURI,
java.lang.String newNodeName,
org.apache.xerces.dom.ElementImpl el)
canRenameElements in class org.apache.xerces.dom.CoreDocumentImplCopyright © 1999-2022 The Apache Software Foundation. All Rights Reserved.