xmlfile

Loads data from the xml file. This command can detect XML file encoding by analyzing the byte order mark (BOM). If you use a wildcard (*) in the file name, you can load all files containing a specific string pattern in the file name at once.

Syntax

xmlfile [OPTIONS] PATH
Required Parameters
PATH

Path to the file from which to load the data. If you use a wildcard (*) in the file name, you can load all files containing a specific string pattern in the file name at once. To load a file, the Logpresso daemon must have the read permission to the file.

Optional Parameters

You can omit options when creating a query. The omitted option is set to the default value.

cs=CHARSET
The encoding of the file (default: utf-8). Nothing specified, this command detects XML file encoding by analyzing BOM. For the encoding name, use the preferred MIME name or aliases registered in the following document: https://www.iana.org/assignments/character-sets/character-sets.xhtml
xpath=EXPR
The XPath (XML path language) expression to be used to select the XML nodes. For XPath, refer to https://www.w3.org/TR/xpath-31/

Usage

  1. Read the report_kr.xml file encoded in EUC-KR.

    xmlfile cs=euc-kr report_kr.html
    
  2. Retrieve the title node information from the first book subnode of the bookstore node in the books.xml file.

    # Download: https://raw.githubusercontent.com/logpresso/dataset/main/books.xml
    | xmlfile xpath="/bookstore/book[1]/title" books.xml