Data Source: XML

The XML data source in Polypheny allows querying XML files as collections of documents in the document model. It supports both uploading and linking of XML files. The adapter deduces data types based on attributes specified within the XML content and operates in read-only mode, meaning it does not support DML queries. Background updates to the file are permitted and reflected by this source.

Adapter Configuration

The XML adapter requires the following settings:

  • directory: Specifies the directory containing the XML files. Here either a single file or a directory of XML files can be specified.

Data Type Mappings

The XML adapter allows specifying data types in the attributes of XML elements. The following mapping is used:

XML Type Polypheny Type (PolyType)
boolean PolyBoolean
integer PolyLong
decimal PolyBigDecimal
float PolyFloat
double PolyDouble
date PolyDate
time PolyTime
dateTime PolyTimestamp
base64Binary PolyBinary
hexBinary PolyBinary
list PolyList

If no datatype is specified, the value will always be represented as a string.

Example XML File

Below is an example of an XML file supported by the XML source. In this scenario, the fields are explicitly typed using attributes.

<?xml version="1.0" encoding="UTF-8"?>
<Houses>
    <House>
        <Type type="string">Single Family</Type>
        <Location type="string">123 Maple Street</Location>
        <YearBuilt type="integer">2005</YearBuilt>
        <Price type="decimal">350000</Price>
        <SquareFeet type="integer">2200</SquareFeet>
    </House>
    <House>
        <Type type="string">Condo</Type>
        <Location type="string">456 Oak Avenue</Location>
        <YearBuilt type="integer">2018</YearBuilt>
        <Price type="decimal">275000</Price>
        <SquareFeet type="integer">1200</SquareFeet>
    </House>
</Houses>

Deployment

The adapter can be deployed via Polypheny-UI (Adapters -> Sources). The adapter operates in two modes:

  • Uploading: The file is uploaded to Polypheny; changes to the file are not reflected in Polypheny.
  • Linking: Polypheny accesses the file at a specified location; changes to the file are immediately visible. The file must reside on the same host as Polypheny, and Polypheny must have access rights. The file name should not include spaces.

Upon deployment, XML files are mapped as collections of documents in a new namespace named after the source name. A source named xml1 will thus create a corresponding namespace also called xml1. The source name can be set upon deployment.

© Polypheny GmbH. All Rights Reserved.