xml-motor 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +53 -0
- data/README +16 -52
- data/lib/xml-motor.rb +10 -0
- data/lib/xml-motor/version.rb +1 -1
- data/xml-motor.gemspec +5 -5
- metadata +43 -34
data/CHANGELOG
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
======================================================================
|
2
|
+
|
3
|
+
\\// ||\/|| || _ ||\/|| ||@|| ~++~ ||@|| ||))
|
4
|
+
//\\ || || ||_ || || ||_|| || ||_|| ||\\
|
5
|
+
|
6
|
+
======================================================================
|
7
|
+
=====================================================================
|
8
|
+
CHANGE-LOG
|
9
|
+
=====================================================================
|
10
|
+
Changes from v0.1.0 to v0.1.1
|
11
|
+
[] cleaned up usage for XML Mining of Pre-processed data
|
12
|
+
for e.g.
|
13
|
+
nodes_ = XMLMotor.splitter <<XMLCONTENT>>
|
14
|
+
tags_ = XMLMotor.indexify nodes_
|
15
|
+
nodes_array = XMLMotor.xmldata nodes_, tags_, nil, "ATTRIB_KEY=ATTRIB_VALUE", true
|
16
|
+
=====================================================================
|
17
|
+
Changes from v0.0.10 to v0.1.0
|
18
|
+
[] support added to search for xml nodes just by using their attributes without any tag-name
|
19
|
+
for e.g.
|
20
|
+
nodes_array = XMLMotorEngine.pre_processed_content nodes_, tags_, nil, "ATTRIB_KEY=ATTRIB_VALUE", true
|
21
|
+
nodes_array = XMLMotorEngine.pre_processed_content nodes_, tags_, nil, ["ATTRIB_KEY=ATTRIB_VALUE"], true
|
22
|
+
nodes_array = XMLMotorEngine.pre_processed_content nodes_, tags_, nil, ["KEY1=VALUE1", "KEY2=VALUE2"...]
|
23
|
+
=====================================================================
|
24
|
+
Changes from v0.0.9 to v0.0.10
|
25
|
+
[] xml tag name match corrected to be case-insensitive
|
26
|
+
=====================================================================
|
27
|
+
Changes from v0.0.8 to v0.0.9
|
28
|
+
[] option to filter result for multiple attributes key-value pair if sent as an array of "ATTRIB_KEY = ATTRIB_VALUE"
|
29
|
+
for e.g.
|
30
|
+
nodes_array = XMLMotorEngine.pre_processed_content nodes_, tags_, "_TAG_", "ATTRIB_KEY=ATTRIB_VALUE", true
|
31
|
+
nodes_array = XMLMotorEngine.pre_processed_content nodes_, tags_, "_TAG_", ["ATTRIB_KEY=ATTRIB_VALUE"], true
|
32
|
+
nodes_array = XMLMotorEngine.pre_processed_content nodes_, tags_, "_TAG_", ["KEY1=VALUE1", "KEY2=VALUE2"...], true
|
33
|
+
=====================================================================
|
34
|
+
Changes from v0.0.7 to v0.0.8
|
35
|
+
[] avail the result inclusive of root-node-value with an extra 'true' after attrib/nil
|
36
|
+
for e.g.
|
37
|
+
XMLMotor.get_node_from_content "<a><b id=\"2\">a.b</b></a>", "b", nil, true
|
38
|
+
XMLMotor.get_node_from_content "<a><b id=\"2\">a.b</b></a>", "b", "id='2'", true
|
39
|
+
both of above would give
|
40
|
+
["<b id=\"2\">a.b</b>"]
|
41
|
+
=====================================================================
|
42
|
+
Changes from v0.0.6 to v0.0.7
|
43
|
+
[] correcting the attribute matching to be sensitive to single and double quotes
|
44
|
+
=====================================================================
|
45
|
+
Changes from v0.0.5 to v0.0.6
|
46
|
+
[] correcting the attribute parsing to handle line-change well, corrected my mistake
|
47
|
+
=====================================================================
|
48
|
+
Changes from v0.0.3 to v0.0.4
|
49
|
+
[] 2 stupid mistakes corrected
|
50
|
+
+ one in file-based xml parsing
|
51
|
+
+ attrib match corrected for null attribs
|
52
|
+
=====================================================================
|
53
|
+
=====================================================================
|
data/README
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
//\\ || || ||_ || || ||_|| || ||_|| ||\\
|
5
5
|
|
6
6
|
======================================================================
|
7
|
-
v 0.
|
7
|
+
v 0.1.1
|
8
8
|
|
9
9
|
@GitHub: https://github.com/abhishekkr/rubygem_xml_motor
|
10
10
|
@RubyGems: http://rubygems.org/gems/xml-motor
|
@@ -27,6 +27,21 @@ An easy-to-use XML Parser without any Native Dependencies.
|
|
27
27
|
+ 'require' the 'xml-motor'
|
28
28
|
|
29
29
|
Usage:
|
30
|
+
[[ To Search More Than One QUERIES ]]
|
31
|
+
str = {XML_DATA}
|
32
|
+
nodes_ = XMLMotor.splitter str
|
33
|
+
tags_ = XMLMotor.indexify nodes_
|
34
|
+
nodes_array = XMLMotor.xmldata nodes_, tags_, "_TAG_"
|
35
|
+
nodes_array = XMLMotor.xmldata nodes_, tags_, "_TAG_", "ATTRIB_KEY=ATTRIB_VALUE"
|
36
|
+
nodes_array = XMLMotor.xmldata nodes_, tags_, nil, "ATTRIB_KEY=ATTRIB_VALUE"
|
37
|
+
>>>>> for having root-node-tag also in returned result <<<<<
|
38
|
+
nodes_array = XMLMotor.xmldata nodes_, tags_, "_TAG_", nil, true
|
39
|
+
nodes_array = XMLMotor.xmldata nodes_, tags_, "_TAG_", "ATTRIB_KEY=ATTRIB_VALUE", true
|
40
|
+
nodes_array = XMLMotor.xmldata nodes_, tags_, "_TAG_", ["ATTRIB_KEY=ATTRIB_VALUE"], true
|
41
|
+
nodes_array = XMLMotor.xmldata nodes_, tags_, "_TAG_", ["KEY1=VALUE1", "KEY2=VALUE2"...], true
|
42
|
+
nodes_array = XMLMotor.xmldata nodes_, tags_, nil, ["KEY1=VALUE1", "KEY2=VALUE2"...], true
|
43
|
+
nodes_array = XMLMotor.xmldata nodes_, tags_, nil, "ATTRIB_KEY=ATTRIB_VALUE", true
|
44
|
+
|
30
45
|
[[ To Search Just One QUERY ]]
|
31
46
|
nodes_array = XMLMotor.get_node_from_file "_XML_FILE_", "_TAG_"
|
32
47
|
nodes_array = XMLMotor.get_node_from_file "_XML_FILE_", "_TAG_", "ATTRIB_KEY=ATTRIB_VALUE"
|
@@ -42,20 +57,6 @@ An easy-to-use XML Parser without any Native Dependencies.
|
|
42
57
|
nodes_array = XMLMotor.get_node_from_content "_XML_DATA_", "_TAG_", ["KEY1=VALUE1", "KEY2=VALUE2"...], true
|
43
58
|
nodes_array = XMLMotor.get_node_from_content "_XML_DATA_", nil, "ATTRIB_KEY=ATTRIB_VALUE", true
|
44
59
|
nodes_array = XMLMotor.get_node_from_content "_XML_DATA_", nil, ["KEY1=VALUE1", "KEY2=VALUE2"...], true
|
45
|
-
[[ To Search More Than One QUERIES ]]
|
46
|
-
str = {XML_DATA}
|
47
|
-
nodes_ = XMLMotorEngine._splitter_ str
|
48
|
-
tags_ = XMLMotorEngine._indexify_ nodes_
|
49
|
-
nodes_array = XMLMotorEngine.pre_processed_content nodes_, tags_, "_TAG_"
|
50
|
-
nodes_array = XMLMotorEngine.pre_processed_content nodes_, tags_, "_TAG_", "ATTRIB_KEY=ATTRIB_VALUE"
|
51
|
-
nodes_array = XMLMotorEngine.pre_processed_content nodes_, tags_, nil, "ATTRIB_KEY=ATTRIB_VALUE"
|
52
|
-
>>>>> for having root-node-tag also in returned result <<<<<
|
53
|
-
nodes_array = XMLMotorEngine.pre_processed_content nodes_, tags_, "_TAG_", nil, true
|
54
|
-
nodes_array = XMLMotorEngine.pre_processed_content nodes_, tags_, "_TAG_", "ATTRIB_KEY=ATTRIB_VALUE", true
|
55
|
-
nodes_array = XMLMotorEngine.pre_processed_content nodes_, tags_, "_TAG_", ["ATTRIB_KEY=ATTRIB_VALUE"], true
|
56
|
-
nodes_array = XMLMotorEngine.pre_processed_content nodes_, tags_, "_TAG_", ["KEY1=VALUE1", "KEY2=VALUE2"...], true
|
57
|
-
nodes_array = XMLMotorEngine.pre_processed_content nodes_, tags_, nil, ["KEY1=VALUE1", "KEY2=VALUE2"...], true
|
58
|
-
nodes_array = XMLMotorEngine.pre_processed_content nodes_, tags_, nil, "ATTRIB_KEY=ATTRIB_VALUE", true
|
59
60
|
|
60
61
|
Example Calls As Code:
|
61
62
|
+ XMLMotor.get_node_from_content "<A>a</A><B><A>ba</A></B>", "A"
|
@@ -67,40 +68,3 @@ An easy-to-use XML Parser without any Native Dependencies.
|
|
67
68
|
|
68
69
|
=====================================================================
|
69
70
|
=====================================================================
|
70
|
-
CHANGE-LOG
|
71
|
-
=====================================================================
|
72
|
-
Changes from v0.0.10 to v0.1.0
|
73
|
-
[] support added to search for xml nodes just by using their attributes without any tag-name
|
74
|
-
for e.g.
|
75
|
-
nodes_array = XMLMotorEngine.pre_processed_content nodes_, tags_, nil, "ATTRIB_KEY=ATTRIB_VALUE", true
|
76
|
-
nodes_array = XMLMotorEngine.pre_processed_content nodes_, tags_, nil, ["ATTRIB_KEY=ATTRIB_VALUE"], true
|
77
|
-
nodes_array = XMLMotorEngine.pre_processed_content nodes_, tags_, nil, ["KEY1=VALUE1", "KEY2=VALUE2"...]
|
78
|
-
=====================================================================
|
79
|
-
Changes from v0.0.9 to v0.0.10
|
80
|
-
[] xml tag name match corrected to be case-insensitive
|
81
|
-
=====================================================================
|
82
|
-
Changes from v0.0.8 to v0.0.9
|
83
|
-
[] option to filter result for multiple attributes key-value pair if sent as an array of "ATTRIB_KEY = ATTRIB_VALUE"
|
84
|
-
for e.g.
|
85
|
-
nodes_array = XMLMotorEngine.pre_processed_content nodes_, tags_, "_TAG_", "ATTRIB_KEY=ATTRIB_VALUE", true
|
86
|
-
nodes_array = XMLMotorEngine.pre_processed_content nodes_, tags_, "_TAG_", ["ATTRIB_KEY=ATTRIB_VALUE"], true
|
87
|
-
nodes_array = XMLMotorEngine.pre_processed_content nodes_, tags_, "_TAG_", ["KEY1=VALUE1", "KEY2=VALUE2"...], true
|
88
|
-
=====================================================================
|
89
|
-
Changes from v0.0.7 to v0.0.8
|
90
|
-
[] avail the result inclusive of root-node-value with an extra 'true' after attrib/nil
|
91
|
-
for e.g.
|
92
|
-
XMLMotor.get_node_from_content "<a><b id=\"2\">a.b</b></a>", "b", nil, true
|
93
|
-
XMLMotor.get_node_from_content "<a><b id=\"2\">a.b</b></a>", "b", "id='2'", true
|
94
|
-
both of above would give
|
95
|
-
["<b id=\"2\">a.b</b>"]
|
96
|
-
=====================================================================
|
97
|
-
Changes from v0.0.6 to v0.0.7
|
98
|
-
[] correcting the attribute matching to be sensitive to single and double quotes
|
99
|
-
=====================================================================
|
100
|
-
Changes from v0.0.5 to v0.0.6
|
101
|
-
[] correcting the attribute parsing to handle line-change well, corrected my mistake
|
102
|
-
=====================================================================
|
103
|
-
Changes from v0.0.3 to v0.0.4
|
104
|
-
[] 2 stupid mistakes corrected
|
105
|
-
+ one in file-based xml parsing
|
106
|
-
+ attrib match corrected for null attribs
|
data/lib/xml-motor.rb
CHANGED
@@ -235,5 +235,15 @@ module XMLMotor
|
|
235
235
|
end
|
236
236
|
return ""
|
237
237
|
end
|
238
|
+
|
239
|
+
def self.splitter(xmldata)
|
240
|
+
XMLMotorEngine._splitter_ xmldata
|
241
|
+
end
|
242
|
+
def self.indexify(nodes=nil)
|
243
|
+
XMLMotorEngine._indexify_ nodes
|
244
|
+
end
|
245
|
+
def self.xmldata(nodes, tags=nil, tag_to_find=nil, attrib_to_find=nil, with_tag=false)
|
246
|
+
XMLMotorEngine.pre_processed_content nodes, tags, tag_to_find, attrib_to_find, with_tag
|
247
|
+
end
|
238
248
|
end
|
239
249
|
|
data/lib/xml-motor/version.rb
CHANGED
data/xml-motor.gemspec
CHANGED
@@ -6,7 +6,7 @@ Gem::Specification.new do |s|
|
|
6
6
|
s.name = "xml-motor"
|
7
7
|
s.version = Xml::Motor::VERSION
|
8
8
|
s.authors = ["abhishekkr"]
|
9
|
-
s.email = ["
|
9
|
+
s.email = ["abhikumar163@gmail.com"]
|
10
10
|
s.homepage = "http://github.com/abhishekkr/rubygem_xml_motor"
|
11
11
|
s.summary = %q{An easy-to-use XML Parser without any Native Dependencies}
|
12
12
|
s.description = %q{A new short XML Parsing Algorithm implemented directly in >500 lines. An easy-to-use XML Parser without any Native Dependencies.
|
@@ -25,10 +25,10 @@ Gem::Specification.new do |s|
|
|
25
25
|
nodes_array = XMLMotor.get_node_from_content "_XML_DATA_", "ATTRIB_KEY=ATTRIB_VALUE"
|
26
26
|
[[ To Search More Than One QUERIES ]]
|
27
27
|
str = {XML_DATA}
|
28
|
-
nodes_ =
|
29
|
-
tags_ =
|
30
|
-
nodes_array =
|
31
|
-
nodes_array =
|
28
|
+
nodes_ = XMLMotor.splitter str
|
29
|
+
tags_ = XMLMotor.indexify nodes_
|
30
|
+
nodes_array = XMLMotor.xmldata nodes_, tags_, "_TAG_"
|
31
|
+
nodes_array = XMLMotor.xmldata nodes_, tags_, "_TAG_", "ATTRIB_KEY=ATTRIB_VALUE"
|
32
32
|
|
33
33
|
Example Calls As Code:
|
34
34
|
+ XMLMotor.get_node_from_content "<A>a</A><B><A>ba</A></B>", "A"
|
metadata
CHANGED
@@ -1,28 +1,40 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: xml-motor
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
|
-
authors:
|
7
|
+
authors:
|
7
8
|
- abhishekkr
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
|
12
|
-
date: 2012-01-25 00:00:00 +05:30
|
13
|
-
default_executable:
|
12
|
+
date: 2012-03-05 00:00:00.000000000 Z
|
14
13
|
dependencies: []
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
-
|
14
|
+
description: ! "A new short XML Parsing Algorithm implemented directly in >500 lines.
|
15
|
+
An easy-to-use XML Parser without any Native Dependencies.\n \n [How
|
16
|
+
To Use]: https://github.com/abhishekkr/rubygem_xml_motor/raw/master/README \n\n
|
17
|
+
\ Loading:\n + $ gem install xml-motor\n + 'require' the 'xml-motor'\n\n
|
18
|
+
\ Usage:\n [[ To Search Just One QUERY ]]\n nodes_array
|
19
|
+
= XMLMotor.get_node_from_file \"_XML_FILE_\"\n nodes_array = XMLMotor.get_node_from_file
|
20
|
+
\"_XML_FILE_\", \"ATTRIB_KEY=ATTRIB_VALUE\"\n nodes_array = XMLMotor.get_node_from_content
|
21
|
+
\"_XML_DATA_\"\n nodes_array = XMLMotor.get_node_from_content \"_XML_DATA_\",
|
22
|
+
\"ATTRIB_KEY=ATTRIB_VALUE\"\n [[ To Search More Than One QUERIES ]]\n
|
23
|
+
\ str = {XML_DATA}\n nodes_ = XMLMotor.splitter str\n tags_
|
24
|
+
= XMLMotor.indexify nodes_\n nodes_array = XMLMotor.xmldata nodes_,
|
25
|
+
tags_, \"_TAG_\"\n nodes_array = XMLMotor.xmldata nodes_, tags_, \"_TAG_\",
|
26
|
+
\"ATTRIB_KEY=ATTRIB_VALUE\"\n\n Example Calls As Code:\n + XMLMotor.get_node_from_content
|
27
|
+
\"<A>a</A><B><A>ba</A></B>\", \"A\"\n RETURNS: [\"a\", \"ba\"]\n +
|
28
|
+
XMLMotor.get_node_from_content \"<A>a</A><B><A>ba</A></B>\", \"B.A\"\n RETURNS:
|
29
|
+
[\"ba\"]\n + XMLMotor.get_node_from_content \"<A i='1'>a</A><B><A i='2'>ba</A></B>\",
|
30
|
+
\"A\", \"i='1'\"\n RETURNS: [\"a\"]\n "
|
31
|
+
email:
|
32
|
+
- abhikumar163@gmail.com
|
19
33
|
executables: []
|
20
|
-
|
21
34
|
extensions: []
|
22
|
-
|
23
35
|
extra_rdoc_files: []
|
24
|
-
|
25
|
-
|
36
|
+
files:
|
37
|
+
- CHANGELOG
|
26
38
|
- Gemfile
|
27
39
|
- README
|
28
40
|
- Rakefile
|
@@ -30,31 +42,28 @@ files:
|
|
30
42
|
- lib/xml-motor/version.rb
|
31
43
|
- make_my_gem.sh
|
32
44
|
- xml-motor.gemspec
|
33
|
-
has_rdoc: false
|
34
45
|
homepage: http://github.com/abhishekkr/rubygem_xml_motor
|
46
|
+
licenses: []
|
35
47
|
post_install_message:
|
36
48
|
rdoc_options: []
|
37
|
-
|
38
|
-
require_paths:
|
49
|
+
require_paths:
|
39
50
|
- lib
|
40
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
51
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
53
|
+
requirements:
|
54
|
+
- - ! '>='
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '0'
|
57
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - ! '>='
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
52
63
|
requirements: []
|
53
|
-
|
54
64
|
rubyforge_project: xml-motor
|
55
|
-
rubygems_version: 1.
|
65
|
+
rubygems_version: 1.8.17
|
56
66
|
signing_key:
|
57
|
-
specification_version:
|
67
|
+
specification_version: 3
|
58
68
|
summary: An easy-to-use XML Parser without any Native Dependencies
|
59
69
|
test_files: []
|
60
|
-
|