xml_row_finder 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/xml_row_finder.rb +16 -25
- data.tar.gz.sig +0 -0
- metadata +10 -10
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1407d0f852c5a904600ef49f43c93b7a8e5cc4a459bb88d9d2e0bc4c26928887
|
4
|
+
data.tar.gz: 3867560288f6ed062b2c59e78bea3e30b7ddaf5217d3a181f864b4fbf28a202f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c19790d1e1c125b0be88831e1a1ab870662b03ad35859fc68b2431390854c0f4e507a8629198fefb1bfd03ed460e75ceb78e278f5de4be43e9dd9a1ab4c03734
|
7
|
+
data.tar.gz: d9d5321b0f639868aeca083728f7ebaa6da2e1d101d609aa05076e9e96c0c7e33e2545db0e803e5efd53808514c028b2190a425e08267e36e42cd6b6118adb3a
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/xml_row_finder.rb
CHANGED
@@ -13,26 +13,9 @@ class XMLRowFinder
|
|
13
13
|
|
14
14
|
@debug = debug
|
15
15
|
|
16
|
-
doc =
|
16
|
+
doc = Nokorexi.new(raws, filter: true).to_doc
|
17
17
|
|
18
|
-
|
19
|
-
doc1.xpath('//*[@onclick]').each do |e|
|
20
|
-
e.attributes['onclick'].value = ''
|
21
|
-
end
|
22
|
-
|
23
|
-
doc1.xpath('//*[@onmousedown]').each do |e|
|
24
|
-
e.attributes['onmousedown'].value = ''
|
25
|
-
end
|
26
|
-
|
27
|
-
end
|
28
|
-
|
29
|
-
nki.to_doc
|
30
|
-
|
31
|
-
else
|
32
|
-
Rexle.new(raws)
|
33
|
-
end
|
34
|
-
|
35
|
-
@doc = Rexle.new(doc.xml)
|
18
|
+
@doc = Rexle.new(doc.root.xml)
|
36
19
|
|
37
20
|
a = []
|
38
21
|
|
@@ -60,18 +43,26 @@ class XMLRowFinder
|
|
60
43
|
[@doc2.xpath(xpath2).length, xpath2]
|
61
44
|
end
|
62
45
|
|
63
|
-
|
46
|
+
puts 'a5: ' + a5.inspect if @debug
|
47
|
+
rows_xpath = a5.reverse.detect {|num, xpath2| num > 1}.last
|
48
|
+
doc3 = Document.new @doc.root.xml
|
49
|
+
@rows = XPath.match(doc3, rows_xpath)
|
50
|
+
@xpath = rows_xpath
|
51
|
+
#@xpath = BacktrackXPath.new(@rows.first).to_xpath.gsub("[@class='']",'')
|
64
52
|
|
65
|
-
last_row =
|
53
|
+
last_row = XPath.match(doc3, @xpath).last
|
54
|
+
puts '@xpath: ' + @xpath.inspect
|
66
55
|
|
67
56
|
# find the container element
|
68
57
|
xpath = @xpath[/^[^\[]+/]
|
69
58
|
axpath = xpath.split('/')
|
70
|
-
e = doc.element xpath
|
71
59
|
|
72
|
-
|
60
|
+
e = XPath.first(doc3, xpath)
|
61
|
+
puts 'e: ' + e.to_s
|
62
|
+
|
63
|
+
until (e.nil? or e.to_s.include?(last_row.to_s)) do
|
73
64
|
axpath.pop
|
74
|
-
e =
|
65
|
+
e = XPath.first(doc3, axpath.join('/'))
|
75
66
|
end
|
76
67
|
|
77
68
|
@cont_xpath = axpath.join('/')
|
@@ -94,7 +85,7 @@ class XMLRowFinder
|
|
94
85
|
# object returned: An array of Nokogiri XML Element object
|
95
86
|
#
|
96
87
|
def rows()
|
97
|
-
@
|
88
|
+
@rows
|
98
89
|
end
|
99
90
|
|
100
91
|
# returns the xpath pointing to the rows
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xml_row_finder
|
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
|
- James Robertson
|
@@ -35,28 +35,28 @@ cert_chain:
|
|
35
35
|
a/pAsvo0jT6QTnSB7xzsx8LSFDT5tfHKR9Dcn1Y3R06fsh02JvwxaSAMgDBM2aFb
|
36
36
|
2A7/BQ1hD7SU82VTxB1gFIHl
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2022-01-
|
38
|
+
date: 2022-01-28 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: nokorexi
|
42
42
|
requirement: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
|
-
- - "~>"
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
version: '0.5'
|
47
44
|
- - ">="
|
48
45
|
- !ruby/object:Gem::Version
|
49
|
-
version: 0.
|
46
|
+
version: 0.6.0
|
47
|
+
- - "~>"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '0.6'
|
50
50
|
type: :runtime
|
51
51
|
prerelease: false
|
52
52
|
version_requirements: !ruby/object:Gem::Requirement
|
53
53
|
requirements:
|
54
|
-
- - "~>"
|
55
|
-
- !ruby/object:Gem::Version
|
56
|
-
version: '0.5'
|
57
54
|
- - ">="
|
58
55
|
- !ruby/object:Gem::Version
|
59
|
-
version: 0.
|
56
|
+
version: 0.6.0
|
57
|
+
- - "~>"
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '0.6'
|
60
60
|
description:
|
61
61
|
email: digital.robertson@gmail.com
|
62
62
|
executables: []
|
metadata.gz.sig
CHANGED
Binary file
|