rexle 0.9.37 → 0.9.38

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.
Files changed (2) hide show
  1. data/lib/rexle.rb +7 -6
  2. metadata +2 -2
data/lib/rexle.rb CHANGED
@@ -1,4 +1,4 @@
1
- #!/usr/bin/ruby
1
+ #!/usr/bin/env ruby
2
2
 
3
3
  # file: rexle.rb
4
4
 
@@ -10,6 +10,8 @@ require 'cgi'
10
10
  include REXML
11
11
 
12
12
  # modifications:
13
+ # 15-Jul-2012: bug fix: self.root.value is no longer appended
14
+ # to the body if there are no child elements
13
15
  # 19-Jun-2012: a bug fix for .//*[@class]
14
16
  # 17-Jun-2012: a couple of new xpath things are supported '.' and '|'
15
17
  # 15-Apr-2012: bug fix: New element names are typecast as string
@@ -27,15 +29,13 @@ include REXML
27
29
  # 24-Jul-2011: Smybols are used for attribute keys instead of strings now
28
30
  # 18-Jun-2011: A Rexle document can now be added to another Rexle document
29
31
  # e.g. Rexle.new('<root/>').add Rexle.new "<a>123</a>"
30
-
31
32
  module XMLhelper
32
33
 
33
34
  def doc_print(children)
34
35
 
35
- body = children.empty? ? self.root.value : scan_print(children).join
36
+ body = children.empty? ? '' : scan_print(children).join
36
37
  a = self.root.attributes.to_a.map{|k,v| "%s='%s'" % [k,v]}
37
- "<%s%s>%s</%s>" % [self.root.name, a.empty? ? '' : ' ' + a.join(' '), body, self.root.name]
38
- #"<%s%s>%s</%s>" % [self.root.name, a.empty? ? '' : ' ' + a.join(' '), body]
38
+ "<%s%s>%s</%s>" % [self.root.name, a.empty? ? '' : ' ' + a.join(' '), self.root.text + body, self.root.name]
39
39
  end
40
40
 
41
41
  def doc_pretty_print(children)
@@ -43,7 +43,7 @@ module XMLhelper
43
43
  body = children.empty? ? self.value : pretty_print(children,2).join
44
44
  a = self.root.attributes.to_a.map{|k,v| "%s='%s'" % [k,v]}
45
45
  ind = "\n "
46
- "<%s%s>%s%s%s</%s>" % [self.root.name, a.empty? ? '' : ' ' + a.join(' '), ind, body, "\n", self.root.name]
46
+ "<%s%s>%s%s%s</%s>" % [self.root.name, a.empty? ? '' : ' ' + a.join(' '), ind, self.root.text + body, "\n", self.root.name]
47
47
  end
48
48
 
49
49
  def scan_print(nodes)
@@ -213,6 +213,7 @@ class Rexle
213
213
 
214
214
  def query_xpath(raw_xpath_value, rlist=[], &blk)
215
215
 
216
+ #puts 'raw_xpath_value: ' + raw_xpath_value.inspect
216
217
  #remove any pre'fixes
217
218
  #@rexle.prefixes.each {|x| xpath_value.sub!(x + ':','') }
218
219
  flag_func = false
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: rexle
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.9.37
5
+ version: 0.9.38
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: 2012-06-26 00:00:00 Z
13
+ date: 2012-07-15 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rexleparser