60 void set(
easyDomNode *parent,
string name,
const XML_Char **atts );
61 void printNode( ostream &out,
int recurse_level,
int level );
72 attribute_map[name] = value;
81 vsUMap< string, string >attribute_map;
101 vector< easyDomNode* >::const_iterator siter;
104 tnode->
Tag( tagmap );
111 template <
class domNodeType >
116 void getColor(
char *name,
float color[4] );
137 unsigned int length = strlen( filename );
140 if ( length > 8 && !memcmp( (filename+length-7),
"mission", 7 ) )
145 string rootthis = string(
"/" )+filename;
150 string prefix = (
"../mission/");
155 string prefix = (
"mission/");
160 string prefix = (
"../");
168 xml =
new easyDomFactoryXML;
170 XML_Parser parser = XML_ParserCreate( NULL );
171 XML_SetUserData( parser,
this );
175 XML_Parse( parser, ( f.
ReadFull() ).c_str(), f.
Size(), 1 );
195 XML_ParserFree( parser );
200 static void charHandler(
void *userData,
const XML_Char *s,
int len )
204 xml->
buffer = (
char*) malloc(
sizeof (
char)*(len+1) );
206 xml->buffer = (
char*) realloc( xml->buffer, sizeof (
char)*(len+1+xml->currentindex) );
207 strncpy( xml->buffer+xml->currentindex, s, len );
208 xml->currentindex += len;
213 const int chunk_size = 262144;
216 if ( module_str.empty() )
220 xml =
new easyDomFactoryXML;
222 XML_Parser parser = XML_ParserCreate( NULL );
223 XML_SetUserData( parser,
this );
228 int string_size = module_str.size();
229 int incr = chunk_size-2;
230 int is_final =
false;
232 char buf[chunk_size];
234 int max_index = index+incr;
237 if (max_index >= string_size) {
238 newlen = module_str.size()-index;
240 const char *strbuf = module_str.c_str();
241 memcpy( buf, strbuf+index,
sizeof (
char)*newlen );
244 const char *strbuf = module_str.c_str();
245 memcpy( buf, strbuf+index,
sizeof (
char)*incr );
249 if (index >= string_size)
251 XML_Parse( parser, buf, newlen, is_final );
253 XML_ParserFree( parser );
258 static void beginElement(
void *userData,
const XML_Char *name,
const XML_Char **atts )
262 static void endElement(
void *userData,
const XML_Char *name )
288 bool hasParent =
false;
295 domNodeType *thisnode =
new domNodeType();
296 thisnode->set( parent, name, atts );
300 parent->addChild( thisnode );
308 if (stacktop->Name() != name) {
309 std::cout<<
"error: expected "<<stacktop->Name()<<
" , got "<<name<<std::endl;