summaryrefslogtreecommitdiffstats
path: root/src/xmlpythonizer.c
diff options
context:
space:
mode:
authorNima Talebi <nima@autonomy.net.au>2009-05-24 02:17:21 +1000
committerNima Talebi <nima@autonomy.net.au>2009-05-24 02:17:21 +1000
commit6b21c755269a80f3988259157d47430f491448be (patch)
tree88ce4858a715c816fcb7c834f30e6588801a5239 /src/xmlpythonizer.c
parentaf27ba4dd2ffdef8e4ee3abf187475c1b3303f71 (diff)
downloadpython-dmidecode-6b21c755269a80f3988259157d47430f491448be.tar.gz
python-dmidecode-6b21c755269a80f3988259157d47430f491448be.tar.xz
python-dmidecode-6b21c755269a80f3988259157d47430f491448be.zip
Broken commit - change in XML mapping design
Rather than hardcoding the data by function name (e.g. system, bios, connector, slot, etc), create each `type' as an individual XML tree, then group them under user-friendly names (as per the function names). Here the `pythonmap.xml' groups (but does not define) the various types (0..255), the types themselves are however defined in `typemap.xml'. This commit is broken, and a WIP.
Diffstat (limited to 'src/xmlpythonizer.c')
-rw-r--r--src/xmlpythonizer.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/src/xmlpythonizer.c b/src/xmlpythonizer.c
index 836e4da..11766b0 100644
--- a/src/xmlpythonizer.c
+++ b/src/xmlpythonizer.c
@@ -256,6 +256,7 @@ ptzMAP *_do_dmimap_parsing(xmlNode *node) {
// Get the attributes defining key, keytype, value and valuetype
key = dmixml_GetAttrValue(ptr_n, "key");
type_key = _convert_maptype(dmixml_GetAttrValue(ptr_n, "keytype"));
+fprintf(stderr, "%s\n", key);
value = dmixml_GetAttrValue(ptr_n, "value");
type_value = _convert_maptype(dmixml_GetAttrValue(ptr_n, "valuetype"));
@@ -352,14 +353,22 @@ ptzMAP *dmiMAP_ParseMappingXML(xmlDoc *xmlmap, const char *mapname) {
if(wally) {
mapname = dmixml_GetAttrValue(wally, "value");
}
- }
-
- // Find the <Mapping> section matching our request (mapname)
- for( node = node->children->next; node != NULL; node = node->next ) {
- if( xmlStrcmp(node->name, (xmlChar *) "Mapping") == 0) {
- char *name = dmixml_GetAttrValue(node, "name");
- if( (name != NULL) && (strcmp(name, mapname) == 0) ) {
- break;
+ for( node = node->children->next; node != NULL; node = node->next ) {
+ if( xmlStrcmp(node->name, (xmlChar *) "Mapping") == 0) {
+ char *name = dmixml_GetAttrValue(node, "name");
+ if( (name != NULL) && (strcmp(name, mapname) == 0) ) {
+ break;
+ }
+ }
+ }
+ } else {
+ // Find the <Mapping> section matching our request (mapname)
+ for( node = node->children->next; node != NULL; node = node->next ) {
+ if( xmlStrcmp(node->name, (xmlChar *) "Mapping") == 0) {
+ char *name = dmixml_GetAttrValue(node, "name");
+ if( (name != NULL) && (strcmp(name, mapname) == 0) ) {
+ break;
+ }
}
}
}