::class xmlElement public subclass xmlNode
CLASS: xmlElement
The Element interface represents an element in an HTML or XML document. Elements may have attributes associated with
them; since the Element interface inherits from Node, the generic Node interface attribute attributes may be used to
retrieve the set of all attributes for an element. There are methods on the Element interface to retrieve either an
Attr object by name or an attribute value by name. In XML, where an attribute value may contain entity references, an
Attr object should be retrieved to examine the possibly fairly complex sub-tree representing the attribute value. On
the other hand, in HTML, where all attributes have simple string values, methods to directly access an attribute value
can safely be used as a convenience.
Note: In DOM Level 2, the method normalize is inherited from the Node interface where it was moved.
Definition at line
1582 of
xmlDOM.cls
Public Methods
|
string - The xmlAttr value or .nil if that attribute does not have a specified or default value.
|
getAttribute
(name)
|
|
|
string - The xmlAttr value, or the empty string if that attribute does not have a specified or default value.
|
getAttributeNS
(namespaceURI=.nil, localName)
|
|
|
node - The xmlAttr node with the specified nodeName or .nil if there is no such attribute.
|
getAttributeNode
(name)
|
|
|
node - The xmlAttr node with the specified attribute local name and namespace URI or null if there is no such attribute.
|
getAttributeNodeNS
(namespaceURI=.nil, localName)
|
|
|
nodeList - A list of matching xmlElement nodes.
|
getElementsByTagName
(tag)
|
|
|
boolean - .true if an attribute with the given name is specified on this element or has a default value, .false otherwise.
|
hasAttribute
(name)
|
|
|
boolean - .true if an attribute with the given local name and namespace URI is specified or has a default value on this element, .false otherwise.
|
hasAttributeNS
(namespaceURI=.nil, localName)
|
|
|
|
init
(tagName)
|
|
|
|
removeAttribute
(name)
|
|
|
|
removeAttributeNS
(nameSpaceURI=.nil, localName)
|
|
|
attr - The removed attribute.
|
removeAttributeNode
(oldAttr)
|
|
|
|
schemaTypeInfo
()
|
|
|
|
setAttribute
(name, value)
|
|
|
|
setAttributeNS
(namespaceURI=.nil, qualifiedName, value)
|
|
|
attr - If the newAttr attribute replaces an existing attribute, the replaced Attr node is returned, otherwise .nil is returned.
|
setAttributeNode
(newAttr)
|
|
|
attr - If the newAttr attribute replaces an existing attribute, the replaced Attr node is returned, otherwise .nil is returned.
|
setAttributeNodeNS
(newAttr)
|
|
|
|
setIdAttribute
(name, isId)
|
|
|
|
setIdAttributeNS
(namespaceURI, localName, isId)
|
|
|
|
setIdAttributeNode
(idAttr, isId)
|
|
|
|
tagName
()
|
|
|
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 2319
xmlDOM.cls line 2358
Feature Detail
Private method to walk the xmlNode tree and retrieve all elements with the specified tagName.
Parameters
nodes - the xmlNodes to start with, i.e. the childNodes from the receiver node.
tag - The name odf the tag for the elements to be selected,'*' means all tags.
nodeList - A xmlNodeList with all the selected elements in the subtree with specified tagName.
Dynamically referenced by
xmlDOM.cls line 1601 "
self~selectElements(node~childNodes, tag, nodeList)"
xmlDOM.cls line 1764 "
self~selectElements(self~childNodes, tag, nodeList)"
Private method to walk the xmlNode tree and retrieve all elements from a namespace with the specified local name.
Parameters
nodes - the xmlNodes to start with, i.e. the childNodes from the receiver node.
namespaceURI - The namespace of the elements to be selected.
localName - The local name for the element to be selected.
nodeList - A xmlNodeList with all the elements in the subtree with specified tagName.
The type information associated with this element.
The name of the element. If Node
localName is different from null, this attribute is a qualified name.
Dynamically referenced by
tryxmldom.rex line 250 "
tag = node~tagName"
xmlDOM.cls line 1595 "
if node~tagName==tag "
xmlDOM.cls line 2363 "
element~tagName = qualifiedName"
xmlDOM.cls line 2440 "
if (node~tagName==tag) "
xmlDOM.cls line 2791 "
if self~nodeStack[1]~tagName<>tagName "
xmlElement instance constructor
nodeValue, localName, prefix, namespaceURI and childNodes are set by the superclass xmlNode
Parameters
tagName - The name of the xmlElement to be created.
Retrieves an attribute value by name.
Parameters
name - The name of the attribute to retrieve.
Returns
string - The xmlAttr value or
.nil if that attribute does not have a specified or default value.
Retrieves an attribute value by local name and namespace URI.
Per [XML Namespaces], applications must use the value null as the namespaceURI parameter for methods if they wish to
have no namespace.
Assumption: Attributes can not have a default namespace, thus need a prefix if they belong to a certain namespace.
Assumption: A namespace can have multiple prefixes.
Parameters
namespaceURI=.nil - The namespace URI of the attribute to retrieve.
localName - The local name of the attribute to retrieve.
Returns
string - The xmlAttr value, or the empty string if that attribute does not have a specified or default value.
Retrieves an attribute node by name.
To retrieve an attribute node by qualified name and namespace URI, use the getAttributeNodeNS method.
Parameters
name - The nodeName of the attribute to retrieve
Returns
node - The xmlAttr node with the specified nodeName or
.nil if there is no such attribute.
Retrieves an Attr node by local name and namespace URI.
Per [XML Namespaces], applications must use the value null as the namespaceURI parameter for methods if they wish to
have no namespace.
Assumption: Attributes can not have a default namespace, thus need a prefix if they belong to a certain namespace.
Assumption: A namespace can have multiple prefixes.
Parameters
namespaceURI=.nil - The namespace URI of the attribute to retrieve.
localName - The local name of the attribute to retrieve.
Returns
node - The xmlAttr node with the specified attribute local name and namespace URI or null if there is no such attribute.
Returns a xmlNodeList of all descendant xmlElements with a given tag name, in document order.
Parameters
tag - The name of the tag to match on. The special value "*" matches all tags.
Returns
nodeList - A list of matching xmlElement nodes.
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")"
Returns true when an attribute with a given name is specified on this element or has a default value, false otherwise.
Parameters
name - The name of the attribute to look for.
Returns
boolean -
.true if an attribute with the given name is specified on this element or has a default value,
.false otherwise.
Returns true when an attribute with a given local name and namespace URI is specified on this element or has a default
value, false otherwise.
Per [XML Namespaces], applications must use the value
.nil as the namespaceURI parameter for methods if they
wish to have no namespace.
Assumption: Attributes can not have a default namespace, thus need a prefix if they belong to a certain namespace.
Assumption: A namespace can have multiple prefixes.
Parameters
namespaceURI=.nil - The namespace URI of the attribute to look for.
localName - The local name of the attribute to look for.
Returns
boolean -
.true if an attribute with the given local name and namespace URI is specified or has a default value on this element,
.false otherwise.
Removes an attribute by name.
NOT supported here:
(If a default value for the removed attribute is defined in the DTD, a new attribute immediately appears with the
default value as well as the corresponding namespace URI, local name, and prefix when applicable. The implementation
may handle default values from other schemas similarly but applications should use Document.normalizeDocument() to
guarantee this information is up-to-date.)
If no attribute with this name is found, this method has no effect.
To remove an attribute by local name and namespace URI, use the removeAttributeNS method.
Parameters
name - The name of the attribute to remove.
Removes an attribute by local name and namespace URI.
NOT supported here:
(If a default value for the removed attribute is defined in the DTD, a new attribute immediately appears with the
default value as well as the corresponding namespace URI, local name, and prefix when applicable. The implementation
may handle default values from other schemas similarly but applications should use Document.normalizeDocument() to
guarantee this information is up-to-date.)
If no attribute with this local name and namespace URI is found, this method has no effect.
Per [XML Namespaces], applications must use the value
.nil as the namespaceURI parameter for methods if they
wish to have no namespace.
Parameters
nameSpaceURI=.nil - The namespace URI of the attribute to remove.
localName - The local name of the attribute to remove.
Removes the specified attribute node.
NOT supported here:
(If a default value for the removed Attr node is defined in the DTD, a new node immediately appears with the default
value as well as the corresponding namespace URI, local name, and prefix when applicable. The implementation may
handle default values from other schemas similarly but applications should use Document.normalizeDocument() to
guarantee this information is up-to-date.)
Parameters
oldAttr - The reference to the xmlAttr to be removed.
Returns
attr - The removed attribute.
Raises
user domException - NOT_FOUND_ERR perhaps
Adds a new attribute. If an attribute with that name is already present in the element, its value is changed to be
that of the value parameter. This value is a simple string; it is not parsed as it is being set. So any markup (such
as syntax to be recognized as an entity reference) is treated as literal text, and needs to be appropriately escaped
by the implementation when it is written out. In order to assign an attribute value that contains entity references,
the user must create an xmlAttr node plus any xmlText and xmlEntityReference nodes, build the appropriate subtree, and
use
setAttributeNode to assign it as the value of an attribute.
To set an attribute with a qualified name and namespace URI, use the setAttributeNS method.
Parameters
name - The name of the attribute to create or alter.
value - Value to set in string form.
Raises
user domException - INVALID_CHARACTER_ERR
Adds a new attribute. If an attribute with the same local name and namespace URI is already present on the element,
its prefix is changed to be the prefix part of the qualifiedName, and its value is changed to be the value parameter.
This value is a simple string; it is not parsed as it is being set. So any markup (such as syntax to be recognized as
an entity reference) is treated as literal text, and needs to be appropriately escaped by the implementation when it
is written out. In order to assign an attribute value that contains entity references, the user must create an Attr
node plus any Text and EntityReference nodes, build the appropriate subtree, and use
setAttributeNodeNS or
setAttributeNode to assign it as the value of an attribute.
Per [XML Namespaces], applications must use the value
.nil as the namespaceURI parameter for methods if they
wish to have no namespace.
Parameters
namespaceURI=.nil - The namespace URI of the attribute to create or alter.
qualifiedName - The qualified name of the attribute to create or alter.
value - The value to set in string form.
Raises
user domException - INVALID_CHARACTER_ERR
user domException - NAMESPACE_ERR
Adds a new attribute node. If an attribute with that name (nodeName) is already present in the element, it is replaced
by the new one. Replacing an attribute node by itself has no effect.
To add a new attribute node with a qualified name and namespace URI, use the setAttributeNodeNS method.
Parameters
newAttr - The xmlAttr node to add to the attribute list.
Returns
attr - If the newAttr attribute replaces an existing attribute, the replaced Attr node is returned, otherwise
.nil is returned.
Raises
user domExcep[tion - WRONG_DOCUMENT_ERR
user domException - INUSE_ATTRIBUTE_ERR
Dynamically referenced by
tryxmldom.rex line 81 "
gpx~setAttributeNode(attr)"
tryxmldom.rex line 84 "
gpx~setAttributeNode(attr)"
tryxmldom.rex line 87 "
gpx~setAttributeNode(attr)"
tryxmldom.rex line 90 "
gpx~setAttributeNode(attr)"
tryxmldom.rex line 93 "
gpx~setAttributeNode(attr)"
tryxmldom.rex line 115 "
link~setAttributeNode(attr)"
tryxmldom.rex line 142 "
bounds~setAttributeNode(attr)"
tryxmldom.rex line 145 "
bounds~setAttributeNode(attr)"
tryxmldom.rex line 148 "
bounds~setAttributeNode(attr)"
tryxmldom.rex line 151 "
bounds~setAttributeNode(attr)"
tryxmldom.rex line 174 "
rtept~setAttributeNode(attr)"
tryxmldom.rex line 177 "
rtept~setAttributeNode(attr)"
tryxmldom.rex line 212 "
trkpt~setAttributeNode(attr)"
tryxmldom.rex line 215 "
trkpt~setAttributeNode(attr)"
xmlDOM.cls line 2817 "
self~nodeStack[1]~setAttributeNode(self~attrNode)"
Adds a new attribute. If an attribute with that local name and that namespace URI is already present in the element,
it is replaced by the new one. Replacing an attribute node by itself has no effect.
Per [XML Namespaces], applications must use the value
.nil as the namespaceURI parameter for methods if they
wish to have no namespace.
Parameters
newAttr - The xmlAttr node to add to the attribute list.
Returns
attr - If the newAttr attribute replaces an existing attribute, the replaced Attr node is returned, otherwise
.nil is returned.
Raises
user domExcep[tion - WRONG_DOCUMENT_ERR
user domException - INUSE_ATTRIBUTE_ERR
If the parameter isId is true, this method declares the specified attribute to be a user-determined ID attribute. This
affects the value of the xmlAttr
isId meyhod and the behavior of the xmlDocument
getElementById method,
but does not change any schema that may be in use, in particular this does not affect the the xmlAttr
schemaTypeInfo property of the specified xmlAttr node.
Use the value
.false for the parameter isId to undeclare an attribute for being a user-determined ID attribute.
To specify an attribute by local name and namespace URI, use the setIdAttributeNS method.
Parameters
name - The name of the attribute.
isId - Whether the attribute is a of type ID.
Raises
user domException - NOT_FOUND_ERR
If the parameter isId is true, this method declares the specified attribute to be a user-determined ID attribute. This
affects the value of the xmlAttr
isId meyhod and the behavior of the xmlDocument
getElementById method,
but does not change any schema that may be in use, in particular this does not affect the the xmlAttr
schemaTypeInfo property of the specified xmlAttr node.
Use the value
.false for the parameter isId to undeclare an attribute for being a user-determined ID attribute.
Parameters
namespaceURI - The namespace URI of the attribute.
localName - The local name of the attribute.
isId - Whether the attribute is a of type ID.
Raises
user domException - NOT_FOUND_ERR
If the parameter isId is true, this method declares the specified attribute to be a user-determined ID attribute. This
affects the value of the xmlAttr
isId meyhod and the behavior of the xmlDocument
getElementById method,
but does not change any schema that may be in use, in particular this does not affect the the xmlAttr
schemaTypeInfo property of the specified xmlAttr node.
Use the value
.false for the parameter isId to undeclare an attribute for being a user-determined ID attribute.
Parameters
idAttr -
isId -
Raises
user domException - NOT_FOUND_ERR
|
Generated on 30 Jul 2015 13:56:58 for xmlDOM for OOrexx by
0.0.1
|