|
Sets or retrieves an attribute value for the called element.
virtual std::string element::attribute(1st Variety
xhtml_attribute attrib
);
virtual bool element::attribute(2nd Variety
xhtml_attribute attrib,
const std::string& value
);
An xhtml_attribute
enumerator. For a list of xhtml_attribute
enumerators, see Xport Usage: Enumerations.
A string value which represents the value of the accompanied attribute.
In the first variety, returns the string value of the specified attribute if the attribute is present within the called element, or an empty string
otherwise. In the second variety, returns true
if the attribute is set successfully, false
otherwise.
This operation is used to set or retrieve an attribute value in the called element
. When setting an element's
attribute,
Xport will only allow attributes to be set which are valid attributes for the called element
. The attribute values are represented by
strings. All attribute values will be properly delimeted by single or double quotes when writing the element
or document
,
so there is no need to include the single or double quotes when specifying the attributes value. When retrieving attributes in the second variety
obove, a string value is returned without the single/double quote delimiters.
The first variety above allows the retrieval of a single attribute value. If you wish to determine which attributes are present for a particular
element
, use the elment::attributes() operation, which returns a map of all attibutes present in the
called element
.
Constant