diff options
author | David Sommerseth <davids@redhat.com> | 2009-04-28 16:58:33 +0200 |
---|---|---|
committer | David Sommerseth <davids@redhat.com> | 2009-04-29 11:22:12 +0200 |
commit | 11691f4b5e5786878cca1d30b183103477d5311f (patch) | |
tree | 2f5d0d65e3a0f23622fcca4f367edb7ddc90fe32 /src/xmlpythonizer.h | |
parent | c7be629d44d4e2be6c8116796714e0042a977885 (diff) | |
download | python-dmidecode-11691f4b5e5786878cca1d30b183103477d5311f.tar.gz python-dmidecode-11691f4b5e5786878cca1d30b183103477d5311f.tar.xz python-dmidecode-11691f4b5e5786878cca1d30b183103477d5311f.zip |
Updated xmlpythonizer to support boolean type and dynamic XPath keys
* Added support boolean and list:boolean value types
* Traversing child nodes and having dynamic keys
Now it is possible to do the following:
** test.xml **
<?xml version="1.0" encoding="UTF-8"?>
<testdata>
<list>
<value enabled="1">Option 1</value>
<value enabled="0">Option 2</value>
<value enabled="1">Option 3</value>
</list>
</testdata>
** mapping.xml **
<?xml version="1.0" encoding="UTF-8"?>
<dmidecode_fieldmap version="1">
<Mapping name="example">
<Map keytype="string" key="/testdata/list/value"
valuetype="boolean" value="/testdata/list/value/@enabled"/>
</Mapping>
</dmidecode_fieldmap>
Which should result in:
{'Option 1': True, 'Option 2': False, 'Option 3': True'}
Diffstat (limited to 'src/xmlpythonizer.h')
-rw-r--r-- | src/xmlpythonizer.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/xmlpythonizer.h b/src/xmlpythonizer.h index 4882d81..59cc0cd 100644 --- a/src/xmlpythonizer.h +++ b/src/xmlpythonizer.h @@ -27,8 +27,8 @@ #ifndef _XMLPYTHONIZER_H #define _XMLPYTHONIZER_H -typedef enum ptzTYPES_e { ptzCONST, ptzSTR, ptzINT, ptzFLOAT, - ptzLIST_STR, ptzLIST_INT, ptzLIST_FLOAT, +typedef enum ptzTYPES_e { ptzCONST, ptzSTR, ptzINT, ptzFLOAT, ptzBOOL, + ptzLIST_STR, ptzLIST_INT, ptzLIST_FLOAT, ptzLIST_BOOL, ptzDICT } ptzTYPES; typedef struct ptzMAP_s { |