Skip to content

XML parser

XML parser is used for parsing events (or event parts) with a XML structure.

parser_xml.yaml
define:
    name: XML parser
    type: parsec/parser/xml
    field: <custom_field>
    target: <custom_target>

When field is specified, parsing is applied to that field; by default, it is applied to the original event.

When target is specified, the parsed object is stored in the designated target field; by default, it is stored with xml key. The custom target field must adhere to the regular expression xml[0-9a-zA-Z] (beginning with "json" followed by any alphanumeric character).

Example
  1. The following original event with a XML structure is parsed by the XML parser with the default settings:

    <?xml version="1.0" encoding="utf-8"?>
    <AuditMessage xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <EventIdentification EventActionCode="E" EventDateTime="2025-01-01T10:00:00Z"
            EventOutcomeIndicator="0">
            <EventID csd-code="110100" codeSystemName="DCM" originalText="Application Activity" />
            <EventTypeCode csd-code="110120" codeSystemName="DCM" originalText="Application Start" />
        </EventIdentification>
    </AuditMessage>
    
    10_parser.yaml
    define:
        name: XML parser
        type: parsec/parser/xml
    

    The result event will be:

    {
        "xml": <XML object>,
    }