summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNima Talebi <nima@autonomy.net.au>2009-05-27 12:33:51 +1000
committerNima Talebi <nima@autonomy.net.au>2009-05-27 12:33:51 +1000
commit81f781c18d59fa5ec822136f9469fd5b6881ca2a (patch)
treeedf9ab651c94e91c0e909dc248e6b5a2cb287ba8 /src
parent13ff9d7e48ab1574b36473f75701cc7f7c1e461a (diff)
downloadpython-dmidecode-81f781c18d59fa5ec822136f9469fd5b6881ca2a.tar.gz
python-dmidecode-81f781c18d59fa5ec822136f9469fd5b6881ca2a.tar.xz
python-dmidecode-81f781c18d59fa5ec822136f9469fd5b6881ca2a.zip
Fixed WIP from last night (with notes)
Note that this will not work as expected for `group mappings' that have unimplemented `type maps', and this is because the linked-list chain will ne broken at the first unimplemented `type map' There is no reason to code a workaround for this as the type do have to be implemented eventually, and hence added code will merely be noise.
Diffstat (limited to 'src')
-rw-r--r--src/xmlpythonizer.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/src/xmlpythonizer.c b/src/xmlpythonizer.c
index 86bbb69..34f6947 100644
--- a/src/xmlpythonizer.c
+++ b/src/xmlpythonizer.c
@@ -349,6 +349,7 @@ ptzMAP *_do_dmitypemap_parsing(xmlNode *node) {
value = NULL;
key = NULL;
}
+
return retmap;
}
@@ -377,20 +378,23 @@ ptzMAP *_do_dmimap_parsing(xmlNode *node, xmlDoc *xmlmap) {
}
// Loop through it's children
- xmlNode *typemap = xmlDocGetRootElement(xmlmap);
+ xmlNode *typemap = dmixml_FindNode(xmlDocGetRootElement(xmlmap), "TypeMapping");
assert( typemap != NULL );
+ char *type_id;
for( ptr_n = map_n ; ptr_n != NULL; ptr_n = ptr_n->next ) {
- char *type_id = NULL;
-
+ //. TODO: Dazo: I had to add this (if() statement), but not sure why I should need to
+ //. TODO: Needs investigation...
type_id = dmixml_GetAttrValue(ptr_n, "id");
- map_n = dmixml_FindNodeByAttr(typemap, "id", type_id);
- if( tmp != NULL) {
- tmp->next = _do_dmitypemap_parsing(map_n);
- tmp = tmp->next;
- } else {
- tmp = _do_dmitypemap_parsing(map_n);
- retmap = tmp;
+ if(type_id) {
+ map_n = dmixml_FindNodeByAttr(typemap, "id", type_id);
+ if( tmp != NULL) {
+ tmp->next = _do_dmitypemap_parsing(map_n);
+ tmp = tmp->next;
+ } else {
+ retmap = _do_dmitypemap_parsing(map_n);
+ tmp = retmap;
+ }
}
}
return retmap;
@@ -766,7 +770,7 @@ PyObject *_deep_pythonize(PyObject *retdata, ptzMAP *map_p, xmlNode *data_n, int
xpo = _get_xpath_values(xpctx, map_p->value);
if( (xpo == NULL) || (xpo->nodesetval == NULL) || (xpo->nodesetval->nodeNr == 0) ) {
char msg[8094];
- snprintf(msg, 8092, "Could not locate XML path node: %s (Defining key: %s)%c",
+ snprintf(msg, 8092, "Could not locate XML path node (e1): %s (Defining key: %s)%c",
map_p->value, map_p->key, 0);
PyErr_SetString(PyExc_LookupError, msg);
@@ -858,7 +862,7 @@ PyObject *pythonizeXMLnode(ptzMAP *in_map, xmlNode *data_n) {
xpo = _get_xpath_values(xpctx, map_p->rootpath);
if( (xpo == NULL) || (xpo->nodesetval == NULL) || (xpo->nodesetval->nodeNr == 0) ) {
char msg[8094]; //XXX
- snprintf(msg, 8092, "Could not locate XML path node: %s (Defining key: %s)%c",
+ snprintf(msg, 8092, "Could not locate XML path node (e2): %s (Defining key: %s)%c",
map_p->rootpath, map_p->key, 0);
PyErr_SetString(PyExc_LookupError, msg);