extendions and corrections
This commit is contained in:
@@ -163,6 +163,13 @@ namespace xml {
|
||||
Node* _child;
|
||||
};
|
||||
//----------------------------------------------------------------------------
|
||||
class attribute_not_available: public exception {
|
||||
public:
|
||||
attribute_not_available(const Node& t, const std::string& attr) throw():
|
||||
exception("attribute \""+attr+"\" not set", t) {
|
||||
}
|
||||
};
|
||||
//----------------------------------------------------------------------------
|
||||
class stream_error: public exception {
|
||||
public:
|
||||
stream_error(const std::string& reason, const Node& t,
|
||||
@@ -248,7 +255,7 @@ namespace xml {
|
||||
once. This is corect: <code><node
|
||||
attribute="value"></code>, this is not allowed:
|
||||
<code><node attribute="value" attribute="value"></code> */
|
||||
class Attributes: public std::map<std::string, std::string> {
|
||||
class Attributes: public std::map<std::string, std::string> {
|
||||
public:
|
||||
//! Attributes may contain a list of space separated values.
|
||||
typedef std::vector<std::string> List;
|
||||
@@ -324,6 +331,8 @@ namespace xml {
|
||||
Node& attr(const std::string& name, bool mandatory) throw();
|
||||
std::string attr(const std::string& name) const throw();
|
||||
std::string& attr(const std::string& name) throw();
|
||||
const Attributes::Value attribute(const std::string& name)
|
||||
const throw(attribute_not_available);
|
||||
List list(const std::string& name) const throw();
|
||||
bool operator()(const std::string& child) const throw();
|
||||
Node& operator<<(const Node& o) throw(cannot_have_children);
|
||||
|
Reference in New Issue
Block a user