::class xmlDocument public subclass xmlNode
CLASS: xmlDocument
The xmlDocument 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 xmlDocument interface also contains the factory methods needed to create these objects. The xmlNode objects
created have a ownerDocument attribute which associates them with the Document within whose context they were created.
Definition at line
2036 of
xmlDOM.cls
Public Methods
|
node - The adopted node, or .nil if this operation fails, such as when the source node comes from a different implementation.
|
adoptNode
(source)
|
|
|
attr - A new Attr object
|
createAttribute
(name, value=.nil)
|
|
|
attr - A new xmlAttr object with the following attributes:
|
createAttributeNS
(namespaceURI=.nil, qualifiedName)
|
|
|
cdata - The new xmlCDATASection object.
|
createCDATASection
(data)
|
|
|
comment - The new xmlComment object
|
createComment
(data)
|
|
|
docFragment - The newly created empty xmlDocumentFragment
|
createDocumentFragment
()
|
|
|
element - A new xmlElement as described above.
|
createElement
(tagName)
|
|
|
attr - A new xmlAttr object with the following attributes:
|
createElementNS
(namespaceURI=.nil, qualifiedName)
|
|
|
|
createEntityReference
(name)
|
|
|
pi - The new xmlProcessingInstruction object
|
createProcessingInstruction
(target, data)
|
|
|
text - The new xmlText object
|
createTextNode
(data)
|
|
|
element - The matching element or .nil if there is none.
|
getElementById
(elementId)
|
|
|
nodeList - A new xmlNodeList object containing all the matched xmlElements.
|
getElementsByTagName
(tagName)
|
|
|
nodeList - A new xmlNodeList containing all the matched xmlElements.
|
getElementsByTagNameNS
(namespaceURI=.nil, localName)
|
|
|
node - the imported node that belongs to this xmlDocument now.
|
importNode
(importNode, deep=.false)
|
|
|
|
init
()
|
|
|
|
normalizeDocument
()
|
|
|
node - The renamed node.
|
renameNode
(node, namespaceURI=.nil, qualifiedName)
|
|
|
Public Class Methods inherited from xmlNode
|
number - unique identifier for the new xmlNode
|
getId
()
|
|
|
Public Methods inherited from xmlNode
|
node - the node appended
|
appendChild
(child)
|
|
|
nodes - A xmlNodeList that contains all the children of this node.
|
children
()
|
|
|
node - the duplicated node
|
cloneNode
(deep=.false)
|
|
|
number - Position relatively to the reference node
|
compareDocumentPosition
(other)
|
|
|
child - The first child of this node
|
firstChild
()
|
|
|
domObject - An object which implements the specialized APIs or .nil
|
getFeature
(feature, version)
|
|
|
userdata - the DOMUserData associated, or .nil if there was none
|
getUserData
(key)
|
|
|
boolean - .true if this node has any attributes, .false otherwise
|
hasAttributes
()
|
|
|
boolean - .true if this node has any children, .false otherwise
|
hasChildNodes
()
|
|
|
|
init
()
|
|
|
node - the node being inserted
|
insertBefore
(child, where)
|
|
|
boolean - .true if default, .false otherwise
|
isDefaultNamespace
(uri)
|
|
|
boolean - .true if equal, .false otherwise
|
isEqualNode
(other)
|
|
|
boolean - .true if the nodes are the same, .false otherwise.
|
isSameNode
(other)
|
|
|
boolean - .true if supported on this node, .false otherwise.
|
isSupported
(feature, version)
|
|
|
aNode - The last child of this node.
|
lastChild
()
|
|
|
aString - The associated namespaceURI or .nil if none is found.
|
lookupNamespaceURI
(prefix)
|
|
|
aString - An associated namespace prefix or .nil if none is found
|
lookupPrefix
(uri)
|
|
|
aNode - The node immediately following this node.
|
normalize
()
|
|
|
aNode - The node immediately preceding this node.
|
removeChild
(child)
|
|
|
aNode - The node replaced.
|
replaceChild
(new, old)
|
|
|
|
setReadOnly
(attrName, attrValue)
|
|
|
userData - The DOMUserData previously associated to the given key on this node, or null if there was none.
|
setUserData
(key, data, handler)
|
|
|
|
textContent
()
|
|
|
Instantiated by
xmlDOM.cls line 2635
Feature Detail
A directory with elementIds as index and the associated xmlElement as item.
Dynamically referenced by
xmlDOM.cls line 2162 "
self~elementIds = .directory~new"
xmlDOM.cls line 2413 "
element = self~elementIds[elementId]"
A directory with tagNames as index and an array of xmlElement objects with the tagName as objects
Dynamically referenced by
xmlDOM.cls line 2163 "
self~elementTags = .directory~new"
A directory with namespaceURIs as index and their prefix as item
Dynamically referenced by
xmlDOM.cls line 2164 "
self~nameSpaces = .directory~new"
The Document Type Declaration (see DocumentType) associated with this document. For XML documents without a document
type declaration this returns
.nil. For HTML documents, a DocumentType object may be returned, independently of
the presence or absence of document type declaration in the HTML document.
This provides direct access to the xmlDocumentType node, child node of this xmlDocument. This node can be set a
t document creation time and later changed through the use of child nodes manipulation methods, such as xmlNode's
insertBefore, or xmlNode's
replaceChild.
Note, however, that while some implementations may instantiate different types of Document objects supporting
additional features than the "Core", such as "HTML" [DOM Level 2 HTML], based on the xmlDocumentType specified at
creation time, changing it afterwards is very unlikely to result in a change of the features supported.
Dynamically referenced by
xmlDOM.cls line 2644 "
document~docType = docType"
Dynamically referenced by
xmlDOM.cls line 2644 "
document~docType = docType"
This is a convenience attribute that allows direct access to the child node that is the document element of
the document.
Dynamically referenced by
tryxmldom.rex line 19 "
doc = dom~documentElement"
xmlDOM.cls line 2776 "
self~doc~documentElement = elementNode"
Dynamically referenced by
tryxmldom.rex line 19 "
doc = dom~documentElement"
xmlDOM.cls line 2776 "
self~doc~documentElement = elementNode"
The location of the document or
.nil if undefined or if the Document was created using xmlDOMImplementation
createDocument. No lexical checking is performed when setting this attribute; this could result in a
.nil value returned when using xmlNode
baseURI.
Beware that when the Document supports the feature "HTML" [DOM Level 2 HTML], the href attribute of the HTML BASE
element takes precedence over this attribute when computing xmlNode
baseURI.
The configuration used when xmlDocument
normalizeDocument is invoked.
The xmlDOMImplementation object that handles this document. A DOM application may use objects from multiple
implementations.
The attributes setter method ("IMPLEMENTATION=") starts out as
public and is set to
private once set
turning the attribute into a
read-only.
Dynamically referenced by
xmlDOM.cls line 2636 "
document~implementation = self"
Dynamically referenced by
xmlDOM.cls line 2636 "
document~implementation = self"
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 xmlDocument was created in memory.
An attribute specifying whether error checking is enforced or not. When set to
.false, the implementation is
free to not test every possible error case normally defined on DOM operations, and not raise any xmlDOMException on
DOM operations or report errors while using xmlDocument
normalizeDocument. In case of error, the behavior is
undefined. This attribute is true by default.
An attribute specifying, as part of the XML declaration, the encoding of this document. This is
.nil when
unspecified or when it is not known, such as when the Document was created in memory.
An attribute specifying, as part of the XML declaration, whether this document is standalone. This is
.false
when unspecified.
Note: No verification is done on the value when setting this attribute. Applications should use xmlDocument
normalizeDocument with the "validate" parameter to verify if the value matches the validity constraint for
standalone document declaration as defined in [XML 1.0].
An attribute specifying, as part of the XML declaration, the version number of this document. If there is no
declaration and if this document supports the "XML" feature, the value is "1.0". If this document does not support the
"XML" feature, the value is always null. Changing this attribute will affect methods that check for invalid characters
in XML names. Application should invoke xmlDocument
normalizeDocument in order to check for invalid characters
in the Nodes that are already part of this Document.
DOM applications may use the xmlDOMImplementation
hasFeature(feature, version) method with parameter values
"XMLVersion" and "1.0" (respectively) to determine if an implementation supports [XML 1.0]. DOM applications may use
the same method with parameter values "XMLVersion" and "1.1" (respectively) to determine if an implementation supports
[XML 1.1]. In both cases, in order to support XML, an implementation must also support the "XML" feature defined in
this specification. Document objects supporting a version of the "XMLVersion" feature must not raise a
NOT_SUPPORTED_ERR exception for the same version number when using xmlDocument
xmlVersion.
Raised if the version is set to a value that is not supported by this Document or if this document does not support
the "XML" feature.
xmlDocument instance constructor
Attempts to adopt a node from another document to this document. If supported, it changes the ownerDocument of the
source node, its children, as well as the attached attribute nodes if there are any. If the source node has a parent
it is first removed from the child list of its parent. This effectively allows moving a subtree from one document to
another (unlike
importNode which create a copy of the source node instead of moving it). When it fails,
applications should use xmlDocument
importNode instead.
Note that if the adopted node is already part of this document (i.e. the source and target document are the same),
this method still has the effect of removing the source node from the child list of its parent, if any. The following
list describes the specifics for each type of node.
- ATTRIBUTE_NODE - The ownerElement attribute is set to null and the specified flag is set to true on the adopted
xmlAttr. The descendants of the source xmlAttr are recursively adopted.
- DOCUMENT_FRAGMENT_NODE - The descendants of the source node are recursively adopted.
- DOCUMENT_NODE - Document nodes cannot be adopted.
- DOCUMENT_TYPE_NODE - DocumentType nodes cannot be adopted.
- ELEMENT_NODE - Specified attribute nodes of the source element are adopted. Default attributes are discarded,
though if the document being adopted into defines default attributes for this element name, those are assigned. The
descendants of the source element are recursively adopted.
- ENTITY_NODE - Entity nodes cannot be adopted.
- ENTITY_REFERENCE_NODE - Only the EntityReference node itself is adopted, the descendants are discarded, since the
source and destination documents might have defined the entity differently. If the document being imported into
provides a definition for this entity name, its value is assigned.
- NOTATION_NODE - Notation nodes cannot be adopted.
- PROCESSING_INSTRUCTION_NODE, TEXT_NODE, CDATA_SECTION_NODE, COMMENT_NODE - These nodes can all be adopted. No
specifics.
Note: Since it does not create new nodes unlike the xmlDocument
importNode method, this method does not raise
an INVALID_CHARACTER_ERR exception, and applications should use the xmlDocument
normalizeDocument method to
check if an imported name is not an XML name according to the XML version in use.
Parameters
source - The xmlNode to move into this document.
Returns
node - The adopted node, or
.nil if this operation fails, such as when the source node comes from a different implementation.
Creates an xmlAttr of the given name. Note that the xmlAttr instance can then be set on an xmlElement using the
setAttributeNode method.
The new xmlAttr has the
nodeName attribute set to
name, and
localName,
prefix, and
namespaceURI set to null. The value of the attribute is the empty string.
Raised if the specified name is not an XML name according to the XML version in use specified in the xmlDocument
xmlVersion attribute.
To create an attribute with a qualified name and namespace URI, use the
createAttributeNS method.
Parameters
name - The name of the attribute.
value=.nil - The (optional) value of the attribute
Returns
attr - A new Attr object
Raises
user domException - INVALID_CHARACTER_ERR
Dynamically referenced by
tryxmldom.rex line 79 "
attr = out~createAttribute("version", "1.1")"
tryxmldom.rex line 82 "
attr = out~createAttribute("creator", "rji@xs4all.nl")"
tryxmldom.rex line 85 "
attr = out~createAttribute("xmlns", "http://www.topografix.com/GPX/1/1")"
tryxmldom.rex line 88 "
attr = out~createAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance")"
tryxmldom.rex line 91 "
attr = out~createAttribute("xsi:schemaLocation","http://www.topografix.com/GPX/1/1/gpx.xsd")"
tryxmldom.rex line 113 "
attr = out~createAttribute("href", "http://www.idenburg.net")"
tryxmldom.rex line 140 "
attr = out~createAttribute("minlat", minlat)"
tryxmldom.rex line 143 "
attr = out~createAttribute("minlon", minlon)"
tryxmldom.rex line 146 "
attr = out~createAttribute("maxlat", maxlat)"
tryxmldom.rex line 149 "
attr = out~createAttribute("maxlon", maxlon)"
tryxmldom.rex line 172 "
attr = out~createAttribute("lat", routePoint~word(1))"
tryxmldom.rex line 175 "
attr = out~createAttribute("lon", routePoint~word(2))"
tryxmldom.rex line 210 "
attr = out~createAttribute("lat", trackPoint~word(1))"
tryxmldom.rex line 213 "
attr = out~createAttribute("lon", trackPoint~word(2))"
xmlDOM.cls line 2805 "
self~attrNode = self~doc~createAttribute(attrName)"
Creates an attribute of the given qualified name and namespace URI.
- nodeName - The specified qualifiedName.
- namespaceURI - The specified namespaceURI.
- prefix - prefix, extracted from qualifiedName, or null if there is no prefix.
- localName - name, extracted from the specified qualifiedName.
- name - The specified qualifiedName.
- nodeValue - An empty string (i.e. "").
Per [XML Namespaces], applications must use the value null as the namespaceURI parameter for methods if they wish to
have no namespace.
Parameters
namespaceURI=.nil - The optional namespace URI of the attribute to create.
qualifiedName - The qualified name of the attribute to instantiate.
Returns
attr - A new xmlAttr object with the following attributes:
Raises
user domException - INVALID_CHARACTER_ERR
user domException - NAMESPACE_ERR
Creates a xmlCDATASection node whose value is the specified string.
Parameters
data - The data for the node.
Returns
cdata - The new xmlCDATASection object.
Dynamically referenced by
xmlDOM.cls line 2862 "
cdataNode = self~doc~createCDATASection(cdata)"
Creates a xmlComment node given the specified string.
Parameters
data - The data for the node
Returns
comment - The new xmlComment object
Dynamically referenced by
xmlDOM.cls line 2840 "
cmtNode = self~doc~createComment(comment)"
Creates an empty DocumentFragment object.
Returns
docFragment - The newly created empty xmlDocumentFragment
Creates an element of the type specified. Note that the instance returned implements the Element interface, so
attributes can be specified directly on the returned object. The new xmlElement object will have the nodeName
attribute set to
tagName, and localName, prefix, and namespaceURI set to null.
NOT YET!!!!!
In addition, if there are known attributes with default values, xmlAttr nodes representing them are automatically
created and attached to the element.
To create an element with a qualified name and namespace URI, use the createElementNS method.
Parameters
tagName - The name(case-sensitive for XML) of the element type to instantiate.
Returns
element - A new xmlElement as described above.
Raises
user domExceptuion - INVALID_CHARACTER_ERR
Dynamically referenced by
tryxmldom.rex line 77 "
out~appendChild(out~createElement("gpx"))"
tryxmldom.rex line 95 "
metadata = gpx~appendChild(out~createElement("metadata"))"
tryxmldom.rex line 103 "
copyright = out~createElement("copyright")"
tryxmldom.rex line 107 "
author = out~createElement("author")"
tryxmldom.rex line 108 "
name = out~createElement("name")"
tryxmldom.rex line 112 "
link = out~createElement("link")"
tryxmldom.rex line 119 "
desc = out~createElement("desc")"
tryxmldom.rex line 129 "
name = out~createElement("name")"
tryxmldom.rex line 134 "
keywords = out~createElement("keywords")"
tryxmldom.rex line 139 "
bounds = out~createElement("bounds")"
tryxmldom.rex line 154 "
rte = out~createElement("rte")"
tryxmldom.rex line 158 "
name = out~createElement("name")"
tryxmldom.rex line 163 "
type = out~createElement("type")"
tryxmldom.rex line 170 "
rtept = out~createElement("rtept")"
tryxmldom.rex line 180 "
cmt = out~createElement("cmt")"
tryxmldom.rex line 187 "
trk = out~createElement("trk")"
tryxmldom.rex line 190 "
name = out~createElement("name")"
tryxmldom.rex line 195 "
type = out~createElement("type")"
tryxmldom.rex line 200 "
trkseg = out~createElement("trkseg")"
tryxmldom.rex line 209 "
trkpt = out~createElement("trkpt")"
xmlDOM.cls line 2774 "
elementNode = self~doc~createElement(tagName)"
Creates an element of the given qualified name and namespace URI.
- nodeName - The specified qualifiedName.
- namespaceURI - The specified namespaceURI.
- prefix - prefix, extracted from qualifiedName, or null if there is no prefix.
- localName - name, extracted from the specified qualifiedName.
- tagName - The specified qualifiedName.
Per [XML Namespaces], applications must use the value null as the namespaceURI parameter for methods if they wish to
have no namespace.
Parameters
namespaceURI=.nil - The optional namespace URI of the element to create.
qualifiedName - The qualified name of the element type to instantiate.
Returns
attr - A new xmlAttr object with the following attributes:
Raises
user domException - INVALID_CHARACTER_ERR
user domException - NAMESPACE_ERR
Creates a xmlEntityReference object. In addition, if the referenced entity is known, the child list of the
xmlEntityReference node is made the same as that of the corresponding xmlEntity node.
Note: If any descendant of the Entity node has an unbound namespace prefix, the corresponding descendant of the
created EntityReference node is also unbound; (its namespaceURI is null). The DOM Level 2 and 3 do not support any
mechanism to resolve namespace prefixes in this case.
Parameters
name - The name of the reference
Creates a xmlProcessingInstruction node given the specified target and data strings.
Parameters
target - The target part of the processing instruction
data - The data for the node
Returns
pi - The new xmlProcessingInstruction object
Raises
user domException - INVALID_CHARACTER_ERR
Dynamically referenced by
xmlDOM.cls line 2828 "
piNode = self~doc~createProcessingInstruction(target,data)"
Creates a xmlText node given the specified string.
Parameters
data - The data for the node
Returns
text - The new xmlText object
Dynamically referenced by
tryxmldom.rex line 102 "
textNode = out~createTextNode(text)"
tryxmldom.rex line 109 "
text = out~createTextNode("Ruurd J. Idenburg")"
tryxmldom.rex line 125 "
textNode = out~createTextNode(text)"
tryxmldom.rex line 130 "
text = out~createTextNode(xmlStream~string)"
tryxmldom.rex line 135 "
text = out~createTextNode(travel_mode)"
tryxmldom.rex line 160 "
text = out~createTextNode(startAddress"-"endAddress)"
tryxmldom.rex line 165 "
text = out~createTextNode(travel_mode)"
tryxmldom.rex line 181 "
text = out~createTextNode(doEntities(legData~directions[i])"; Go" legData~distances[i]"." )"
tryxmldom.rex line 192 "
text = out~createTextNode(startAddress"-"endAddress)"
tryxmldom.rex line 197 "
text = out~createTextNode(travel_mode)"
xmlDOM.cls line 2851 "
txtNode = self~doc~createTextNode(text)"
Returns the xmlElement that has an ID attribute with the given value. If no such element exists, this returns null. If
more than one element has an ID attribute with that value, what is returned is undefined.
NOTE - Attributes with the name "ID" or "id" are not of type ID unless so defined.
The DOM implementation is expected to use the attribute Attr~isId to determine if an attribute is of type ID.
Parameters
elementId - The unique id value for an element.
Returns
element - The matching element or .nil if there is none.
Returns a xmlNodeList of all the xmlElements in document order with a given tag name and are within in the document.
For XML, the tagname parameter is case-sensitive, otherwise it depends on the case-sensitivity of the markup language
in use.
Parameters
tagName - The name of the tag to match on. The special value "*" matches all tags.
Returns
nodeList - A new xmlNodeList object containing all the matched xmlElements.
Dynamically referenced by
tryxmldom.rex line 21 "
travel_mode = doc~getElementsByTagName("travel_mode")~item(0)~firstChild~nodeValue"
tryxmldom.rex line 23 "
copyrights = doc~getElementsByTagName("copyrights")"
tryxmldom.rex line 24 "
warnings = doc~getElementsByTagName("warning")"
tryxmldom.rex line 26 "
startAddress = doc~getElementsByTagName("start_address")~item(0)~firstChild~nodeValue"
tryxmldom.rex line 27 "
endAddress = doc~getElementsByTagName("end_address")~item(0)~firstChild~nodeValue"
tryxmldom.rex line 29 "
bounds = doc~getElementsByTagName("bounds")~item(0)"
tryxmldom.rex line 30 "
maxlat = bounds~getElementsByTagName("northeast")~item(0)~childNodes~item(0)~firstChild~nodeValue"
tryxmldom.rex line 31 "
maxlon = bounds~getElementsByTagName("northeast")~item(0)~childNodes~item(1)~firstChild~nodeValue"
tryxmldom.rex line 32 "
minlat = bounds~getElementsByTagName("southwest")~item(0)~childNodes~item(0)~firstChild~nodeValue"
tryxmldom.rex line 33 "
minlon = bounds~getElementsByTagName("southwest")~item(0)~childNodes~item(1)~firstChild~nodeValue"
tryxmldom.rex line 35 "
legs = doc~getElementsByTagName("route")~item(0)~getElementsByTagName("leg")"
tryxmldom.rex line 35 "
legs = doc~getElementsByTagName("route")~item(0)~getElementsByTagName("leg")"
tryxmldom.rex line 45 "
encodedPolylines = leg~getElementsByTagName("polyline")"
tryxmldom.rex line 47 "
stepDirections = leg~getElementsByTagName("html_instructions")"
tryxmldom.rex line 49 "
stepStartLocations = leg~getElementsByTagName("start_location")"
tryxmldom.rex line 51 "
stepDistances = leg~getElementsByTagName("distance")"
tryxmldom.rex line 53 "
stepDurations = leg~getElementsByTagName("duration")"
tryxmldom.rex line 55 "
steps = leg~getElementsByTagName("step")"
Private method to walk the nodes tree and retrieve nodes by tagName
Parameters
nodes - The sibling nodes to walk thru.
tag - The name of the tag to select on.
nodelist - The xmlNodeList to append selected nodes to.
Dynamically referenced by
xmlDOM.cls line 2426 "
self~selectElements(self~childNodes, tagName, elements)"
xmlDOM.cls line 2446 "
self~selectElements(node~childNodes, tag, nodelist)"
Returns a xmlNodeList of all the xmlElements with a given local name and namespace URI in document order.
Parameters
namespaceURI=.nil - The namespace URI of the elements to match on. The special value "*" matches all namespaces.
localName - The local name of the elements to match on. The special value "*" matches all local names.
Returns
nodeList - A new xmlNodeList containing all the matched xmlElements.
Imports a node from another document to this document, without altering or removing the source node from the original
document; this method creates a new copy of the source node. The returned node has no parent; (parentNode is null).
For all nodes, importing a node creates a node object owned by the importing document, with attribute values identical
to the source node's nodeName and nodeType, plus the attributes related to namespaces (prefix, localName, and
namespaceURI). As in the cloneNode operation, the source node is not altered. 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.
Additional information is copied as appropriate to the nodeType, attempting to mirror the behavior expected if a
fragment of XML or HTML source was copied from one document to another, recognizing that the two documents may have
different DTDs in the XML case.
The following list describes the specifics for each type of node.
- ATTRIBUTE_NODE - The ownerElement attribute is set to null and the specified flag is set to true on the generated
xmlAttr. The descendants of the source xmlAttr are recursively imported and the resulting nodes reassembled to form
the corresponding subtree.
NOTE - The deep parameter has no effect on xmlAttr nodes; they always carry their children with them
when imported.
- DOCUMENT_FRAGMENT_NODE - If the deep option was set to true, the descendants of the source DocumentFragment are
recursively imported and the resulting nodes reassembled under the imported DocumentFragment to form the corresponding
subtree. Otherwise, this simply generates an empty DocumentFragment.
- DOCUMENT_NODE - Document nodes cannot be imported.
- DOCUMENT_TYPE_NODE - DocumentType nodes cannot be imported.
- ELEMENT_NODE - Specified attribute nodes of the source element are imported, and the generated xmlAttr nodes are
attached to the generated xmlElement. Default attributes are not copied, though if the document being imported into
defines default attributes for this element name, those are assigned. If the importNode deep parameter was set to
true, the descendants of the source element are recursively imported and the resulting nodes reassembled to form the
corresponding subtree.
- ENTITY_NODE - Entity nodes can be imported, however in the current release of the DOM the xmlDocumentType is
readonly. Ability to add these imported nodes to a xmlDocumentType will be considered for addition to a future release
of the DOM.
- ENTITY_REFERENCE_NODE - Only the EntityReference itself is copied, even if a deep import is requested, since the
source and destination documents might have defined the entity differently. If the document being imported into
provides a definition for this entity name, its value is assigned.
- NOTATION_NODE - Notation nodes can be imported, however they are read-only
- PROCESSING_INSTRUCTION_NODE - The imported node copies its target and data from those of the source node.
- TEXT_NODE, CDATA_SECTION_NODE, COMMENT_NODE - These three types of nodes inheriting from xmlCharacterData copy
their data and length attributes from those of the source node.
Parameters
importNode - The node to import
deep=.false - optional boolean to indicate a deep copy
Returns
node - the imported node that belongs to this xmlDocument now.
Raises
user domException - INVALID_CHARACTER_ERR
This method acts as if the document was going through a save and load cycle, putting the document in a "normal" form.
As a consequence, this method updates the replacement tree of EntityReference nodes and normalizes Text nodes, as
defined in the method xmlNode
normalize.
Otherwise, the actual result depends on the features being set on the Document.domConfig object and governing what
operations actually take place. Noticeably this method could also make the document namespace well-formed according to
the algorithm described in Namespace Normalization, check the character normalization, remove the CDATASection nodes,
etc. See DOMConfiguration for details.
Mutation events, when supported, are generated to reflect the changes occurring on the document.
If errors occur during the invocation of this method, such as an attempt to update a read-only node or a Node.nodeName
contains an invalid character according to the XML version in use, errors or warnings (DOMError.SEVERITY_ERROR or
DOMError.SEVERITY_WARNING) will be reported using the DOMErrorHandler object associated with the "error-handler"
parameter. Note this method might also report fatal errors (DOMError.SEVERITY_FATAL_ERROR) if an implementation cannot
recover from an error.
Rename an existing node of type ELEMENT_NODE or ATTRIBUTE_NODE.
When possible this simply changes the name of the given node, otherwise this creates a new node with the specified
name and replaces the existing node with the new node as described below.
If simply changing the name of the given node is not possible, the following operations are performed: a new node is
created, any registered event listener is registered on the new node, any user data attached to the old node is
removed from that node, the old node is removed from its parent if it has one, the children are moved to the new node,
if the renamed node is an Element its attributes are moved to the new node, the new node is inserted at the position
the old node used to have in its parent's child nodes list if it has one, the user data that was attached to the old
node is attached to the new node.
When the node being renamed is an Element only the specified attributes are moved, default attributes originated from
the DTD are updated according to the new element name. In addition, the implementation may update default attributes
from other schemas. Applications should use Document.normalizeDocument() to guarantee these attributes are up-to-date.
When the node being renamed is an Attr that is attached to an Element, the node is first removed from the Element
attributes map. Then, once renamed, either by modifying the existing node or creating a new one as described above, it
is put back.
In addition:
- a user data event NODE_RENAMED is fired
- when the implementation supports the feature "MutationNameEvents", each mutation operation involved in this method
fires the appropriate event, and in the end the event {http://www.w3.org/2001/xml-events, DOMElementNameChanged} or
{http://www.w3.org/2001/xml-events, DOMAttributeNameChanged} is fired.
<\ul>
The renamed node is either the specified node or the new node that was created to replace the specified node.
Parameters
node - The node to rename
namespaceURI=.nil - The new namespace URI.
qualifiedName - The new qualified name.
Returns
node - The renamed node.
Raises
user domException - NOT_SUPPORTED_ERR
user domException - INVALID_CHARACTER_ERR
user domException - WRONG_DOCUMENT_ERR
user domException - NAMESPACE_ERR
|
Generated on 30 Jul 2015 13:57:00 for xmlDOM for OOrexx by
0.0.1
|