=== modified file 'dia2code/parse_diagram.c' --- dia2code/parse_diagram.c 2007-12-19 18:33:39 +0000 +++ dia2code/parse_diagram.c 2011-05-28 19:06:32 +0000 @@ -641,53 +641,55 @@ while ( attribute != NULL) { attrtype = xmlGetProp(attribute, "name"); - if ( attrtype != NULL && ! strcmp("ends", attrtype) ) { - tmptype = xmlGetProp(attribute->xmlChildrenNode->xmlChildrenNode->next->next->next->xmlChildrenNode, "val"); - if ( ! strcmp("0", tmptype) ) { - direction = 1; - if (attribute->xmlChildrenNode->xmlChildrenNode->xmlChildrenNode->xmlChildrenNode != NULL) { - name = attribute->xmlChildrenNode->xmlChildrenNode->xmlChildrenNode->xmlChildrenNode->content; - } - tmptype2 = xmlGetProp(attribute->xmlChildrenNode->next->xmlChildrenNode->next->next->next->xmlChildrenNode, "val"); - if (!strcmp("1", tmptype2)) { - composite = 1; - } else { - composite = 0; - } - free(tmptype2); - } else { - direction = 0; - if (attribute->xmlChildrenNode->next->xmlChildrenNode->xmlChildrenNode->xmlChildrenNode != NULL) { - name = attribute->xmlChildrenNode->next->xmlChildrenNode->xmlChildrenNode->xmlChildrenNode->content; - } - tmptype2 = xmlGetProp(attribute->xmlChildrenNode->xmlChildrenNode->next->next->next->xmlChildrenNode, "val"); - if (!strcmp("1", tmptype2)) { - composite = 1; - } else { - composite = 0; - } - free(tmptype2); - } - free(tmptype); - } + + if (attrtype != NULL) { + if ( ! strcmp("name", attrtype) ) { + name = attribute -> xmlChildrenNode -> xmlChildrenNode -> content; + } + + else if ( ! strcmp("direction", attrtype) ) { + tmptype = xmlGetProp(attribute -> xmlChildrenNode, "val"); + if ( !strcmp("0", tmptype) ) { + direction = 1; + } + else { + direction = 0; + } + free(tmptype); + } + + else if ( ! strcmp("assoc_type", attrtype) ) { + tmptype = xmlGetProp(attribute -> xmlChildrenNode, "val"); + if ( !strcmp("1", tmptype) ) { + composite = 0; + } + else { + composite = 1; + } + free(tmptype); + } + } + + if ( ! strcmp("connections", attribute -> name) ) { + end1 = xmlGetProp(attribute->xmlChildrenNode, "to"); + end2 = xmlGetProp(attribute->xmlChildrenNode->next, "to"); + } + free(attrtype); attribute = attribute->next; } - attribute = object->xmlChildrenNode; - while ( attribute != NULL ) { - if ( ! strcmp("connections", attribute->name) ) { - end1 = xmlGetProp(attribute->xmlChildrenNode, "to"); - end2 = xmlGetProp(attribute->xmlChildrenNode->next, "to"); - if (direction == 1) { - associate(classlist, name, composite, end1, end2); - } else { - associate(classlist, name, composite, end2, end1); - } - free(end1); - free(end2); + + if (end1 != NULL && end2 != NULL) { + if (direction == 1) { + associate(classlist, name, composite, end1, end2); + } else { + associate(classlist, name, composite, end2, end1); } - attribute = attribute->next; + free(end1); + free(end2); } + } else if ( ! strcmp("UML - Dependency", objtype) ) { attribute = object->xmlChildrenNode; while ( attribute != NULL ) {