cpp-ElementTree
Python ElementTree-alike XML API for C++
Public Member Functions | List of all members
etree::AttrMap Class Reference

Represents a mapping of an Element's attribute names to their values. More...

#include <element.hpp>

Public Member Functions

AttrIterator begin () const
 Produce an AttrIterator pointing to the first attribute.
 
AttrIterator end () const
 Produce an AttrIterator pointing past the last attribute.
 
string get (const QName &qname, const string &default_="") const
 Return an attribute's value, or some default. More...
 
bool has (const QName &qname) const
 Return true if the Element has the named attribute.
 
vector< QNamekeys () const
 Return the QNames of all attributes present on the Element.
 
bool remove (const QName &qname)
 Remove an attribute if it exists, returning true if deletion occured.
 
void set (const QName &qname, const string &s)
 Add or replace attribute's value. More...
 
void set (kv_list attribs)
 C++0x: set multiple attribute values in a single call. More...
 
size_t size () const
 Return the number of attributes the element has.
 

Detailed Description

Represents a mapping of an Element's attribute names to their values.

Member Function Documentation

string etree::AttrMap::get ( const QName qname,
const string &  default_ = "" 
) const

Return an attribute's value, or some default.

Parameters
qnameAttribute QName.
default_String to return if attribute is not found.
void etree::AttrMap::set ( const QName qname,
const string &  s 
)

Add or replace attribute's value.

Parameters
qnameAttribute QName.
sNew attribute value.
void etree::AttrMap::set ( kv_list  attribs)

C++0x: set multiple attribute values in a single call.

Parameters
attribsstd::initializer_list of (QName, value) pairs.

The documentation for this class was generated from the following files: