Sha256: 8f79066aeb926cbbc2b8b1616214d46c80445fb90b58b6a36a679b69eb60c92b

Contents?: true

Size: 1.28 KB

Versions: 3

Compression:

Stored size: 1.28 KB

Contents

# Xml parser plugin for Embulk

Embulk parser plugin for parsing xml data by XPath perfectly!

## Features

- namespace awareness
- nullable columns

## Overview

* **Plugin type**: parser
* **Guess supported**: no

## Configuration

- **type**: specify this plugin as `"xpath2"` (string, required)
- **root**: root element to start fetching each entries (string, required)
- **schema**: specify the attribute of table and data type (required)
- **namespaces**: specify namespaces (required)

## Example

```yaml
parser:
  type: xpath2
  root: '/ns1:root/ns2:entry'
  schema:
    - { path: 'ns2:id', name: id, type: long }
    - { path: 'ns2:title', name: title, type: string }
    - { path: 'ns2:meta/ns2:author', name: author, type: string }
    - { path: 'ns2:date', name: date, type: timestamp, format: '%Y%m%d' }
  namespaces: {ns1: 'http://example.com/ns1/', ns2: 'http://example.com/ns2/'}
```

Then you can fetch entries from the following xml:
```xml
<?xml version="1.0"?>
<ns1:root
  xmlns:ns1="http://example.com/ns1/"
  xmlns:ns2="http://example.com/ns2/">
  <ns2:entry>
    <ns2:id>1</ns2:id>
    <ns2:title>Hello!</ns2:title>
    <ns2:meta>
      <ns2:author>maji-KY</ns2:author>
    </ns2:meta>
    <ns2:date>20010101</ns2:date>
  </ns2:entry>
</ns1:root>
```
## Build

```
$ ./gradlew gem
```

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
embulk-parser-xpath2-0.0.3 README.md
embulk-parser-xpath2-0.0.2 README.md
embulk-parser-xpath2-0.0.1 README.md