48 std::string tag = n->
tag;
50 tag !=
"STDR_Parser_Root_Node")
53 std::string(
"STDR parser : ") + n->
tag +
54 std::string(
" is not a valid tag") +
55 std::string(
"\nTrail: ");
58 for(
unsigned int i = 0 ; i < n->
elements.size() ; i++)
60 std::string child_tag = n->
elements[i]->tag;
61 std::string child_value = n->
elements[i]->value;
62 if(tag !=
"STDR_Parser_Root_Node" && child_value ==
"")
70 std::string(
"STDR parser : ") + child_tag +
71 std::string(
" is not allowed in a ") + tag + std::string(
" tag") +
72 std::string(
"\nTrail: ");
73 error += std::string(
"\n [") + child_tag + std::string(
"] Line ") +
75 std::string(
" of file '") +
87 if(n->
tag ==
"STDR_Parser_Root_Node")
93 std::string trail(ex.what());
94 trail += std::string(
"\n [") + n->
tag + std::string(
"] Line ") +
96 std::string(
" of file '") +
117 std::string tag = n->
tag;
119 tag !=
"STDR_Parser_Root_Node")
122 std::string(
"STDR parser : ") + n->
tag +
123 std::string(
" is not a valid tag") +
124 std::string(
"\nTrail: ");
127 for(std::set<std::string>::iterator it =
Specs::specs[tag].required.begin()
130 std::vector<int> num = n->
getTag(*it);
134 std::string(
"STDR parser : ") + tag +
135 std::string(
" requires ") + (*it) +
136 std::string(
"\nTrail: ");
140 for(
unsigned int i = 0 ; i < n->
elements.size() ; i++)
148 if(n->
tag ==
"STDR_Parser_Root_Node")
156 std::string trail(ex.what());
157 trail += std::string(
"\n [") + n->
tag + std::string(
"] Line ") +
174 std::string path=base_path_ +
175 std::string(
"/resources/specifications/stdr_multiple_allowed.xml");
177 bool loadOkay = doc.LoadFile(path.c_str());
181 std::string(
"STDR parser : Failed to load file ") +
182 path + std::string(
"'") +
183 std::string(
"\nError was \n\t") + std::string(doc.ErrorDesc());
187 doc.FirstChild()->FirstChild()->Value(),
',');
198 int type = node->Type();
199 std::string node_text(node->Value());
208 if(node_text ==
"specifications")
212 else if(node_text!=
"allowed" && node_text!=
"required" 213 && node_text!=
"default")
223 std::string(
"STDR parser : Multiple instance of '") + node_text +
224 std::string(
"' in specifications.");
236 std::string base_tag (node->Parent()->Parent()->Value());
237 std::string base_type(node->Parent()->Value());
238 if(base_type ==
"allowed")
242 else if(base_type ==
"required")
246 else if(base_type ==
"default")
253 std::string(
"STDR parser : Specification '") + base_tag +
254 std::string(
"' not in 'allowed', 'required' or 'default' : '") +
255 base_type + std::string(
"' / '") + node_text + std::string(
"'");
263 pChild = node->FirstChild();
265 pChild = pChild->NextSibling())
292 std::string path = base_path_ +
293 std::string(
"/resources/specifications/stdr_specifications.xml");
296 bool loadOkay = doc.LoadFile(path.c_str());
300 std::string(
"Failed to load specifications file.\nShould be at '") +
301 path + std::string(
"'\nError was") + std::string(doc.ErrorDesc());
std::string tag
The node value (if it not a tag node)
std::vector< int > getTag(std::string tag)
Searches for a tag in the specific node.
The main namespace for STDR GUI XML parser.
static std::set< std::string > non_mergable_tags
std::string extractFilename(std::string s)
Extracts the filename from an absolute path.
std::string value
The node children.
An element of Specs - represents a valid tag.
static void parseMergableSpecifications(void)
Parses the mergable specifications file.
static void parseSpecifications(TiXmlNode *node)
Low-level recursive function for parsing the xml specifications file.
static void validate(std::string file_name, Node *n)
Performs a required / allowed - validity check on the xml tree.
static std::map< std::string, ElSpecs > specs
List of non-mergable tags. Read from stdr_multiple_allowed.xml.
static void validityRequiredCheck(std::string file_name, Node *n)
Performs a required - validity check on the xml tree.
ROSLIB_DECL std::string getPath(const std::string &package_name)
static void validityAllowedCheck(std::string file_name, Node *n)
Performs a allowed - validity check on the xml tree.
std::set< std::string > explodeString(std::string s, char delimiter)
Explodes a string based on a delimiter.
Implements the main functionalities of the stdr parser tree.
std::string file_origin
Row in the original file.
Validator(void)
Default constructor.
std::vector< Node * > elements
File it was into.
Provides a parser exception. Publicly inherits from std::runtime_error. Used in robot handler...