java.lang.Object | ||||
↳ | org.apache.xerces.dom.NodeImpl | |||
↳ | org.apache.xerces.dom.ChildNode | |||
↳ | org.apache.xerces.dom.ParentNode | |||
↳ | org.apache.xerces.dom.CoreDocumentImpl |
Known Direct Subclasses |
Known Indirect Subclasses |
The Document interface represents the entire HTML or XML document. Conceptually, it is the root of the document tree, and provides the primary access to the document's data.
Since elements, text nodes, comments, processing instructions, etc. cannot exist outside the context of a Document, the Document interface also contains the factory methods needed to create these objects. The Node objects created have a ownerDocument attribute which associates them with the Document within whose context they were created.
The CoreDocumentImpl class only implements the DOM Core. Additional modules are supported by the more complete DocumentImpl subclass.
Note: When any node in the document is serialized, the entire document is serialized along with it.
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.apache.xerces.dom.NodeImpl
| |||||||||||
From interface
org.w3c.dom.Node
|
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
actualEncoding | Experimental DOM Level 3 feature: Document actualEncoding | ||||||||||
allowGrammarAccess | Allow grammar access. | ||||||||||
changes | Number of alterations made to this document since its creation. | ||||||||||
docElement | Document element. | ||||||||||
docType | Document type. | ||||||||||
encoding | Experimental DOM Level 3 feature: Document encoding | ||||||||||
errorChecking | Bypass error checking. | ||||||||||
fDocumentURI | Experimental DOM Level 3 feature: documentURI | ||||||||||
identifiers | Identifiers. | ||||||||||
standalone | Experimental DOM Level 3 feature: Document standalone | ||||||||||
userData | Table for user data attached to this document nodes. | ||||||||||
version | Experimental DOM Level 3 feature: Document version | ||||||||||
xmlVersionChanged |
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.apache.xerces.dom.ParentNode
| |||||||||||
From class
org.apache.xerces.dom.ChildNode
| |||||||||||
From class
org.apache.xerces.dom.NodeImpl
|
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
NON-DOM: Actually creating a Document is outside the DOM's spec,
since it has to operate in terms of a particular implementation.
| |||||||||||
Constructor.
| |||||||||||
For DOM2 support.
| |||||||||||
For DOM2 support.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
DOM Level 3 WD - Experimental.
| |||||||||||
DOM Level 3 WD - Experimental
Change the node's ownerDocument, and its subtree, to this Document
| |||||||||||
Clone.
| |||||||||||
Deep-clone a document, including fixing ownerDoc for the cloned
children.
| |||||||||||
Factory method; creates an Attribute having this Document as its
OwnerDoc.
| |||||||||||
Introduced in DOM Level 2.
| |||||||||||
NON-DOM: a factory method used by the Xerces DOM parser
to create an element.
| |||||||||||
Factory method; creates a CDATASection having this Document as
its OwnerDoc.
| |||||||||||
Factory method; creates a Comment having this Document as its
OwnerDoc.
| |||||||||||
Factory method; creates a DocumentFragment having this Document
as its OwnerDoc.
| |||||||||||
NON-DOM
Factory method; creates a DocumentType having this Document
as its OwnerDoc.
| |||||||||||
Factory method; creates an Element having this Document
as its OwnerDoc.
| |||||||||||
NON-DOM Factory method: creates an element definition.
| |||||||||||
Introduced in DOM Level 2.
| |||||||||||
NON-DOM: a factory method used by the Xerces DOM parser
to create an element.
| |||||||||||
NON-DOM
Factory method; creates an Entity having this Document
as its OwnerDoc.
| |||||||||||
Factory method; creates an EntityReference having this Document
as its OwnerDoc.
| |||||||||||
NON-DOM
Factory method; creates a Notation having this Document
as its OwnerDoc.
| |||||||||||
Factory method; creates a ProcessingInstruction having this Document
as its OwnerDoc.
| |||||||||||
Factory method; creates a Text node having this Document as its
OwnerDoc.
| |||||||||||
DOM Level 3 WD - Experimental.
| |||||||||||
Returns the absolute base URI of this node or null if the implementation
wasn't able to obtain an absolute URI.
| |||||||||||
For XML, this provides access to the Document Type Definition.
| |||||||||||
Convenience method, allowing direct access to the child node
which is considered the root of the actual document content.
| |||||||||||
DOM Level 3 WD - Experimental.
| |||||||||||
DOM Level 3 CR - Experimental
The configuration used when
Document.normalizeDocument is
invoked. | |||||||||||
Introduced in DOM Level 2
Returns the Element whose ID is given by elementId.
| |||||||||||
Return a live collection of all descendent Elements (not just
immediate children) having the specified tag name.
| |||||||||||
Introduced in DOM Level 2.
| |||||||||||
This method is deprecated.
This method is internal and only exists for
compatibility with older applications. New applications
should never call this method.
| |||||||||||
Returns true if the DOM implementation performs error checking.
| |||||||||||
Returns a previously registered element with the specified
identifier name, or null if no element is registered.
| |||||||||||
Returns an enumeration registered of identifier names.
| |||||||||||
Retrieve information describing the abilities of this particular
DOM implementation.
| |||||||||||
DOM Level 3 CR - Experimental.
| |||||||||||
Returns the node name.
| |||||||||||
Returns the node type.
| |||||||||||
Find the Document that this Node belongs to (the document in
whose context the Node was created).
| |||||||||||
This method is deprecated.
This method is internal and only exists for
compatibility with older applications. New applications
should never call this method.
| |||||||||||
This attribute returns the text content of this node and its
descendants.
| |||||||||||
Retrieves the object associated to a key on a this node.
| |||||||||||
This method is deprecated.
This method is internal and only exists for
compatibility with older applications. New applications
should never call this method.
| |||||||||||
DOM Level 3 WD - Experimental.
| |||||||||||
DOM Level 3 WD - Experimental.
| |||||||||||
DOM Level 3 WD - Experimental.
| |||||||||||
Copies a node from another document to this document.
| |||||||||||
Since a Document may contain at most one top-level Element child,
and at most one DocumentType declaraction, we need to subclass our
add-children methods to implement this constraint.
| |||||||||||
Checks if the given qualified name is legal with respect
to the version of XML to which this document must conform.
| |||||||||||
Check the string against XML's definition of acceptable names for
elements and attributes and so on using the XMLCharacterProperties
utility class
| |||||||||||
DOM Level 3 WD - Experimental.
| |||||||||||
DOM Level 3 WD - Experimental.
| |||||||||||
DOM Level 3 WD - Experimental
Normalize document.
| |||||||||||
Registers an identifier name with a specified element node.
| |||||||||||
Since insertBefore caches the docElement (and, currently, docType),
removeChild has to know how to undo the cache
REVISIT: According to the spec it is not allowed to alter neither the
document element nor the document type in any way
| |||||||||||
Removes a previously registered element with the specified
identifier name.
| |||||||||||
DOM Level 3 WD - Experimental.
| |||||||||||
Since we cache the docElement (and, currently, docType),
replaceChild has to update the cache
REVISIT: According to the spec it is not allowed to alter neither the
document element nor the document type in any way
| |||||||||||
DOM Level 3 WD - Experimental.
| |||||||||||
DOM Level 3 WD - Experimental.
| |||||||||||
DOM Level 3 WD - Experimental.
| |||||||||||
This method is deprecated.
This method is internal and only exists for
compatibility with older applications. New applications
should never call this method.
| |||||||||||
Sets whether the DOM implementation performs error checking
upon operations.
| |||||||||||
DOM Internal
(Was a DOM L3 Core WD public interface method setActualEncoding )
An attribute specifying the actual encoding of this document.
| |||||||||||
This method is deprecated.
This method is internal and only exists for
compatibility with older applications. New applications
should never call this method.
| |||||||||||
This attribute returns the text content of this node and its
descendants.
| |||||||||||
Associate an object to a key on this node.
| |||||||||||
This method is deprecated.
This method is internal and only exists for
compatibility with older applications. New applications
should never call this method.
| |||||||||||
DOM Internal
(Was a DOM L3 Core WD public interface method setXMLEncoding )
An attribute specifying, as part of the XML declaration,
the encoding of this document.
| |||||||||||
DOM Level 3 CR - Experimental.
| |||||||||||
DOM Level 3 CR - Experimental.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Call user data handlers when a node is deleted (finalized)
| |||||||||||
Denotes that this node has changed.
| |||||||||||
Returns the number of changes to this node.
| |||||||||||
Call user data handlers to let them know the nodes they are related to
are being deleted.
| |||||||||||
Checks if the given qualified name is legal with respect
to the version of XML to which this document must conform.
| |||||||||||
Remove all identifiers from the ID table
| |||||||||||
internal method to share code with subclass
| |||||||||||
NON-DOM: Get the number associated with this document.
| |||||||||||
NON-DOM: Get a number associated with a node created with respect
to this document.
| |||||||||||
NON-DOM: kept for backward compatibility
Retreive user data related to a given node
| |||||||||||
Uses the kidOK lookup table to check whether the proposed
tree structure is legal.
| |||||||||||
NON-DOM: kept for backward compatibility
Store user data related to a given node
This is a place where we could use weak references! Indeed, the node
here won't be GC'ed as long as some user data is attached to it, since
the userData table will have a reference to the node.
| |||||||||||
Traverses the DOM Tree and expands deferred nodes and their
children.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.apache.xerces.dom.ParentNode
| |||||||||||
From class
org.apache.xerces.dom.ChildNode
| |||||||||||
From class
org.apache.xerces.dom.NodeImpl
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
org.w3c.dom.Document
| |||||||||||
From interface
org.w3c.dom.Node
| |||||||||||
From interface
org.w3c.dom.NodeList
| |||||||||||
From interface
org.w3c.dom.events.EventTarget
|
Allow grammar access.
Number of alterations made to this document since its creation. Serves as a "dirty bit" so that live objects such as NodeList can recognize when an alteration has been made and discard its cached state information.
Any method that alters the tree structure MUST cause or be accompanied by a call to changed(), to inform it that any outstanding NodeLists may have to be updated.
(Required because NodeList is simultaneously "live" and integer- indexed -- a bad decision in the DOM's design.)
Note that changes which do not affect the tree's structure -- changing the node's name, for example -- do _not_ have to call changed().
Alternative implementation would be to use a cryptographic Digest value rather than a count. This would have the advantage that "harmless" changes (those producing equal() trees) would not force NodeList to resynchronize. Disadvantage is that it's slightly more prone to "false negatives", though that's the difference between "wildly unlikely" and "absurdly unlikely". IF we start maintaining digests, we should consider taking advantage of them. Note: This used to be done a node basis, so that we knew what subtree changed. But since only DeepNodeList really use this today, the gain appears to be really small compared to the cost of having an int on every (parent) node plus having to walk up the tree all the way to the root to mark the branch as changed everytime a node is changed. So we now have a single counter global to the document. It means that some objects may flush their cache more often than necessary, but this makes nodes smaller and only the document needs to be marked as changed.
Bypass error checking.
Experimental DOM Level 3 feature: Document standalone
NON-DOM: Actually creating a Document is outside the DOM's spec, since it has to operate in terms of a particular implementation.
Constructor.
For DOM2 support. The createDocument factory method is in DOMImplementation.
For DOM2 support.
DOM Level 3 WD - Experimental.
If the document is currently being loaded as a result of the method
load
being invoked the loading and parsing is
immediately aborted. The possibly partial result of parsing the
document is discarded and the document is cleared.
DOM Level 3 WD - Experimental Change the node's ownerDocument, and its subtree, to this Document
source | The node to adopt. |
---|
Deep-clone a document, including fixing ownerDoc for the cloned children. Note that this requires bypassing the WRONG_DOCUMENT_ERR protection. I've chosen to implement it by calling importNode which is DOM Level 2.
deep | boolean, iff true replicate children |
---|
Factory method; creates an Attribute having this Document as its OwnerDoc.
name | The name of the attribute. Note that the attribute's value is _not_ established at the factory; remember to set it! |
---|
if the attribute name is not acceptable. | |
DOMException |
Introduced in DOM Level 2.
Creates an attribute 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].
namespaceURI | The namespace URI of the attribute to create. When it is null or an empty string, this method behaves like createAttribute. |
---|---|
qualifiedName | The qualified name of the attribute to instantiate. |
DOMException | INVALID_CHARACTER_ERR: Raised if the specified name contains an invalid character. |
---|
NON-DOM: a factory method used by the Xerces DOM parser to create an element.
namespaceURI | The namespace URI of the attribute to create. When it is null or an empty string, this method behaves like createAttribute. |
---|---|
qualifiedName | The qualified name of the attribute to instantiate. |
localpart | The local name of the attribute to instantiate. |
DOMException | INVALID_CHARACTER_ERR: Raised if the specified name contains an invalid character. |
---|
Factory method; creates a CDATASection having this Document as its OwnerDoc.
data | The initial contents of the CDATA |
---|
for HTML documents. (HTML not yet implemented.) | |
DOMException |
Factory method; creates a Comment having this Document as its OwnerDoc.
data | The initial contents of the Comment. |
---|
Factory method; creates a DocumentFragment having this Document as its OwnerDoc.
NON-DOM Factory method; creates a DocumentType having this Document as its OwnerDoc. (REC-DOM-Level-1-19981001 left the process of building DTD information unspecified.)
for HTML documents, where DTDs are not permitted. (HTML not yet implemented.) | |
DOMException |
Factory method; creates an Element having this Document as its OwnerDoc.
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. |
---|
if the tag name is not acceptable. | |
DOMException |
NON-DOM Factory method: creates an element definition. Element definitions hold default attribute values.
DOMException |
---|
Introduced in DOM Level 2.
Creates 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].
namespaceURI | The namespace URI of the element to create. |
---|---|
qualifiedName | The qualified name of the element type to instantiate. |
DOMException | INVALID_CHARACTER_ERR: Raised if the specified name contains an invalid character. |
---|---|
DOMException | NAMESPACE_ERR: Raised if the qualifiedName has a prefix that is "xml" and the namespaceURI is neither null nor an empty string nor "http://www.w3.org/XML/1998/namespace", or if the qualifiedName has a prefix different from "xml" and the namespaceURI is null or an empty string. |
NON-DOM: a factory method used by the Xerces DOM parser to create an element.
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. |
DOMException | INVALID_CHARACTER_ERR: Raised if the specified name contains an invalid character. |
---|
NON-DOM Factory method; creates an Entity having this Document as its OwnerDoc. (REC-DOM-Level-1-19981001 left the process of building DTD information unspecified.)
name | The name of the Entity we wish to provide a value for. |
---|
for HTML documents, where nonstandard entities are not permitted. (HTML not yet implemented.) | |
DOMException |
Factory method; creates an EntityReference having this Document as its OwnerDoc.
name | The name of the Entity we wish to refer to |
---|
for HTML documents, where nonstandard entities are not permitted. (HTML not yet implemented.) | |
DOMException |
NON-DOM Factory method; creates a Notation having this Document as its OwnerDoc. (REC-DOM-Level-1-19981001 left the process of building DTD information unspecified.)
name | The name of the Notation we wish to describe |
---|
for HTML documents, where notations are not permitted. (HTML not yet implemented.) | |
DOMException |
Factory method; creates a ProcessingInstruction having this Document as its OwnerDoc.
target | The target "processor channel" |
---|---|
data | Parameter string to be passed to the target. |
if the target name is not acceptable. | |
for HTML documents. (HTML not yet implemented.) | |
DOMException |
Factory method; creates a Text node having this Document as its OwnerDoc.
data | The initial contents of the Text. |
---|
DOM Level 3 WD - Experimental.
Indicates whether the method load should be synchronous or
asynchronous. When the async attribute is set to true
the load method returns control to the caller before the document has
completed loading. The default value of this property is
false
.
Setting the value of this attribute might throw NOT_SUPPORTED_ERR
if the implementation doesn't support the mode the attribute is being
set to. Should the DOM spec define the default value of this
property? What if implementing both async and sync IO is impractical
in some systems? 2001-09-14. default is false
but we
need to check with Mozilla and IE.
Returns the absolute base URI of this node or null if the implementation wasn't able to obtain an absolute URI. Note: If the URI is malformed, a null is returned.
For XML, this provides access to the Document Type Definition. For HTML documents, and XML documents which don't specify a DTD, it will be null.
Convenience method, allowing direct access to the child node which is considered the root of the actual document content. For HTML, where it is legal to have more than one Element at the top level of the document, we pick the one with the tagName "HTML". For XML there should be only one top-level (HTML not yet supported.)
DOM Level 3 WD - Experimental.
The location of the document or null
if undefined.
Beware that when the Document
supports the feature
"HTML" , the href attribute of the HTML BASE element takes precedence
over this attribute.
DOM Level 3 CR - Experimental
The configuration used when Document.normalizeDocument
is
invoked.
Introduced in DOM Level 2 Returns the Element whose ID is given by elementId. If no such element exists, returns null. Behavior is not defined if more than one element has this ID.
Note: 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.
Return a live collection of all descendent Elements (not just immediate children) having the specified tag name.
tagname | The type of Element we want to gather. "*" will be taken as a wildcard, meaning "all elements in the document." |
---|
Introduced in DOM Level 2.
Returns 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.
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. |
This method is deprecated.
This method is internal and only exists for
compatibility with older applications. New applications
should never call this method.
Returns true if the DOM implementation performs error checking.
Returns a previously registered element with the specified identifier name, or null if no element is registered.
Retrieve information describing the abilities of this particular DOM implementation. Intended to support applications that may be using DOMs retrieved from several different sources, potentially with different underlying representations.
DOM Level 3 CR - Experimental. (Was getActualEncoding)
An attribute specifying the encoding used for this document
at the time of the parsing. This is null
when
it is not known, such as when the Document
was
created in memory.
Returns the node type.
Find the Document that this Node belongs to (the document in whose context the Node was created). The Node may or may not currently be part of that Document's actual contents.
This method is deprecated.
This method is internal and only exists for
compatibility with older applications. New applications
should never call this method.
This attribute returns the text content of this node and its
descendants. When it is defined to be null, setting it has no effect.
When set, any possible children this node may have are removed and
replaced by a single Text
node containing the string
this attribute is set to. On getting, no serialization is performed,
the returned string does not contain any markup. No whitespace
normalization is performed, the returned string does not contain the
element content whitespaces . Similarly, on setting, no parsing is
performed either, the input string is taken as pure textual content.
The string returned is made of the text content of this node
depending on its type, as defined below:
Node type | Content |
---|
Node type | Content |
---|---|
ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, DOCUMENT_FRAGMENT_NODE | concatenation of the textContent
attribute value of every child node, excluding COMMENT_NODE and
PROCESSING_INSTRUCTION_NODE nodes |
ATTRIBUTE_NODE, TEXT_NODE, CDATA_SECTION_NODE, COMMENT_NODE, PROCESSING_INSTRUCTION_NODE |
nodeValue |
DOCUMENT_NODE, DOCUMENT_TYPE_NODE, NOTATION_NODE | null |
DOMException |
---|
Retrieves the object associated to a key on a this node. The object
must first have been set to this node by calling
setUserData
with the same key.
n | The node the object is associated to. |
---|---|
key | The key the object is associated to. |
DOMObject
associated to the given key
on this node, or null
if there was none.
This method is deprecated.
This method is internal and only exists for
compatibility with older applications. New applications
should never call this method.
DOM Level 3 WD - Experimental. The encoding of this document (part of XML Declaration)
DOM Level 3 WD - Experimental. standalone that specifies whether this document is standalone (part of XML Declaration)
DOM Level 3 WD - Experimental. The version of this document (part of XML Declaration)
Copies a node from another document to this document. The new nodes are created using this document's factory methods and are populated with the data from the source's accessor methods defined by the DOM interfaces. Its behavior is otherwise similar to that of cloneNode.
According to the DOM specifications, document nodes cannot be imported and a NOT_SUPPORTED_ERR exception is thrown if attempted.
DOMException |
---|
Since a Document may contain at most one top-level Element child, and at most one DocumentType declaraction, we need to subclass our add-children methods to implement this constraint. Since appendChild() is implemented as insertBefore(,null), altering the latter fixes both.
While I'm doing so, I've taken advantage of the opportunity to cache documentElement and docType so we don't have to search for them. REVISIT: According to the spec it is not allowed to alter neither the document element nor the document type in any way
newChild | The Node to be moved to our subtree. As a convenience feature, inserting a DocumentNode will instead insert all its children. |
---|---|
refChild | Current child which newChild should be placed immediately before. If refChild is null, the insertion occurs after all existing Nodes, like appendChild(). |
DOMException |
---|
Checks if the given qualified name is legal with respect to the version of XML to which this document must conform.
prefix | prefix of qualified name |
---|---|
local | local part of qualified name |
Check the string against XML's definition of acceptable names for elements and attributes and so on using the XMLCharacterProperties utility class
DOM Level 3 WD - Experimental.
Replaces the content of the document with the result of parsing the
given URI. Invoking this method will either block the caller or
return to the caller immediately depending on the value of the async
attribute. Once the document is fully loaded a "load" event (as
defined in [DOM Level 3 Events]
, except that the Event.targetNode
will be the document,
not an element) will be dispatched on the document. If an error
occurs, an implementation dependent "error" event will be dispatched
on the document. If this method is called on a document that is
currently loading, the current load is interrupted and the new URI
load is initiated.
When invoking this method the parameters used in the
DOMParser
interface are assumed to have their default
values with the exception that the parameters "entities"
, "normalize-characters"
,
"check-character-normalization"
are set to
"false"
.
The result of a call to this method is the same the result of a
call to DOMParser.parseWithContext
with an input stream
referencing the URI that was passed to this call, the document as the
context node, and the action ACTION_REPLACE_CHILDREN
.
uri | The URI reference for the XML file to be loaded. If this is a relative URI, the base URI used by the implementation is implementation dependent. |
---|
true
load
returns
true
if the document load was successfully initiated.
If an error occurred when initiating the document load,
load
returns false
.If async is set to
false
load
returns true
if
the document was successfully loaded and parsed. If an error
occurred when either loading or parsing the URI, load
returns false
.
DOM Level 3 WD - Experimental. Replace the content of the document with the result of parsing the input string, this method is always synchronous.
source | A string containing an XML document. |
---|
true
if parsing the input string succeeded
without errors, otherwise false
.
DOM Level 3 WD - Experimental Normalize document.
Registers an identifier name with a specified element node. If the identifier is already registered, the new element node replaces the previous node. If the specified element node is null, removeIdentifier() is called.
Since insertBefore caches the docElement (and, currently, docType), removeChild has to know how to undo the cache REVISIT: According to the spec it is not allowed to alter neither the document element nor the document type in any way
DOMException |
---|
Removes a previously registered element with the specified identifier name.
DOM Level 3 WD - Experimental. Renaming node
DOMException |
---|
Since we cache the docElement (and, currently, docType), replaceChild has to update the cache REVISIT: According to the spec it is not allowed to alter neither the document element nor the document type in any way
DOMException |
---|
DOM Level 3 WD - Experimental.
Save the document or the given node and all its descendants to a string
(i.e. serialize the document or node).
The parameters used in the LSSerializer
interface are
assumed to have their default values when invoking this method.
The result of a call to this method is the same the result of a
call to LSSerializer.writeToString
with the document as
the node to write.
node | Specifies what to serialize, if this parameter is
null the whole document is serialized, if it's
non-null the given node is serialized. |
---|
null
in case an error
occurred.DOMException | WRONG_DOCUMENT_ERR: Raised if the node passed in as the node parameter is from an other document. |
---|
DOM Level 3 WD - Experimental.
Indicates whether the method load should be synchronous or
asynchronous. When the async attribute is set to true
the load method returns control to the caller before the document has
completed loading. The default value of this property is
false
.
Setting the value of this attribute might throw NOT_SUPPORTED_ERR
if the implementation doesn't support the mode the attribute is being
set to. Should the DOM spec define the default value of this
property? What if implementing both async and sync IO is impractical
in some systems? 2001-09-14. default is false
but we
need to check with Mozilla and IE.
This method is deprecated.
This method is internal and only exists for
compatibility with older applications. New applications
should never call this method.
Sets whether the DOM implementation performs error checking upon operations. Turning off error checking only affects the following DOM checks:
Turning off error checking does not turn off the following checks:
DOM Internal
(Was a DOM L3 Core WD public interface method setActualEncoding )
An attribute specifying the actual encoding of this document. This is
null
otherwise.
This attribute represents the property [character encoding scheme]
defined in .
This method is deprecated.
This method is internal and only exists for
compatibility with older applications. New applications
should never call this method.
This attribute returns the text content of this node and its
descendants. When it is defined to be null, setting it has no effect.
When set, any possible children this node may have are removed and
replaced by a single Text
node containing the string
this attribute is set to. On getting, no serialization is performed,
the returned string does not contain any markup. No whitespace
normalization is performed, the returned string does not contain the
element content whitespaces . Similarly, on setting, no parsing is
performed either, the input string is taken as pure textual content.
The string returned is made of the text content of this node
depending on its type, as defined below:
Node type | Content |
---|---|
ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, DOCUMENT_FRAGMENT_NODE | concatenation of the textContent
attribute value of every child node, excluding COMMENT_NODE and
PROCESSING_INSTRUCTION_NODE nodes |
ATTRIBUTE_NODE, TEXT_NODE, CDATA_SECTION_NODE, COMMENT_NODE, PROCESSING_INSTRUCTION_NODE |
nodeValue |
DOCUMENT_NODE, DOCUMENT_TYPE_NODE, NOTATION_NODE | null |
DOMException |
---|
Associate an object to a key on this node. The object can later be
retrieved from this node by calling getUserData
with the
same key.
n | The node to associate the object to. |
---|---|
key | The key to associate the object to. |
data | The object to associate to the given key, or
null to remove any existing association to that key. |
handler | The handler to associate to that key, or
null . |
DOMObject
previously associated to
the given key on this node, or null
if there was none.
This method is deprecated.
This method is internal and only exists for
compatibility with older applications. New applications
should never call this method.
DOM Internal (Was a DOM L3 Core WD public interface method setXMLEncoding ) An attribute specifying, as part of the XML declaration, the encoding of this document. This is null when unspecified.
DOM Level 3 CR - Experimental. Xmlstandalone - An attribute specifying, as part of the XML declaration, whether this document is standalone
DOMException | NOT_SUPPORTED_ERR: Raised if this document does not support the "XML" feature. |
---|
DOM Level 3 CR - Experimental. version - An attribute specifying, as part of the XML declaration, the version number of this document.
Call user data handlers when a node is deleted (finalized)
n | The node this operation applies to. |
---|---|
c | The copy node or null. |
operation | The operation - import, clone, or delete. |
Denotes that this node has changed.
Returns the number of changes to this node.
Call user data handlers to let them know the nodes they are related to are being deleted. The alternative would be to do that on Node but because the nodes are used as the keys we have a reference to them that prevents them from being gc'ed until the document is. At the same time, doing it here has the advantage of avoiding a finalize() method on Node, which would affect all nodes and not just the ones that have a user data.
Checks if the given qualified name is legal with respect to the version of XML to which this document must conform.
prefix | prefix of qualified name |
---|---|
local | local part of qualified name |
Remove all identifiers from the ID table
internal method to share code with subclass
NON-DOM: Get the number associated with this document. Used to order documents in the implementation.
NON-DOM: Get a number associated with a node created with respect to this document. Needed for compareDocumentPosition when nodes are disconnected. This is only used on demand.
NON-DOM: kept for backward compatibility Retreive user data related to a given node
Uses the kidOK lookup table to check whether the proposed tree structure is legal.
NON-DOM: kept for backward compatibility Store user data related to a given node This is a place where we could use weak references! Indeed, the node here won't be GC'ed as long as some user data is attached to it, since the userData table will have a reference to the node.
Traverses the DOM Tree and expands deferred nodes and their children.