CL_DomElement::set_attribute - ClanLib Game SDK

Home | All Classes | Grouped Classes | Index | Search

# CL_DomElement::set_attribute

Adds a new attribute.

    	void set_attribute(
    		const std::string& name, const std::string& value);

Detailed description:

If an attribute with that name is already present in the element, its value is changed to be that of the value parameter.

This value is a simple string, it is not parsed as it is being set. So any markup (such as syntax to be recognized as an entity reference) is treated as literal text, and is appropriately escaped by the implementation when it is written out. In order to assign an attribute value that contains entity references, the user must create an Attr node plus any Text and EntityReference nodes, build the appropriate subtree, and use set_attribute_node to assign it as the value of an attribute.

See also:

CL_DomElement

Questions or comments, write to the ClanLib mailing list.