fluent-plugin-xml-parser 0.0.6 → 0.0.7
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 +4 -4
- data/README.md +4 -2
- data/fluent-plugin-xml-parser.gemspec +1 -1
- data/lib/fluent/plugin/parser_xml.rb +12 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc6edb6678e446430dcf857ec57b5db2ee5b14a7
|
4
|
+
data.tar.gz: 1e1b7b9ad21b0cf34130fa80f5e62e93ee2abc5d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 28ccec9213db86b116f0446f82fb90dba7fd269065f26b63281a3ea560f334052752cbc3a64dddcc119d808ce92facfb540a1abc8739763bd59ee76ae7fd0215
|
7
|
+
data.tar.gz: 5288cc0f49fdf7e3f2e9e21adbcfa304caaccf47abaa41b8727d42dee792d2a89c1e67dc47e42fefd5cda1ef27bede7058664a326c935b9444fa15301e28628d
|
data/README.md
CHANGED
@@ -84,12 +84,14 @@ Configurable options are the following:
|
|
84
84
|
- **attr_xpaths**: indicates attribute name of the target value. Each array with two strings
|
85
85
|
means xpath of the attribute name and the attribute of the XML element (name, text etc).
|
86
86
|
XPath can be omitted as 'null' and specify your own attribute name as the second
|
87
|
-
parameter.
|
87
|
+
parameter. A third element in the array can be used to provide a default value if the XML
|
88
|
+
element is missing.
|
88
89
|
- **value_xpaths**: indicates the target value to be extracted. Each array with two strings
|
89
90
|
means xpath of the target value and the attribute of the XML element (name, text etc) and
|
90
91
|
each value is stored into the Hash with the key specified at an array instance in the
|
91
92
|
**attr_xpaths** with the same index. XPath can be omitted as 'null' and specify your own
|
92
|
-
value as the second parameter.
|
93
|
+
value as the second parameter. A third element in the array can be used to provide a
|
94
|
+
default value if the XML element is missing.
|
93
95
|
|
94
96
|
The extracted fields are packed into Hash structure (record field) to emit the next procedure in fluentd.
|
95
97
|
|
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "fluent-plugin-xml-parser"
|
7
|
-
spec.version = "0.0.
|
7
|
+
spec.version = "0.0.7"
|
8
8
|
spec.authors = ["Toyokazu Akiyama"]
|
9
9
|
spec.email = ["toyokazu@gmail.com"]
|
10
10
|
spec.summary = %q{fluentd xml parser plugin}
|
@@ -71,14 +71,24 @@ module Fluent
|
|
71
71
|
if attr_xpath[0].nil? # when null is specified
|
72
72
|
attr_xpath[1] # second parameter is used as the attribute name
|
73
73
|
else # otherwise, the target attribute name is extracted from XML
|
74
|
-
doc.elements[attr_xpath[0]]
|
74
|
+
el = doc.elements[attr_xpath[0]]
|
75
|
+
unless el.nil? and attr_xpath.size > 2
|
76
|
+
el.method(attr_xpath[1]).call
|
77
|
+
else # unless it's not in the XML and we have a third parameter
|
78
|
+
attr_xpath[2] # then the third parameter is used as the target value
|
79
|
+
end
|
75
80
|
end
|
76
81
|
end
|
77
82
|
values = @value_xpaths.map do |value_xpath|
|
78
83
|
if value_xpath[0].nil? # when null is specified
|
79
84
|
value_xpath[1] # second parameter is used as the target value
|
80
85
|
else # otherwise, the target value is extracted from XML
|
81
|
-
doc.elements[value_xpath[0]]
|
86
|
+
el = doc.elements[value_xpath[0]]
|
87
|
+
unless el.nil? and value_xpath.size > 2
|
88
|
+
el.method(value_xpath[1]).call
|
89
|
+
else # unless it's not in the XML and we have a third parameter
|
90
|
+
value_xpath[2] # then the third parameter is used as the target value
|
91
|
+
end
|
82
92
|
end
|
83
93
|
end
|
84
94
|
attrs.size.times do |i|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-xml-parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Toyokazu Akiyama
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-04-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -88,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
88
88
|
version: '0'
|
89
89
|
requirements: []
|
90
90
|
rubyforge_project:
|
91
|
-
rubygems_version: 2.
|
91
|
+
rubygems_version: 2.6.14.1
|
92
92
|
signing_key:
|
93
93
|
specification_version: 4
|
94
94
|
summary: fluentd xml parser plugin
|