xml_util.h

Go to the documentation of this file.
00001 /* file name  : xml_util.h
00002  * authors    : Michael Brailsford
00003  * created    : Sun Sep 30 02:09:55 -0500 2007
00004  * copyright  : (c) 2007 Michael Brailsford
00005  */
00006 
00007 #ifndef XML_UTIL_H
00008 #define XML_UTIL_H
00009 
00010 #include <map>
00011 #include <string>
00012 #include <libxml/parser.h>
00013 #include <libxml/xpath.h>
00014 #include <libxml/tree.h>
00015 
00016 #include "point3d.h"
00017 
00018 typedef std::map<std::string, std::string> xml_properties;
00019 
00021 inline xml_properties get_properties(xmlNode * node) {
00022     xmlAttr * props = node->properties;
00023     xml_properties rv;
00024 
00025     _xmlAttr * cur = props;
00026     while ( cur != NULL ) {
00027         rv[(char *)cur->name] = (char *)cur->children->content;
00028         cur = cur->next;
00029     }
00030 
00031     return rv;
00032 }
00033 
00034 inline Point3D parse_vertex(xmlNode * node) {
00035     log_debug("%s", node->name);
00036     xml_properties props = get_properties(node);
00037     return Point3D(props["at"]);
00038 }
00039 #endif
00040 

Generated on Tue Oct 30 22:12:15 2007 for mbrt by  doxygen 1.5.2