rexle 0.9.8 → 0.9.9
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.
- data/lib/rexle.rb +14 -9
- metadata +2 -2
data/lib/rexle.rb
CHANGED
@@ -9,6 +9,11 @@ require 'polyrex-parser'
|
|
9
9
|
include REXML
|
10
10
|
|
11
11
|
|
12
|
+
# modifications:
|
13
|
+
# 28-Au-2011: New line characters between elements are now preserved
|
14
|
+
# 24-Jul-2011: Smybols are used for attribute keys instead of strings now
|
15
|
+
# 18-Jun-2011: A Rexle document can now be added to another Rexle document
|
16
|
+
# e.g. Rexle.new('<root/>').add Rexle.new "<a>123</a>"
|
12
17
|
module XMLhelper
|
13
18
|
|
14
19
|
def doc_print(children)
|
@@ -29,7 +34,7 @@ module XMLhelper
|
|
29
34
|
def scan_print(nodes)
|
30
35
|
|
31
36
|
nodes.map do |x|
|
32
|
-
|
37
|
+
#puts 'x: ' + x.class.to_s #+ ' name: ' + x.name.to_s
|
33
38
|
if x.is_a? Rexle::Element then
|
34
39
|
unless x.name == '![' then
|
35
40
|
a = x.attributes.to_a.map{|k,v| "%s='%s'" % [k,v]}
|
@@ -152,11 +157,11 @@ class Rexle
|
|
152
157
|
#puts 'zzz : ' + @rexle.prefixes.inspect
|
153
158
|
#puts '@rexle : ' + @rexle.inspect
|
154
159
|
if @rexle then
|
155
|
-
|
156
|
-
|
157
|
-
|
160
|
+
prefix = @rexle.prefixes.find {|x| x == @name[/^(\w+):/,1] } if @rexle.prefixes.is_a? Array
|
161
|
+
#puts 'ppp: ' + prefix.inspect
|
162
|
+
prefix ? @name.sub(prefix + ':', '') : @name
|
158
163
|
else
|
159
|
-
|
164
|
+
@name
|
160
165
|
end
|
161
166
|
end
|
162
167
|
|
@@ -203,8 +208,8 @@ class Rexle
|
|
203
208
|
#element_name ||= '*'
|
204
209
|
raw_condition = '' if condition
|
205
210
|
|
206
|
-
attr_search = format_condition(condition) if condition and condition.length > 0
|
207
|
-
|
211
|
+
attr_search = format_condition(condition) if condition and condition.length > 0
|
212
|
+
|
208
213
|
if raw_path[0,2] == '//'
|
209
214
|
return scan_match(self, xpath_value)
|
210
215
|
else
|
@@ -429,7 +434,7 @@ class Rexle
|
|
429
434
|
|
430
435
|
r = node.xpath(xpath[2..-1])
|
431
436
|
r << node.children.map {|n| scan_match(n, xpath)}
|
432
|
-
|
437
|
+
#puts 'r: ' + r.inspect
|
433
438
|
r
|
434
439
|
end
|
435
440
|
|
@@ -550,7 +555,7 @@ class Rexle
|
|
550
555
|
end
|
551
556
|
|
552
557
|
def scan_element(name, value=nil, attributes=nil, *children)
|
553
|
-
|
558
|
+
#puts 'name : ' + name.inspect
|
554
559
|
element = Element.new(name, value, attributes, self)
|
555
560
|
|
556
561
|
if children then
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: rexle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.9.
|
5
|
+
version: 0.9.9
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- James Robertson
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-
|
13
|
+
date: 2011-08-28 00:00:00 +01:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|