xml_parser 0.3.1 → 0.3.2
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/lib/xml_parser/document.rb +17 -0
- data/lib/xml_parser/version.rb +1 -1
- data/xml_parser.gemspec +1 -1
- 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: 98a5fc0719d620a1f7778f325fa84790bddebd1b
|
4
|
+
data.tar.gz: aa967cb4fa2a611211a5d53daee4ddba4427e3a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 911cd14d34160dc528fa5e3992d57c3effe48270858d8f6caf610ab744b63faaec8cb1b49d44116f2c6c7b5bb63930eef0b2dee24eddf957b31dba87537f94df
|
7
|
+
data.tar.gz: 24354755fe0d9d5828c6604a19ae8cf9dad973bf219dcd6f6a6828ba7a45fcc28f8715f98d651cfec08919954848457065465308fdfe91316ae0084ef754278c
|
data/lib/xml_parser/document.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require "rexml/document"
|
2
|
+
require "rexml/formatters/default"
|
2
3
|
require "yaml"
|
3
4
|
require "pp"
|
4
5
|
|
@@ -52,6 +53,22 @@ module XmlParser
|
|
52
53
|
}
|
53
54
|
end
|
54
55
|
|
56
|
+
# if xpath match, to string.
|
57
|
+
# @param [String] xpath xpath
|
58
|
+
# @return [String] xpath match result.
|
59
|
+
def xpath_to_s(xpath)
|
60
|
+
|
61
|
+
formatter = REXML::Formatters::Default.new
|
62
|
+
out = StringIO.new
|
63
|
+
|
64
|
+
# search by xpath.
|
65
|
+
REXML::XPath.match(@doc, xpath).each { |elm|
|
66
|
+
formatter.write(elm, out)
|
67
|
+
}
|
68
|
+
|
69
|
+
out.string
|
70
|
+
end
|
71
|
+
|
55
72
|
# xml decl info.
|
56
73
|
# @return [REXML::XMLDecl] xml decl
|
57
74
|
def decl
|
data/lib/xml_parser/version.rb
CHANGED
data/xml_parser.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ["corporation.ore@gmail.com"]
|
11
11
|
|
12
12
|
spec.summary = %q{Parse Xml Document and String.}
|
13
|
-
spec.description = %q{Parse Xml Document and String.From String, and File.}
|
13
|
+
spec.description = %q{Parse Xml Document and String. From String, Hash and XML File, Yaml File.}
|
14
14
|
spec.homepage = "https://github.com/h-shigemoto/xml_parser"
|
15
15
|
spec.license = "MIT"
|
16
16
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xml_parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- h.shigemoto
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-08-
|
11
|
+
date: 2016-08-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,7 +52,7 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.0'
|
55
|
-
description: Parse Xml Document and String.From String, and File.
|
55
|
+
description: Parse Xml Document and String. From String, Hash and XML File, Yaml File.
|
56
56
|
email:
|
57
57
|
- corporation.ore@gmail.com
|
58
58
|
executables: []
|