XMLNode* add_child_copy(const XMLNode&);
void add_child_nocopy(XMLNode&);
- std::string attribute_value();
+ std::string attribute_value(); //throws XMLException if attribute doesn't exist
const XMLPropertyList& properties() const { return _proplist; }
XMLProperty const * property(const char*) const;
XMLNode::attribute_value()
{
XMLNodeList children = this->children();
- assert(!_is_content);
- assert(children.size() == 1);
+ if (_is_content)
+ throw XMLException("XMLNode: attribute_value failed (is_content) for requested node: " + name());
+
+ if (children.size() != 1)
+ throw XMLException("XMLNode: attribute_value failed (children.size != 1) for requested node: " + name());
+
XMLNode* child = *(children.begin());
- assert(child->is_content());
+ if (!child->is_content())
+ throw XMLException("XMLNode: attribute_value failed (!child->is_content()) for requested node: " + name());
+
return child->content();
}