OracleJavaScript API Reference for Oracle ADF Faces

 

SUMMARY: FIELD | CONSTR | METHOD    DETAIL: FIELD | CONSTR | METHOD

org.w3c.dom.core
Class NamedNodeMap

org.ecmascript.object.Object
   |
   +--org.w3c.dom.core.NamedNodeMap

public abstract class NamedNodeMap
extends Object
Objects implementing the NamedNodeMap interface are used to represent collections of nodes that can be accessed by name.

Note taht NamedNodeMap objects are not maintained in any particular order and in the DOM are live.

Note that this object is implemented and supported by the web browser and results of its use may vary.



Field Summary

public Number
length
The number of nodes in this map.


Fields inherited from org.ecmascript.object.Object

constructor, prototype


Method Summary

public Node
getNamedItem(String name)
Adds the node newChild to the end of the list of children of this node.
public Node
getNamedItemNS(String namespaceURI, String localName)
Retrieves a node specified by local name and namespace URI.
public Node
item(Number index)
Returns the indexth item in the map.
public Node
removeNamedItem(String name)
Removes a node specified by name.
public Node
removeNamedItemNS(String namespaceURI, String localName)
Removes a node specified by local name and namespace URI.
public Node
setNamedItem(Node arg)
Adds a node using its nodeName attribute.
public Node
setNamedItemNS(Node arg)
Adds a node using its namespaceURI and localName.


Field Detail


length

public Number length

The number of nodes in this map. The range of valid child node indices is 0 to length-1 inclusive.

This is a readonly attribute.

Example:
<div id="doc">
<div>
Text in the first DIV.
</div>
<div id="DDD" class="secondClass">
Some text in the second DIV.
</div>
<div class="thirdClass">
Some text and <span id="SSS">element</span> in the third DIV.
</div>
<div class="fourthClass">
We can try <i>another elements</i>.
It will be much more <b>interesting</b>.
</div>
<div>
Text in the last DIV.
</div>
</div>
JavaScript:
var main = document.getElementById('doc');
var attrNode = main.childNodes[3].attributes;
var output = attrNode.length;

Method Detail


getNamedItem

public Node getNamedItem(String name)

Adds the node newChild to the end of the list of children of this node. If the newChild is already in the tree, it is first removed.

Example:
<div id="doc">
<div>
Text in the first DIV.
</div>
<div >
Some text in the second DIV.
</div>
<div class="thirdClass">
Some text and <span >element</span> in the third DIV.
</div>
<div class="fourthClass">
We can try <i>another elements</i>.
It will be much more <b>interesting</b>.
</div>
<div>
Text in the last DIV.
</div>
</div>
JavaScript:
var main = document.getElementById('doc');
var attrNode = main.childNodes[3].attributes;
var output = attrNode.getNamedItem('class').nodeValue;

Parameters:
name  -  The nodeName of a node to retrieve. of the document fragment are moved into the child list of this node.
Return:
Node - A Node (of any type) with the specified nodeName, or null if it does not identify any node in this map.

getNamedItemNS

public Node getNamedItemNS(String namespaceURI,
                           String localName)

Retrieves a node specified by local name and namespace URI. HTML-only DOM implementations do not need to implement this method.

Introduced in DOM Level 2.

Example:
<div >
<div>
Text in the first DIV.
</div>
<svg:svg id="logo" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="60">
<svg:g style="fill:#3399cc; font-size:36pt; font-family:'dialog'; font-weight: bold">
<svg:a xlink:type="simple" xlink:href="http://www.zvon.org">
<svg:text x="50%" y="65%" text-anchor="middle">ZVON.org</svg:text>
</svg:a>
</svg:g>
</svg:svg>
<apply xmlns="http://www.w3.org/1998/Math/MathML">
<int/>
<bvar>
<ci> x </ci>
</bvar>
<interval>
<ci> a </ci>
<ci> b </ci>
</interval>
<apply>
<cos/>
<ci> x &lt/ci>
</apply>
</apply>
<div>
Text in the last DIV.
</div>
</div>
JavaScript:
var elem = document.getElementsByTagName('svg:a')[0].attributes;
var output = elem.getNamedItemNS('http://www.w3.org/1999/xlink', 'href').value;

Parameters:
namespaceURI  -  The namespace URI of the node to retrieve.
localName  -  The local name of the node to retrieve.
Return:
Node - A Node (of any type) with the specified local nodeName and namespace URI, or null if it does not identify any node in this map.

item

public Node item(Number index)

Returns the indexth item in the map. If index is greater than or equal to the number of nodes in the map, this returns null.

Example:
<div id="doc">
<div>
Text in the first DIV.
</div>
<div >
Some text in the second DIV.
</div>
<div class="thirdClass">
Some text and <span >element</span> in the third DIV.
</div>
<div class="fourthClass">
We can try <i>another elements</i>.
It will be much more <b>interesting</b>.
</div>
<div>
Text in the last DIV.
</div>
</div>
JavaScript:
var main = document.getElementById('doc');
var attrNode = main.childNodes[3].attributes;
var output = attrNode.item(0).nodeValue;

Parameters:
index  -  The Index into this map.
Return:
Node - The node at the indexth position in the NamedNodeMap, or null if that is not a valid index.

removeNamedItem

public Node removeNamedItem(String name)

Removes a node specified by name.
When this map contains the attributes attached to an element and this attribute is known to have a default value, an attribute immediately appears containing the default value as well as the corresponding namespace URI, local name, and prefix when applicable.

Example:
<div >
<div>
Text in the first DIV.
</div>
<div >
Some text in the second DIV.
</div>
<div class="thirdClass">
Some text and <span >element</span> in the third DIV.
</div>
<div class="fourthClass">
We can try <i>another elements</i>.
It will be much more <b>interesting</b>.
</div>
<div>
Text in the last DIV.
</div>
</div>
JavaScript:
var main = document.getElementById('doc');
var attrNode = main.childNodes[3].attributes;
var removedNode = attrNode.removeNamedItem('class');
var output1 = removedNode.nodeValue;
var output2 = attrNode.getNamedItem('class');

Parameters:
name  -  The nodeName of a node to remove.
Return:
Node - The node removed from this map if a node with such a name exists.
Throws:
DOMException NOT_FOUND_ERR: Raised if there is no node named name in this map.
DOMException NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly.

removeNamedItemNS

public Node removeNamedItemNS(String namespaceURI,
                              String localName)

Removes a node specified by local name and namespace URI. A removed attribute may be known to have a default value when this map contains the attributes attached to an element, as returned by the attributes attribute of the Node interface. If so, an attribute immediately appears containing the default value as well as the corresponding namespace URI, local name, and prefix when applicable. HTML-only DOM implementations do not need to implement this method.

Introduced in DOM Level 2.

Example:
<div  xmlns:svg="http://www.w3.org/2000/svg">
<div>
Text in the first DIV.
</div>
<svg:svg >
<svg:g style="fill:#3399cc; font-size:36pt; font-family:'dialog'; font-weight: bold">
<svg:a xlink:type="simple" xlink:href="http://www.zvon.org">
<svg:text x="50%" y="65%" text-anchor="middle">ZVON.org</svg:text>
</svg:a>
</svg:g>
</svg:svg>
<apply xmlns="http://www.w3.org/1998/Math/MathML">
<int/>
<bvar>
<ci> x </ci>
</bvar>
<interval>
<ci> a </ci>
<ci> b </ci>
</interval>
<apply>
<cos/>
<ci> x &lt/ci>
</apply>
</apply>
<div>
Text in the last DIV.
</div>
</div>
JavaScript:
var elem = document.getElementsByTagName('svg:a')[0].attributes;
var removedNode = elem.removeNamedItemNS('http://www.w3.org/1999/xlink', 'href');
var output1 = removedNode.nodeValue;
var output2 = elem.getNamedItemNS('http://www.w3.org/1999/xlink', 'href').value;

Parameters:
namespaceURI  -  The namespace URI of the node to remove.
localName  -  The local name of the node to remove.
Return:
Node - The node removed from this map if a node with such a local name and namespace URI exists.
Throws:
DOMException NOT_FOUND_ERR: Raised if there is no node named name in this map.
DOMException NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly.

setNamedItem

public Node setNamedItem(Node arg)

Adds a node using its nodeName attribute. If a node with that name is already present in this map, it is replaced by the new one.

As the nodeName attribute is used to derive the name which the node must be stored under, multiple nodes of certain types (those that have a "special" string value) cannot be stored as the names would clash. This is seen as preferable to allowing nodes to be aliased.

Example:
<div >
<div>
Text in the first DIV.
</div>
<div >
Some text in the second DIV.
</div>
<div class="thirdClass">
Some text and <span >element</span> in the third DIV.
</div>
<div class="fourthClass">
We can try <i>another elements</i>.
It will be much more <b>interesting</b>.
</div>
<div>
Text in the last DIV.
</div>
</div>
JavaScript:
var main = document.getElementById('doc');
var attrNode = main.childNodes[3].attributes;
var attr = document.createAttribute('temp');
attr.value = 'temporary';
attrNode.setNamedItem(attr);
var output = attrNode.getNamedItem('temp').nodeValue;

Parameters:
arg  -  A node to store in this map. The node will later be accessible using the value of its nodeName attribute.
Return:
Node - If the new Node replaces an existing node the replaced Node is returned, otherwise null is returned.
Throws:
DOMException WRONG_DOCUMENT_ERR: Raised if arg was created from a different document than the one that created this map.
DOMException NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly.
DOMException INUSE_ATTRIBUTE_ERR: Raised if arg is an Attr that is already an attribute of another Element object. The DOM user must explicitly clone Attr nodes to re-use them in other elements.

setNamedItemNS

public Node setNamedItemNS(Node arg)

Adds a node using its namespaceURI and localName. If a node with that namespace URI and that local name is already present in this map, it is replaced by the new one.

HTML-only DOM implementations do not need to implement this method.

Introduced in DOM Level 2.

Example:
<div  xmlns:svg="http://www.w3.org/2000/svg">
<div>
Text in the first DIV.
</div>
<svg:svg >
<svg:g style="fill:#3399cc; font-size:36pt; font-family:'dialog'; font-weight: bold">
<svg:a xlink:type="simple" xlink:href="http://www.zvon.org">
<svg:text x="50%" y="65%" text-anchor="middle">ZVON.org</svg:text>
</svg:a>
</svg:g>
</svg:svg>
<apply xmlns="http://www.w3.org/1998/Math/MathML">
<int/>
<bvar>
<ci> x </ci>
</bvar>
<interval>
<ci> a </ci>
<ci> b </ci>
</interval>
<apply>
<cos/>
<ci> x &lt/ci>
</apply>
</apply>
<div>
Text in the last DIV.
</div>
</div>
JavaScript:
var attrNode = document.getElementById('doc').attributes;
var attr = document.createAttributeNS('http://zvon.org/namespaces/test', 'zvon:temp');
attr.value = 'temporary';
attrNode.setNamedItemNS(attr);
var output = attrNode.getNamedItemNS('http://zvon.org/namespaces/test', 'zvon:temp').nodeValue;

Parameters:
arg  -  A node to store in this map. The node will later be accessible using the value of its namespaceURI and localName attributes.
Return:
Node - If the new Node replaces an existing node the replaced Node is returned, otherwise null is returned.
Throws:
DOMException WRONG_DOCUMENT_ERR: Raised if arg was created from a different document than the one that created this map.
DOMException NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly.
DOMException INUSE_ATTRIBUTE_ERR: Raised if arg is an Attr that is already an attribute of another Element object. The DOM user must explicitly clone Attr nodes to re-use them in other elements.

SUMMARY: FIELD | CONSTR | METHOD    DETAIL: FIELD | CONSTR | METHOD

 

Generated on 2010.03.26 00:15 UTC
Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.