Kernel::System::SysConfig::XML

NAME

Kernel::System::SysConfig::XML – Manage system configuration settings in XML.

PUBLIC INTERFACE

new()

Create an object. Do not use it directly, instead use:

    use Kernel::System::ObjectManager;
    local $Kernel::OM = Kernel::System::ObjectManager->new();
    my $SysConfigXMLObject = $Kernel::OM->Get('Kernel::System::SysConfig::XML');

SettingListParse()

Parses XML files into a list of perl structures and meta data.

    my $PerlStructure = $SysConfigXMLObject->SettingListParse(
        XMLInput => '
            <?xml version="1.0" encoding="utf-8"?>
            <otrs_config version="2.0" init="Application">
                <Setting Name="Test1" Required="1" Valid="1">
                    <Description Translatable="1">Test 1.</Description>
                    <Navigation>Core::Ticket</Navigation>
                    <Value>
                        <Item ValueType="String" ValueRegex=".*">123</Item>
                    </Value>
                </Setting>
                <Setting Name="Test2" Required="1" Valid="1">
                    <Description Translatable="1">Test 2.</Description>
                    <Navigation>Core::Ticket</Navigation>
                    <Value>
                        <Item ValueType="File">/usr/bin/gpg</Item>
                    </Value>
                </Setting>
            </otrs_config>
        ',
        XMLFilename => 'Test.xml'
    );

Returns:

    [
        {
            XMLContentParsed => {
                Description => [
                    {
                        Content      => 'Test.',
                        Translatable => '1',
                    },
                ],
                Name  => 'Test',
                Required => '1',
                Value => [
                    {
                        Item => [
                            {
                                ValueRegex => '.*',
                                ValueType  => 'String',
                                Content    => '123',
                            },
                        ],
                    },
                ],
                Navigation => [
                    {
                        Content => 'Core::Ticket',
                    },
                ],
                Valid => '1',
            },
            XMLContentRaw => '<Setting Name="Test1" Required="1" Valid="1">
                <Description Translatable="1">Test 1.</Description>
                <Navigation>Core::Ticket</Navigation>
                <Value>
                    <Item ValueType="String" ValueRegex=".*">123</Item>
                </Value>
            </Setting>',
            XMLFilename => 'Test.xml'
        },
    ]
Scroll to Top