Elektra
0.9.5
|
This plugin is a storage plugin allowing Elektra to read and write XML formatted files. It uses a general format which:
See installation. The package is called libelektra5-xerces
.
To include this plugin in a homebrew installation run brew tap elektrainitiative/elektra
followed by brew install elektrainitiative/elektra/elektra --with-xerces
To mount an XML file we use:
The strength and usage of this plugin is that it supports arbitrary XML files and does not require a specific format. Given the following example of an XML file:
Please note that if the key name does not correspond to the root element of the xml file, the original name gets stored in a metakey called xerces/rootname
. The content of the root element gets mapped to the mount point.
We can observe the following result after mounting:
To export an existing keyset to the XML format:
The root element of the resulting XML file will be "xerces" again, restored via the metadata. If you don't want this behavior, delete the metadata xerces/rootname
on the mount point, then it uses the mount point's name instead.
Xerces-C++ 3.0.0
or newer (apt-get install libxerces-c-dev
or brew install xerces-c
on macOS)FindXercesC.cmake
in /usr/share/cmake-3.0/Modules/
This plugin is not able to handle key names which contain characters that are not allowed to appear as an XML element name. Consider using the rename plugin to take care about proper escaping.
The main rules of an XML element name are:
The root key is not allowed to be an array, as this would correspond to multiple root elements in XML (see the GitHub issue).
XSD transformations, schemas or DTDs are not supported yet.