net.beandocument
Class BeanNamedNodeMap

java.lang.Object
  extended bynet.beandocument.BeanNamedNodeMap
All Implemented Interfaces:
org.w3c.dom.NamedNodeMap

public class BeanNamedNodeMap
extends java.lang.Object
implements org.w3c.dom.NamedNodeMap

Map implementation of NamedNodeMap for bean documents

Author:
Jens Scheffler

Constructor Summary
protected BeanNamedNodeMap()
          Default Constructor for a new Named Node Map
 
Method Summary
protected  void add(java.lang.String name, org.w3c.dom.Node node)
          Adds a node to the named node map
 int getLength()
          Retrieves the length of the nodes in the map
 org.w3c.dom.Node getNamedItem(java.lang.String name)
          Retrieves the named item from the map.
 org.w3c.dom.Node getNamedItemNS(java.lang.String namespace, java.lang.String name)
          Retrieves the named item from the map.
 org.w3c.dom.Node item(int index)
          Retrieves the n'th element from the map
 org.w3c.dom.Node removeNamedItem(java.lang.String name)
          Removes the named items from the map.
 org.w3c.dom.Node removeNamedItemNS(java.lang.String namespace, java.lang.String name)
          Removes the named items from the map.
 org.w3c.dom.Node setNamedItem(org.w3c.dom.Node item)
          Sets a named item in the map.
 org.w3c.dom.Node setNamedItemNS(org.w3c.dom.Node item)
          Sets a named item in the map.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BeanNamedNodeMap

protected BeanNamedNodeMap()
Default Constructor for a new Named Node Map

Method Detail

add

protected void add(java.lang.String name,
                   org.w3c.dom.Node node)
Adds a node to the named node map

Parameters:
name - Name of the node to reference
node - Node instance to add

getLength

public int getLength()
Retrieves the length of the nodes in the map

Specified by:
getLength in interface org.w3c.dom.NamedNodeMap
Returns:
Number of items in the node map
See Also:
NamedNodeMap.getLength()

getNamedItem

public org.w3c.dom.Node getNamedItem(java.lang.String name)
Retrieves the named item from the map.

Specified by:
getNamedItem in interface org.w3c.dom.NamedNodeMap
Parameters:
name - Name if the item to retrieve
Returns:
Item object node or null if not existing
See Also:
NamedNodeMap.getNamedItem(java.lang.String)

getNamedItemNS

public org.w3c.dom.Node getNamedItemNS(java.lang.String namespace,
                                       java.lang.String name)
Retrieves the named item from the map. Since this implementation does not support namespace, null will be returned if namespace specified.

Specified by:
getNamedItemNS in interface org.w3c.dom.NamedNodeMap
Parameters:
namespace - Namespace to use
name - Name if the item to retrieve
Returns:
Item object node or null if not existing
See Also:
NamedNodeMap.getNamedItemNS(java.lang.String, java.lang.String)

item

public org.w3c.dom.Node item(int index)
Retrieves the n'th element from the map

Specified by:
item in interface org.w3c.dom.NamedNodeMap
Parameters:
index - Item number to retrieve
Returns:
n'th element of the map
See Also:
NamedNodeMap.item(int)

removeNamedItem

public org.w3c.dom.Node removeNamedItem(java.lang.String name)
                                 throws org.w3c.dom.DOMException
Removes the named items from the map.

Specified by:
removeNamedItem in interface org.w3c.dom.NamedNodeMap
Parameters:
name - Name of the item to remove
Returns:
The node which was just removed or null if not existing
Throws:
org.w3c.dom.DOMException - (never)
See Also:
NamedNodeMap.removeNamedItem(java.lang.String)

removeNamedItemNS

public org.w3c.dom.Node removeNamedItemNS(java.lang.String namespace,
                                          java.lang.String name)
                                   throws org.w3c.dom.DOMException
Removes the named items from the map.

Specified by:
removeNamedItemNS in interface org.w3c.dom.NamedNodeMap
Parameters:
namespace - Namespace to use, only null is supported
name - Name of the item to remove
Returns:
The node which was just removed or null if not existing
Throws:
org.w3c.dom.DOMException - (never)
See Also:
NamedNodeMap.removeNamedItemNS(java.lang.String, java.lang.String)

setNamedItem

public org.w3c.dom.Node setNamedItem(org.w3c.dom.Node item)
                              throws org.w3c.dom.DOMException
Sets a named item in the map.

Specified by:
setNamedItem in interface org.w3c.dom.NamedNodeMap
Parameters:
item - Item to set
Returns:
The node which was just replaced or null if not existing so far
Throws:
org.w3c.dom.DOMException - (never)
See Also:
NamedNodeMap.setNamedItem(org.w3c.dom.Node)

setNamedItemNS

public org.w3c.dom.Node setNamedItemNS(org.w3c.dom.Node item)
                                throws org.w3c.dom.DOMException
Sets a named item in the map. Calling this method will always throw an exception since the map is unmodifiable!

Specified by:
setNamedItemNS in interface org.w3c.dom.NamedNodeMap
Parameters:
item - Item to set - ignored by this implementation
Returns:
(This function will never return normally)
Throws:
org.w3c.dom.DOMException - If method is called
See Also:
NamedNodeMap.setNamedItemNS(org.w3c.dom.Node)