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 Parameter
FILE_PATH
Path to the file from which to load the data. Using a wildcard (*) in the file name, you can load all files containing a specific string pattern in the file name at once. For example, if you enter report-*.xml in PATH, you can load all files, such as "report-2022-01-01.xml", "report-2022-01-02.xml" at once. To load a file, the Logpresso daemon must have the read permission to the file.
Optional Parameter

You can omit options when creating a query. The value for the unspecified 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 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.xml
    
  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