Skip Headers
Oracle® Database XML C++ API Reference
11g Release 1 (11.1)

B28389-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
PDF · Mobi · ePub

ElementRef Interface

Table 2-14 summarizes the methods available through ElementRef interface.

Table 2-14 Summary of ElementRef Methods; Dom Package

Function Summary

ElementRef()

Constructor.

getAttribute()

Get attribute's value given its name.

getAttributeNS()

Get attribute's value given its URI and local name.

getAttributeNode()

Get the attribute node given its name.

getElementsByTagName()

Get elements with given tag name.

getTagName()

Get element's tag name.

hasAttribute()

Check if named attribute exists.

hasAttributeNS()

Check if named attribute exists (namespace aware version).

removeAttribute()

Remove attribute with specified name.

removeAttributeNS()

Remove attribute with specified URI and local name.

removeAttributeNode()

Remove attribute node

setAttribute()

Set new attribute for this element and/or new value.

setAttributeNS()

Set new attribute for the element and/or new value.

setAttributeNode()

Set attribute node.

~ElementRef()

Public default destructor.



ElementRef()

Class constructor.

Syntax Description
ElementRef(
   const NodeRef< Node>& node_ref,
   Node* nptr);
Used to create references to a given element node after a call to createElement.
ElementRef(
   const ElementRef< Node>& node_ref);
Copy constructor.

Parameter Description
node_ref
reference to provide the context
nptr
referenced node

Returns

(ElementRef) Node reference object


getAttribute()

Returns the value of an element's attribute (specified by name). Note that an attribute may have the empty string as its value, but cannot be NULL.

Syntax

oratext* getAttribute(
   oratext* name) const;
Parameter Description
name
name of attribute (data encoding)

Returns

(oratext*) named attribute's value (in data encoding)


getAttributeNS()

Returns the value of an element's attribute (specified by URI and local name). Note that an attribute may have the empty string as its value, but cannot be NULL.

Syntax

oratext* getAttributeNS(
   oratext* namespaceURI,
   oratext* localName);
Parameter Description
namespaceURI
namespace URI of attribute (data encoding)
localName
local name of attribute (data encoding)

Returns

(oratext *) named attribute's value (in data encoding)


getAttributeNode()

Returns the attribute node given its name.

Syntax

Node* getAttributeNode(
   oratext* name) const;
Parameter Description
name
name of attribute (data encoding)

Returns

(Node*) the attribute node


getElementsByTagName()

Returns a list of all elements with a given tag name, in the order in which they would be encountered in a preorder traversal of the subtree. The tag name should be in the data encoding. The special name "*" matches all tag names; a NULL name matches nothing. Tag names are case sensitive. This function is not namespace aware; the full tag names are compared. The returned list should be freed by the user.

Syntax

NodeList< Node>* getElementsByTagName(
   oratext* name);
Parameter Description
name
tag name to match (data encoding)

Returns

(NodeList< Node>*) the list of elements


getTagName()

Returns the tag name of an element node which is supposed to have the same value as the node name from the node interface

Syntax

oratext* getTagName() const;

Returns

(oratext*) element's name [in data encoding]


hasAttribute()

Determines if an element has a attribute with the given name

Syntax

boolean hasAttribute(
   oratext* name);
Parameter Description
name
name of attribute (data encoding)

Returns

(boolean) TRUE if element has attribute with given name


hasAttributeNS()

Determines if an element has a attribute with the given URI and local name

Syntax

boolean hasAttributeNS(
   oratext* namespaceURI,
   oratext* localName);
Parameter Description
namespaceURI
namespace URI of attribute (data encoding)
localName
local name of attribute (data encoding)

Returns

(boolean) TRUE if element has such attribute


removeAttribute()

Removes an attribute specified by name. The attribute is removed from the element's list of attributes, but the attribute node itself is not destroyed.

Syntax

void removeAttribute(
   oratext* name) throw (DOMException);
Parameter Description
name
name of attribute (data encoding)


removeAttributeNS()

Removes an attribute specified by URI and local name. The attribute is removed from the element's list of attributes, but the attribute node itself is not destroyed.

Syntax

void removeAttributeNS(
   oratext* namespaceURI,
   oratext* localName)
throw (DOMException);
Parameter Description
namespaceURI
namespace URI of attribute (data encoding)
localName
local name of attribute (data encoding)


removeAttributeNode()

Removes an attribute from an element. Returns a pointer to the removed attribute or NULL

Syntax

Node* removeAttributeNode(
   AttrRef< Node>& oldAttr)
throw (DOMException);
Parameter Description
oldAttr
old attribute node

Returns

(Node*) the attribute node (old) or NULL


setAttribute()

Creates a new attribute for an element with the given name and value (which should be in the data encoding). If the named attribute already exists, its value is simply replaced. The name and value are not verified, converted, or checked. The value is not parsed, so entity references will not be expanded.

Syntax

void setAttribute( 
   oratext* name, 
   oratext* value)
throw (DOMException);
Parameter Description
name
names of attribute (data encoding)
value
value of attribute (data encoding)


setAttributeNS()

Creates a new attribute for an element with the given URI, local name and value (which should be in the data encoding). If the named attribute already exists, its value is simply replaced. The name and value are not verified, converted, or checked. The value is not parsed, so entity references will not be expanded.

Syntax

void setAttributeNS( 
   oratext* namespaceURI,
   oratext* qualifiedName, 
   oratext* value)
throw (DOMException);
Parameter Description
namespaceURI
namespace URI of attribute (data encoding)
qualifiedName
qualified name of attribute(data encoding)
value
value of attribute(data encoding)


setAttributeNode()

Adds a new attribute to an element. If an attribute with the given name already exists, it is replaced and a pointer to the old attribute returned. If the attribute is new, it is added to the element's list and a pointer to the new attribute is returned.

Syntax

Node* setAttributeNode( 
   AttrRef< Node>& newAttr)
throw (DOMException);
Parameter Description
newAttr
new node

Returns

(Node*) the attribute node (old or new)


~ElementRef()

This is the default destructor.

Syntax

~ElementRef();