JDOM_Node methods

 

JDOM_Node methods

 

Figure 24. The JDOM_Node metaclass

 

The following methods are provided by the JDOM_Node metaclass:

getNodeName () : String;

This method returns the name of the node according to its type.

 

getNodeValue() : String;

This method returns the value of the node according to its type.

 

getNodeType() : JNodeType;

This method returns the type of the node.  This type can be one of the following enumerate values:

·         JNODE_NONE

·         ELEMENT_JNODE

·         ATTRIBUTE_JNODE

·         TEXT_JNODE

·         CDATA_SECTION_JNODE

·         ENTITY_REFERENCE_JNODE

·         ENTITY_JNODE

·         PROCESSING_INSTRUCTION_JNODE

·         COMMENT_JNODE

·         DOCUMENT_JNODE

·         DOCUMENT_TYPE_JNODE

·         DOCUMENT_FRAGMENT_JNODE

·         NOTATION_JNODE

·         XML_DECL_JNODE

 

getParentNode () : JDOM_Node;

This returns the parent node if it has been defined or null if this is not the case.

 

getChildNodes (Inout pChilds [*] JDOM_Node) ;

This method returns the set of child elements of the current node in the pChilds list, and returns null if there are no child elements.

 

Note:      For optimization reasons, the set is not returned, but is instead passed as the InOut parameter.  In this respect, this method differs from the standard DOM API.

 

getFirstChild () : JDOM_Node ;

This returns the first child node of the current node, and returns null if no child nodes exists.

 

getLastChild () : JDOM_Node;

This returns the last child node of the current node, and returns null if no child nodes exist.

 

getPreviousSibling () JDOM_Node;

This returns the sibling node preceding the current node, and returns empty if no sibling nodes exist.

 

getNextSibling () : JDOM_Node;

This returns the next sibling node of the current node, and returns empty if no sibling nodes exist.

 

getAttributes (InOut pAtts [*] JDOM_Node) ;

This returns the list of the current node's attributes if a JDOM_Element is concerned, and returns an empty list if this is not the case.

 

Note:      For optimization reasons, the set is not returned, but is instead passed as the InOut parameter.  In this respect, this method differs from the standard DOM API.

 

getOwnerDocument () : JDOM_Document ;

This returns the node definition document.  If a JDOM_Document of a JDOM_Node linked to a DOM_DocumentTree is concerned, this returns null.

 

cloneNode (In pDeep : boolean) : JDOM_Node;

Please refer to importNode on the JDOM_Document  class.

 

insertBefore(Inout pNewChild: JDOM_Node,

In pRefChild : JDOM_Node):JDOM_Node;

This inserts the pNewChild node before the existing pRefChild node.  If pRefChild is null, pNewChild is inserted after the last child of the current node.

 

replaceChild(Inout pNewChild: JDOM_Node,

InOut pOldChild : JDOM_Node):JDOM_Node;

This replaces pOldChild by pNewChild.  If pNewChild is already present in the JDOM tree, it is first removed from it.

 

removeChild (Inout pOldChild : JDOM_Node) : JDOM_Node;

This removes pOldChild from the list of the current node's children and returns the removed node.

 

appendChild (Inout pNewChild : JDOM_Node) : JDOM_Node;

This adds pNewChild after the last of the current node's children and returns the added node.  If pNewChild is already in the JDOM tree, it is first removed from it.

 

hasChildNodes () : boolean;

This indicates whether the current node has a child or not.

 

setNodeValue (In pValue : String);

This sets the value of the node for each node which accepts a value.