XMLPERS2 : Application that generates arbitrary config files from XML data



  • I developed a nice app that is able to generate arbitrary files (mainly config files of third party applications) from XML files.

    The system is called XMLPERS2 (XML Pratical Extraction and Report System 2).

    Basically it reads two XML files, being one the config XML and the other the template XML :

    Sample config XML:

    <system><config><filesystems><filesystem><name>proc</name>
    <type>proc</type>
    <device>none</device>
    <point>/proc</point>
    <options>defaults,remount</options>
    <dump>0</dump>
    <fsckorder>0</fsckorder></filesystem>
    <filesystem><name>udev</name>
    <type>devtmpfs</type>
    <device>udev</device>
    <point>/dev</point>
    <options>mode=0755,size=10M,nosuid,remount</options>
    <dump>0</dump>
    <fsckorder>0</fsckorder></filesystem>
    <filesystem><name>root</name>
    <type>ext4</type>
    <device>/dev/sda1</device>
    <point>/</point>
    <options>acl,relatime,rw,remount</options>
    <dump>1</dump>
    <fsckorder>1</fsckorder></filesystem>
    <swap>/dev/sda5</swap></filesystems></config></system>

    Sample template XML:

    <template></template>

    Resulting file from parsing:

    #config file !
    filesystem proc of proc on none as /proc with defaults,remount
    filesystem udev of devtmpfs on udev as /dev with mode=0755,size=10M,nosuid,remount
    filesystem root of ext4 on /dev/sda1 as / with acl,relatime,rw,remount
    not a filesystem

    Thats it. I believe such application can be usefull in the pfSense project as a way to simplify the development of packages, allowing integrators to read their configuration from the config.xml file with easy and generate config files compatible with third party apps.


Locked