summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
...
* Added field mapping for dmidecode.slots()David Sommerseth2009-05-201-0/+22
|
* Use correct index value for ↵David Sommerseth2009-05-201-1/+1
| | | | /dmidecode/SystemSlots/SlotCharacteristics/Characteristic/@index
* Added field mapping for dmidecode.baseboard()David Sommerseth2009-05-201-0/+28
|
* Added field mapping for the dmidecode.system() sectionDavid Sommerseth2009-05-201-3/+52
|
* Added support for value type 'list:dict' for field mappingDavid Sommerseth2009-05-202-14/+80
| | | | | | | | | | | | | | This builds up a list of dicts. Syntax is: <Map keytype="constant" key="TestData" valuetype="list:dict" value="/xml/XPath/to/nodes"> <Map keytype="constant" key="field" valuetype="string" key="ValueNode"/> </Map> The parser will iterate all nodes defined in the @value attribute and the root path will of the nested mapping will be using the path in @value as the root path for further parsing.
* Added field python dict mapping for CacheInfoDavid Sommerseth2009-05-201-0/+36
|
* Fixed some errors in the XML layout on CacheInfoDavid Sommerseth2009-05-201-3/+3
|
* Added a few missing commentsDavid Sommerseth2009-05-201-0/+8
|
* Fixed some ugly, unattractive and unhealthy codeNima Talebi2009-05-201-12/+0
| | | | | These hangover lines must have crept in at the early stages of the initial conversion of dmidecode to python-dmidecode. Fixed.
* Reorganised attributes in SystemSlots tagDavid Sommerseth2009-05-151-6/+43
| | | | | | This part of the XML result was not valid due to duplicated tag attributes. Moved some of this specifications from the SystemSlots tag to its own SlotID tag, with even more details.
* Completed mapping the memory sectionDavid Sommerseth2009-05-151-0/+46
|
* Fixed some errors in decoding "3.3.5.9 Processor Characteristics"David Sommerseth2009-05-151-2/+1
| | | | Fixes regression in parsing introduced when rewriting dmidecode to use libxml2
* Added 'emptyValue' attribute in the Map tagDavid Sommerseth2009-05-152-16/+34
| | | | | This attribute defines a default value when XML source data is empty
* Remove 'ns' from the speed_ns attribute in memory sectionDavid Sommerseth2009-05-141-1/+1
|
* Added new Map attribute - emptyIsNoneDavid Sommerseth2009-05-142-14/+59
| | | | | | | | If the emptyIsNone attribute is set to "1", the Python result will be forced to Py_None if the referenced XML value is empty. When checking if the value is empty, the XML value is right trimmed to remove trailing spaces. Only spaces are are removed.
* Support fixed size listsDavid Sommerseth2009-05-142-3/+69
| | | | | | | | | When using one of the list types as valuetype, the Map tag now also supports fixedsize and index_attr attributes. - fixedsize : Defines a fixed size of the list - index_attr : Defines an attribute name of the input XML data which contains the list index for the value
* Fixed another parser issueDavid Sommerseth2009-05-141-111/+122
| | | | | When using rootpath, it did not parse all elements as expected. Also restricted the rootpath to only work when valuetype="dict".
* Avoid segfault if XPATH_NODESET do not contain any dataDavid Sommerseth2009-05-131-1/+6
|
* Added mapping for chassis informationDavid Sommerseth2009-05-131-0/+19
|
* Added mapping for ProcessorInfoDavid Sommerseth2009-05-131-0/+48
|
* Big rewrite of xmlpythonizerDavid Sommerseth2009-05-132-76/+157
| | | | | | | | - Supports relative XPaths now by using the rootpath attribute in the Map tag. This path is then set for all elements inside this Map tag. - Rewrote the parser to recurse correctly. The former version did not recurse well on the very outer (first) Map level.
* Mark CPU as Populated = 'No' when not presentDavid Sommerseth2009-05-131-1/+1
|
* Add all CPU flags, and mark them as available or notDavid Sommerseth2009-05-131-2/+4
| | | | This is to preserve backwards compatibility
* Fixed segfault when processing XPATH_NODESET type and the nodeset is NULLDavid Sommerseth2009-05-131-1/+1
|
* Corrected minor errors in ProcessorInfo XML tagsDavid Sommerseth2009-05-131-2/+3
|
* Improved error handling when parsing mapping XMLDavid Sommerseth2009-05-042-5/+9
|
* Fixed typo in config.h - error in pythonmap.xml filenameDavid Sommerseth2009-05-041-1/+1
|
* Improved setting of pythonmap.xmlDavid Sommerseth2009-04-303-1/+31
| | | | | | The default file is now set to /usr/share/python-dmidecode/pythonmap.xml (defined in config.h) and can be overridden with the dmidecode.pythonmap() function in Python.
* Fixed a bug causing segvDavid Sommerseth2009-04-301-2/+2
| | | | | | | | When calling dmidecode_get_xml(...) several times could cause a crash due to the opt.dmiversion_n pointer being freed by a mistake when the generated dmixml_n got freed later on in the function. Also fixed an assertion typo
* Version number fixNima Talebi2009-05-012-2/+2
|
* Began completing the rewrite of needed dmidecodemodule changesDavid Sommerseth2009-04-305-98/+154
|
* Rewritten dmixml_GetXPathContent(...) and _get_key_value(...)David Sommerseth2009-04-303-37/+53
| | | | | This rewrite was to handle XPATH_NUMBER more correctly. Now these functions needs an preallocated memory buffer for the result.
* Completed mapping the bios sectionDavid Sommerseth2009-04-291-12/+23
|
* Reimplemented the XPath integrationDavid Sommerseth2009-04-291-27/+43
| | | | | | | Now the XPath expressions can include XPath functions as well. The previous implementation only supported XPATH_NODESET results from XPath queries. Now XPATH_STRING and XPATH_NUMBER results are supported as well. XPATH_BOOLEAN might be needed later on.
* Added function for retrieving values from XPath objectsDavid Sommerseth2009-04-292-1/+36
| | | | Reverted commit 75aaf67d43cf4a28fe8d3e07111dab75a0c4396d in addition
* dmidecode: Moved ROMsize size unit into tag attributeDavid Sommerseth2009-04-291-1/+3
|
* Filter out BIOS characteristics with XPath expressionsDavid Sommerseth2009-04-291-19/+16
|
* Revert "Added filter and filtervalue attributes to xmlpythonizer's <Map> tags"David Sommerseth2009-04-292-78/+12
| | | | | | | This reverts commit 4b925a1433b65c217e787804df3cf349d6b387aa. Discovered that XPath got the needed power for filtering, no need for this extra feature
* Exported ptzmap_Free()David Sommerseth2009-04-292-2/+3
|
* Added pythonmap.xml - default XML -> Python mapping setupDavid Sommerseth2009-04-291-7/+28
| | | | Only added mapping for the 'bios' section.
* Added filter and filtervalue attributes to xmlpythonizer's <Map> tagsDavid Sommerseth2009-04-292-12/+78
| | | | | | Using these attributes, only XML data (from the given XPath in 'filter') which matches the value in 'filtervalue' will be added to the Python data.
* Updated xmlpythonizer to support boolean type and dynamic XPath keysDavid Sommerseth2009-04-292-37/+88
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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'}
* Added generic XML -> Python parserDavid Sommerseth2009-04-294-1/+590
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The xmlpythonizer module will convert any XML data (xmlNode or xmlDoc) and format it as a Python object. The formatting is defined in it's own XML file. Basic format: <dmidecode_fieldmap version="1"> <Mapping name="{name of mapping table}"> <Map keytype="{key type}" key="{key value}" valuetype="{value type} value="{value}"/> </Mapping> </dmidecode_fieldmap> The keytype and key attributes defines the key in the Python Dict. The root element will always be a Python Dict structure. The valid key types are: * constant Uses the value in {key} as the key value * string, integer, float Uses a string value from the data XML to be converted to Python. The value set in the key attribute defines an XPath value which points to the data to be used as a Python dict key. Since Python only supports C strings in the C interface for Python dict keys, integer and float will be treated as strings. The valuetype and value attributes are similar to the keys, but with some more features. Valid valuetypes are: * constant The value given in the value attribute will be used in the value in the Python result. * string, integer, float The value given in the value attribute defines the XPath to the data XML, of where to retrieve the value for the given key. The valuetype defines if the data should be understood as a string, integer or float in the Python result. * list:string, list:integer, list:float This does the same as the string, integer or float type, with a tweak. The data will be put into a list. If the XPath given returns multiple nodes, all of them will be added to this list. * dict The dict valuetype is more special. It should not contain any value attribute. On the other hand, it should contain a sub-level of <Map> tags. In this way, you can build up a multi dimensional Python dict. Example: ** pythonmap.xml ** <?xml version="1.0" encoding="UTF-8"?> <dmidecode_fieldmap version="1"> <Mapping name="example_map"> <Map keytype="constant" key="DemoCase" valuetype="constant" value="XML Pythonizing"/> <Map keytype="constant" key="String1" valuetype="string" value="/example/string1"/> <Map keytype="constant" key="AttribString1" valuetype="integer" value="/example/string1/@int_value"/> <Map keytype="string" key="/example/keyset/@value" valuetype="dict"> <Map keytype="constant" key="Value1" valuetype="string" value="/example/keyset/value1"/> <Map keytype="constant" key="ValueList" valuetype="list:string" value="/example/keyset/valuelist"/> </Map> </Mapping> </dmidecode_fieldmap> ** exampledata.xml ** <?xml version="1.0" encoding="UTF-8"?> <example> <string1 int_value="1234">String value #1</string1> <keyset value="TestData"> <value1>More test data</value1> <valuelist>Value1 in list</valuelist> <valuelist>Value2 in list</valuelist> <valuelist>Value3 in list</valuelist> </keyset> </example> ** C code snippet ** void xmlpythonizer() { xmlDoc *xmlmap = NULL; xmlDoc *xmldata = NULL; ptzMAP *mapping = NULL; PyObject *pythondata = NULL; // Read XML files xmlmap = xmlReadFile("pythonmap.xml", NULL, 0); xmldata = xmlReadFile("exampledata.xml", NULL, 0); // Parse the mapping XML mapping = dmiMAP_ParseMappingXML(xmlmap, "example_map"); // Parse the xmldata into a Python object pythondata = pythonizeXMLdoc(mapping, xmldata); // ..... the program continues to do something useful } The result stored inside the pythondata object should now be something similar to: {'DemoCase': 'XML Pythonizing', 'String1': 'String value #1', 'AttribString1: 1234, 'TestData': {'Value1': 'More test data', 'ValueList': ['Value1 in list','Value2 in list','Value3 in list']} }
* Only consider XML nodes which is of XML_ELEMENT_NODE when finding a specific ↵David Sommerseth2009-04-291-1/+2
| | | | node
* Don't return NULL in dmixml_GetContent(...)David Sommerseth2009-04-291-1/+1
|
* Fixed compiler error due to API changesDavid Sommerseth2009-04-291-1/+1
| | | | This fixes a regression from commit 7f0fa9b2e1afd6aecea0b34b62cf9ebdf075164d
* More XML cleanupDavid Sommerseth2009-04-291-11/+9
|
* Cleaned up the XML dataDavid Sommerseth2009-04-293-374/+79
|
* Do not add XML values if input is "(null)"David Sommerseth2009-04-291-3/+10
|
* Added right trim of xml dataDavid Sommerseth2009-04-291-0/+7
|