xml_row_finder 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 805ba05e167f14ca224f83611d91ada484c31b7c95b329468f4e2fce47302e0e
4
- data.tar.gz: f70f9dd37c9e9f4be41d2d0c5d4408c70049d810273c84eeec1b451c40ad0df4
3
+ metadata.gz: 1407d0f852c5a904600ef49f43c93b7a8e5cc4a459bb88d9d2e0bc4c26928887
4
+ data.tar.gz: 3867560288f6ed062b2c59e78bea3e30b7ddaf5217d3a181f864b4fbf28a202f
5
5
  SHA512:
6
- metadata.gz: 2edc584e01ae048ffb4d7b6ee88d4b08a1dd79ce9b593cecf0b24f9fe606809eb1ae50f6e85d5dee70f75a172dcce4eced9e2d3934f90bb23b77321c00fa04e6
7
- data.tar.gz: 00ddeb4c7b968e5e31acf8e3accd7d466d9d9941e0d53d7892a9ffb6b82965b2b97f48d7d3cb32c6bb5013466888a12e384a3bd27c52486bddf79b75178758dc
6
+ metadata.gz: c19790d1e1c125b0be88831e1a1ab870662b03ad35859fc68b2431390854c0f4e507a8629198fefb1bfd03ed460e75ceb78e278f5de4be43e9dd9a1ab4c03734
7
+ data.tar.gz: d9d5321b0f639868aeca083728f7ebaa6da2e1d101d609aa05076e9e96c0c7e33e2545db0e803e5efd53808514c028b2190a425e08267e36e42cd6b6118adb3a
checksums.yaml.gz.sig CHANGED
Binary file
@@ -13,26 +13,9 @@ class XMLRowFinder
13
13
 
14
14
  @debug = debug
15
15
 
16
- doc = if raws =~ /^http/ then
16
+ doc = Nokorexi.new(raws, filter: true).to_doc
17
17
 
18
- nki = Nokorexi.new(url=raws) do |doc1|
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
- @xpath = a5.reverse.detect {|num, xpath2| num > 1}.last
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 = @doc2.xpath(@xpath).last
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
- until (e.xml.include? last_row) do
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 = doc.element axpath.join('/')
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
- @doc2.xpath @xpath
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.1
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-24 00:00:00.000000000 Z
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.5.4
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.5.4
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