Oracle® XML API Reference
10g Release 1 (10.1) Part No. B10789-01 |
|
Table 15-14 summarizes the methods of available through ElementRef
interface.
Table 15-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. |
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 |
(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
.
oratext* getAttribute( oratext* name) const;
Parameter | Description |
---|---|
name |
name of attribute (data encoding) |
(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
.
oratext* getAttributeNS( oratext* namespaceURI, oratext* localName);
Parameter | Description |
---|---|
namespaceURI |
namespace URI of attribute (data encoding) |
localName |
local name of attribute (data encoding) |
(oratext *)
named attribute's value (in data encoding)
Returns the attribute node given its name.
Node* getAttributeNode( oratext* name) const;
Parameter | Description |
---|---|
name |
name of attribute (data encoding) |
(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.
NodeList< Node>* getElementsByTagName( oratext* name);
Parameter | Description |
---|---|
name |
tag name to match (data encoding) |
(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
oratext* getTagName() const;
(oratext*)
element's name [in data encoding]
Determines if an element has a attribute with the given name
boolean hasAttribute( oratext* name);
Parameter | Description |
---|---|
name |
name of attribute (data encoding) |
(boolean)
TRUE
if element has attribute with given name
Determines if an element has a attribute with the given URI and local name
boolean hasAttributeNS( oratext* namespaceURI, oratext* localName);
Parameter | Description |
---|---|
namespaceURI |
namespace URI of attribute (data encoding) |
localName |
local name of attribute (data encoding) |
(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.
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.
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
Node* removeAttributeNode( AttrRef< Node>& oldAttr) throw (DOMException);
Parameter | Description |
---|---|
oldAttr |
old attribute node |
(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.
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.
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.
Node* setAttributeNode( AttrRef< Node>& newAttr) throw (DOMException);
Parameter | Description |
---|---|
newAttr |
new node |
(Node*)
the attribute node (old or new)
This is the default destructor.
~ElementRef();