-/* $Id: filter.cpp,v 1.5 2006-01-11 13:13:49 adam Exp $
+/* $Id: filter.cpp,v 1.6 2006-01-11 14:58:28 adam Exp $
Copyright (c) 2005, Index Data.
%LICENSE%
void yp2::filter::Base::configure(const xmlNode * ptr)
{
-
+ yp2::xml::check_empty(ptr);
}
/*
-/* $Id: test_router_flexml.cpp,v 1.14 2006-01-11 11:51:50 adam Exp $
+/* $Id: test_router_flexml.cpp,v 1.15 2006-01-11 14:58:28 adam Exp $
Copyright (c) 2005, Index Data.
%LICENSE%
" <filter id=\"log_cout1\" type=\"log\">\n"
" <message>my msg</message>\n"
" </filter>\n"
- " <filter id=\"tfilter_id\" type=\"tfilter\">\n"
- " <someelement/>\n"
- " </filter>\n"
+ " <filter id=\"tfilter_id\" type=\"tfilter\"/>\n"
" <filter id=\"log_cout2\" type=\"log\">\n"
" <message>other</message>\n"
" </filter>\n"
-/* $Id: xmlutil.cpp,v 1.3 2006-01-11 13:13:49 adam Exp $
+/* $Id: xmlutil.cpp,v 1.4 2006-01-11 14:58:28 adam Exp $
Copyright (c) 2005, Index Data.
%LICENSE%
return node;
}
+void yp2::xml::check_empty(const xmlNode *node)
+{
+ if (node)
+ {
+ const xmlNode *n;
+ for (n = node->children; n; n = n->next)
+ if (n->type == XML_ELEMENT_NODE)
+ throw yp2::XMLError("No child elements allowed inside element "
+ + std::string((const char *) node->name));
+ }
+}
/*
* Local variables:
-/* $Id: xmlutil.hpp,v 1.3 2006-01-11 13:13:49 adam Exp $
+/* $Id: xmlutil.hpp,v 1.4 2006-01-11 14:58:28 adam Exp $
Copyright (c) 2005, Index Data.
%LICENSE%
const xmlNode* jump_to_next(const xmlNode* node, int node_type);
const xmlNode* jump_to_children(const xmlNode* node, int node_type);
+
+ void check_empty(const xmlNode *node);
+
}
class XMLError : public std::runtime_error {
public: