xmlDocPtr doc = xmlReadDoc((xmlChar*)strxml, NULL, NULL, 0); parse(xmlDocGetRootElement(doc)); void parse(xmlNodePtr node) { node = node->xmlChildrenNode; while (node != NULL) { if (node->type == XML_ELEMENT_NODE) { if (!xmlStrcasecmp(node->name, (xmlChar*)"place")) { xmlChar *id = xmlGetProp(node, (xmlChar*)"id"); places[(char*)id] = placesno++; lastplace = (char*)id; placesvec.push_back(lastplace); } else if (!xmlStrcasecmp(node->name, (xmlChar*)"text")) { marks[lastplace]= atoi((char*)node->xmlChildrenNode->content); } else if (!xmlStrcasecmp(node->name, (xmlChar*)"transition")) { xmlChar *id = xmlGetProp(node, (xmlChar*)"id"); trans[(char*)id] = transno++; } else if (!xmlStrcasecmp(node->name, (xmlChar*)"arc")) { xmlChar *src = xmlGetProp(node, (xmlChar*)"source"); xmlChar *dest = xmlGetProp(node, (xmlChar*)"target"); arc a; a.src = (char*) src; a.dest = (char*) dest; net.push_back(a); } parse(node); } node = node->next; } }