embulk-parser-flexml 0.0.2 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 80db449622d6691e3e02d13c97d749af6d74376a
4
- data.tar.gz: 165ea230d03e9d226218080b8a4dbd2576b58b73
3
+ metadata.gz: 92b62579f82c0e76101654aba869f42f3dabb546
4
+ data.tar.gz: 2cba4b0dc538c36e78cf4cb7e8f45de6e3047b95
5
5
  SHA512:
6
- metadata.gz: 96315c75ad168d16b595182e726a0a53e1bf9082452351bd67870345ffec23ee46b550e625667b39b8712026ddbf5d4c48279f4dd2eb83bcbf693333b33cbf9b
7
- data.tar.gz: 6fe4566d7f0795964934ba87889a37f3583eba5dc372398f037da816bc5ac54ec1b06f20215f22e8982534ba0d82f0dedc242b9c56ace534825aa39c70d24a34
6
+ metadata.gz: dfb6e1db63ef4e6429609b7403e7797aa151ad69a254e36bd5594c30f677ac62dbff0bd47cc382326dd02a76fe92a25b4c141f3bb2f89445a7b187494ad7093d
7
+ data.tar.gz: df0d9014a134998a1daa214232cb5d609441ea01dbd8bfe2eb07e8a0bc45bdfd6096c8808c70bb921fd92f454f534070bf3f6749bfe351a56a80f0b64cb7baaa
data/README.md CHANGED
@@ -1,2 +1,52 @@
1
1
  # embulk-parser-flexml
2
- Flexible xml parser for embulk - supports xpath and attributes
2
+
3
+ Parser plugin for [Embulk](https://github.com/embulk/embulk).
4
+
5
+ Flexible xml parser for embulk. read data using xpath and from attributes
6
+
7
+ * **Plugin type**: parser
8
+ * **Load all or nothing**: yes
9
+ * **Resume supported**: no
10
+
11
+ ## Configuration
12
+
13
+ - **type**: specify this plugin as `flexml` .
14
+ - **root**: root property to start fetching each entries, specify in *path/to/node* style (string, required)
15
+ - **schema**: specify the attribute of table and data type (required)
16
+ - **name**: name of the attribute (string, required)
17
+ - **type**: type of the attribute (string, required)
18
+ - **attribute**: if specified, value of this attribute will be the output, otherwise child will be the output (string, optional)
19
+ - **xpath**: child element to select (string, required)
20
+
21
+ ## Example
22
+
23
+ ### Configuration
24
+
25
+ ```yaml
26
+ parser:
27
+ type: flexml
28
+ root: Team/Players/Player
29
+ schema:
30
+ - { name: name, type: string, attribute: name }
31
+ - { name: age, type: long, attribute: age }
32
+ - { name: about, type: string, xpath: About }
33
+ - { name: facebook, type: string, xpath: "SocialMedia[@type='facebook']", attribute: url }
34
+ - { name: twitter, type: string, xpath: "SocialMedia[@type='twitter']", attribute: url }
35
+ ```
36
+
37
+ ### XML
38
+
39
+ ```xml
40
+ <?xml version="1.0" encoding="utf-8" standalone="no"?>
41
+ <Team>
42
+ <Players>
43
+ <Player name="Locatelli" age="23">
44
+ <About>
45
+ Manuel Locatelli Cavaliere OMRI (born 8 January 1998) is an Italian professional footballer who plays as a midfielder for Serie A club Juventus, on loan from Serie A club Sassuolo, and the Italy national team.
46
+ </About>
47
+ <SocialMedia type="facebook" url="https://www.facebook.com/locamanuel73"/>
48
+ <SocialMedia type="twitter" url="https://twitter.com/locamanuel73"/>
49
+ </Player>
50
+ </Players>
51
+ </Team>
52
+ ```
@@ -3,7 +3,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
3
 
4
4
  Gem::Specification.new do |spec|
5
5
  spec.name = "embulk-parser-flexml"
6
- spec.version = "0.0.2"
6
+ spec.version = "0.1.0"
7
7
  spec.authors = ["Surya Asriadie"]
8
8
  spec.email = ["surya.asriadie@gmail.com"]
9
9
  spec.summary = %q{Flexible Embulk parser plugin for XML}
@@ -38,8 +38,6 @@ module Embulk
38
38
  values = @task[:schema].map do |f, c|
39
39
  row = if c.has_key?("xpath")
40
40
  XPath.first(e, c["xpath"])
41
- elsif c.has_key?("element")
42
- e.element(c["element"])
43
41
  else
44
42
  e
45
43
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-parser-flexml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Surya Asriadie