Oracle® Database XML C++ API Reference 11g Release 1 (11.1) Part Number B28389-01 |
|
|
View PDF |
Table 2-14 summarizes the methods available through ElementRef
interface.
Table 2-14 Summary of ElementRef Methods; Dom Package
Function | Summary |
---|---|
|
Constructor. |
|
Get attribute's value given its name. |
|
Get attribute's value given its URI and local name. |
|
Get the attribute node given its name. |
|
Get elements with given tag name. |
|
Get element's tag name. |
|
Check if named attribute exists. |
|
Check if named attribute exists (namespace aware version). |
|
Remove attribute with specified name. |
|
Remove attribute with specified URI and local name. |
|
Remove attribute node |
|
Set new attribute for this element and/or new value. |
|
Set new attribute for the element and/or new value. |
|
Set attribute node. |
|
Public default destructor. |
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
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)
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)
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
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
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]
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
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
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) |
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) |
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
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) |
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) |
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)
This is the default destructor.
Syntax
~ElementRef();