XML Parser

LogViewPlus has a built in XML parser which is capable of analyzing your custom XML log files. It does this by parsing your XML file according to a template. A template is a sample XML log entry that has certain fields identified with Conversion Specifiers.

Let's look at a simple XML example:


<name firstName="John" lastName="Doe" />


<other attr1="ignore">ignore</other>

<dateJoined>2014-05-16 10:50:14,125</dateJoined>


This is a XML log entry with five fields: firstName, lastName, employeedId, other, and dateJoined. What we need to do is replace the field data with a Conversion Specifier that identifies the field data type. This might give us the following mapping.

XML Field
Conversion Specifier
LogViewPlus Column
%S{First Name}
First Name
%S{Last Name}
Last Name
%s{Employee Id}
Employee Id
We want to ignore this field.
Date and Time

Therefore, we could parse this XML log entry with the template:


<name firstName="%S{First Name}" lastName="%S{Last Name}" />

<employeeId>%s{Employee Id}</employeeId>



Notice that in the above template the "other" field has been ignored. To ignore a field we simply do not include it in our template. If one of the elements we were interested in had been a child of a parent node, we would have needed to include the parent node in our template. The important thing is that the template has the full path to the target node.

Once we load this template into LogViewPlus it will appear as:

To do this, we just need to give LogViewPlus our parsing template as an argument for the XML parser. We can do this in Parser Mappings:

Whitespace will be ignored, so we are free to format the XML as needed.

Log files parsed with the XML parser support automatic pretty-printing.

Finally, notice the similarities between the XML Parser and the JSON Parser. Both use the concept of templates, so once you have learned one you have basically learned the other.

< >