ox 2.14.14 → 2.14.17

Sign up to get free protection for your applications and to get access to all the features.
data/ext/ox/special.h CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  #include <stdint.h>
10
10
 
11
- extern char* ox_ucs_to_utf8_chars(char *text, uint64_t u);
12
- extern char* ox_entity_lookup(char *text, const char *key);
11
+ extern char *ox_ucs_to_utf8_chars(char *text, uint64_t u);
12
+ extern char *ox_entity_lookup(char *text, const char *key);
13
13
 
14
14
  #endif /* OX_SPECIAL_H */
data/ext/ox/type.h CHANGED
@@ -7,31 +7,31 @@
7
7
  #define OX_TYPE_H
8
8
 
9
9
  typedef enum {
10
- NoCode = 0,
11
- ArrayCode = 'a',
10
+ NoCode = 0,
11
+ ArrayCode = 'a',
12
12
  String64Code = 'b', /* base64 encoded String */
13
- ClassCode = 'c',
13
+ ClassCode = 'c',
14
14
  Symbol64Code = 'd', /* base64 encoded Symbol */
15
- DateCode = 'D',
15
+ DateCode = 'D',
16
16
  BigDecimalCode = 'B',
17
17
  ExceptionCode = 'e',
18
- FloatCode = 'f',
19
- RegexpCode = 'g',
20
- HashCode = 'h',
21
- FixnumCode = 'i',
22
- BignumCode = 'j',
23
- KeyCode = 'k', /* indicates the value is a hash key, kind of a hack */
18
+ FloatCode = 'f',
19
+ RegexpCode = 'g',
20
+ HashCode = 'h',
21
+ FixnumCode = 'i',
22
+ BignumCode = 'j',
23
+ KeyCode = 'k', /* indicates the value is a hash key, kind of a hack */
24
24
  RationalCode = 'l',
25
- SymbolCode = 'm',
25
+ SymbolCode = 'm',
26
26
  FalseClassCode = 'n',
27
- ObjectCode = 'o',
28
- RefCode = 'p',
29
- RangeCode = 'r',
30
- StringCode = 's',
31
- TimeCode = 't',
32
- StructCode = 'u',
33
- ComplexCode = 'v',
34
- RawCode = 'x',
27
+ ObjectCode = 'o',
28
+ RefCode = 'p',
29
+ RangeCode = 'r',
30
+ StringCode = 's',
31
+ TimeCode = 't',
32
+ StructCode = 'u',
33
+ ComplexCode = 'v',
34
+ RawCode = 'x',
35
35
  TrueClassCode = 'y',
36
36
  NilClassCode = 'z',
37
37
  } Type;
data/lib/ox/bag.rb CHANGED
@@ -1,13 +1,10 @@
1
-
2
1
  module Ox
3
-
4
2
  # A generic class that is used only for storing attributes. It is the base
5
3
  # Class for auto-generated classes in the storage system. Instance variables
6
4
  # are added using the instance_variable_set() method. All instance variables
7
5
  # can be accessed using the variable name (without the @ prefix). No setters
8
6
  # are provided as the Class is intended for reading only.
9
7
  class Bag
10
-
11
8
  # The initializer can take multiple arguments in the form of key values
12
9
  # where the key is the variable name and the value is the variable
13
10
  # value. This is intended for testing purposes only.
@@ -17,9 +14,9 @@ module Ox
17
14
  #
18
15
  # Ox::Bag.new(:@x => 42, :@y => 57)
19
16
  #
20
- def initialize(args={ })
21
- args.each do |k,v|
22
- self.instance_variable_set(k, v)
17
+ def initialize(args={})
18
+ args.each do |k, v|
19
+ instance_variable_set(k, v)
23
20
  end
24
21
  end
25
22
 
@@ -29,6 +26,7 @@ module Ox
29
26
  # reader, otherwise false.
30
27
  def respond_to?(m)
31
28
  return true if super
29
+
32
30
  at_m = ('@' + m.to_s).to_sym
33
31
  instance_variables.include?(at_m)
34
32
  end
@@ -42,9 +40,13 @@ module Ox
42
40
  #
43
41
  # _raise_ [NoMethodError] if the instance variable is not defined.
44
42
  def method_missing(m, *args, &block)
45
- raise ArgumentError.new("wrong number of arguments (#{args.size} for 0) to method #{m}") unless args.nil? or args.empty?
43
+ unless args.nil? or args.empty?
44
+ raise ArgumentError.new("wrong number of arguments (#{args.size} for 0) to method #{m}")
45
+ end
46
+
46
47
  at_m = ('@' + m.to_s).to_sym
47
48
  raise NoMethodError.new("undefined method #{m}", m) unless instance_variable_defined?(at_m)
49
+
48
50
  instance_variable_get(at_m)
49
51
  end
50
52
 
@@ -53,16 +55,18 @@ module Ox
53
55
  # *return* [Boolean] true if each variable and value are the same, otherwise false.
54
56
  def eql?(other)
55
57
  return false if (other.nil? or self.class != other.class)
58
+
56
59
  ova = other.instance_variables
57
60
  iv = instance_variables
58
61
  return false if ova.size != iv.size
62
+
59
63
  iv.each do |vid|
60
64
  return false if instance_variable_get(vid) != other.instance_variable_get(vid)
61
65
  end
62
66
  true
63
67
  end
64
68
  alias == eql?
65
-
69
+
66
70
  # Define a new class based on the Ox::Bag class. This is used internally in
67
71
  # the Ox module and is available to service wrappers that receive XML
68
72
  # requests that include Objects of Classes not defined in the storage
@@ -75,6 +79,7 @@ module Ox
75
79
  classname = classname.to_s unless classname.is_a?(String)
76
80
  tokens = classname.split('::').map { |n| n.to_sym }
77
81
  raise NameError.new("Invalid classname '#{classname}") if tokens.empty?
82
+
78
83
  m = Object
79
84
  tokens[0..-2].each do |sym|
80
85
  if m.const_defined?(sym)
@@ -94,6 +99,5 @@ module Ox
94
99
  end
95
100
  c
96
101
  end
97
-
98
102
  end # Bag
99
103
  end # Ox
data/lib/ox/cdata.rb CHANGED
@@ -1,4 +1,3 @@
1
-
2
1
  module Ox
3
2
  # CData represents a CDATA element in an XML document.
4
3
  class CData < Node
@@ -7,6 +6,5 @@ module Ox
7
6
  def initialize(value)
8
7
  super
9
8
  end
10
-
11
9
  end # CData
12
10
  end # Ox
data/lib/ox/comment.rb CHANGED
@@ -1,4 +1,3 @@
1
-
2
1
  module Ox
3
2
  # Comments represent XML comments in an XML document. A comment has a value
4
3
  # attribute only.
@@ -8,6 +7,5 @@ module Ox
8
7
  def initialize(value)
9
8
  super
10
9
  end
11
-
12
10
  end # Comment
13
11
  end # Ox
data/lib/ox/doctype.rb CHANGED
@@ -1,4 +1,3 @@
1
-
2
1
  module Ox
3
2
  # Represents a DOCTYPE in an XML document.
4
3
  class DocType < Node
@@ -8,6 +7,5 @@ module Ox
8
7
  def initialize(value)
9
8
  super
10
9
  end
11
-
12
10
  end # DocType
13
11
  end # Ox
data/lib/ox/document.rb CHANGED
@@ -1,4 +1,3 @@
1
-
2
1
  module Ox
3
2
  # Represents an XML document. It has a fixed set of attributes which form
4
3
  # the XML prolog. A Document includes Elements.
@@ -10,14 +9,14 @@ module Ox
10
9
  # - _:standalone_ [String] indicates the document is standalone
11
10
  def initialize(prolog={})
12
11
  super(nil)
13
- @attributes = { }
12
+ @attributes = {}
14
13
  @attributes[:version] = prolog[:version] unless prolog[:version].nil?
15
14
  @attributes[:encoding] = prolog[:encoding] unless prolog[:encoding].nil?
16
15
  @attributes[:standalone] = prolog[:standalone] unless prolog[:standalone].nil?
17
16
  end
18
-
17
+
19
18
  # Returns the first Element in the document.
20
- def root()
19
+ def root
21
20
  unless !instance_variable_defined?(:@nodes) || @nodes.nil?
22
21
  @nodes.each do |n|
23
22
  return n if n.is_a?(::Ox::Element)
@@ -25,6 +24,5 @@ module Ox
25
24
  end
26
25
  nil
27
26
  end
28
-
29
27
  end # Document
30
28
  end # Ox
data/lib/ox/element.rb CHANGED
@@ -1,6 +1,4 @@
1
-
2
1
  module Ox
3
-
4
2
  # An Element represents a element of an XML document. It has a name,
5
3
  # attributes, and sub-nodes.
6
4
  #
@@ -58,7 +56,8 @@ module Ox
58
56
  # so multiple appends can be chained together.
59
57
  # - +node+ [Node] Node to append to the nodes array
60
58
  def <<(node)
61
- raise "argument to << must be a String or Ox::Node." unless node.is_a?(String) or node.is_a?(Node)
59
+ raise 'argument to << must be a String or Ox::Node.' unless node.is_a?(String) or node.is_a?(Node)
60
+
62
61
  @nodes = [] if !instance_variable_defined?(:@nodes) or @nodes.nil?
63
62
  @nodes << node
64
63
  self
@@ -68,7 +67,8 @@ module Ox
68
67
  # so multiple appends can be chained together.
69
68
  # - +node+ [Node] Node to prepend to the nodes array
70
69
  def prepend_child(node)
71
- raise "argument to << must be a String or Ox::Node." unless node.is_a?(String) or node.is_a?(Node)
70
+ raise 'argument to << must be a String or Ox::Node.' unless node.is_a?(String) or node.is_a?(Node)
71
+
72
72
  @nodes = [] if !instance_variable_defined?(:@nodes) or @nodes.nil?
73
73
  @nodes.unshift(node)
74
74
  self
@@ -80,15 +80,16 @@ module Ox
80
80
  # *return* [Boolean] true if both Objects are equivalent, otherwise false.
81
81
  def eql?(other)
82
82
  return false unless super(other)
83
- return false unless self.attributes == other.attributes
84
- return false unless self.nodes == other.nodes
83
+ return false unless attributes == other.attributes
84
+ return false unless nodes == other.nodes
85
+
85
86
  true
86
87
  end
87
88
  alias == eql?
88
89
 
89
90
  # Returns the first String in the elements nodes array or nil if there is
90
91
  # no String node.
91
- def text()
92
+ def text
92
93
  nodes.each { |n| return n if n.is_a?(String) }
93
94
  nil
94
95
  end
@@ -97,15 +98,16 @@ module Ox
97
98
  # (String) node. Note the existing nodes array is modified and not replaced.
98
99
  # - +txt+ [String] to become the only element of the nodes array
99
100
  def replace_text(txt)
100
- raise "the argument to replace_text() must be a String" unless txt.is_a?(String)
101
- @nodes.clear()
101
+ raise 'the argument to replace_text() must be a String' unless txt.is_a?(String)
102
+
103
+ @nodes.clear
102
104
  @nodes << txt
103
105
  end
104
106
 
105
107
  # Return true if all the key-value pairs in the cond Hash match the
106
108
  # @attributes key-values.
107
109
  def attr_match(cond)
108
- cond.each_pair { |k,v| return false unless v == @attributes[k.to_sym] || v == @attributes[k.to_s] }
110
+ cond.each_pair { |k, v| return false unless v == @attributes[k.to_sym] || v == @attributes[k.to_s] }
109
111
  true
110
112
  end
111
113
 
@@ -161,6 +163,7 @@ module Ox
161
163
  # - +path+ [String] path to the Nodes to locate
162
164
  def locate(path)
163
165
  return [self] if path.nil?
166
+
164
167
  found = []
165
168
  pa = path.split('/')
166
169
  if '*' == path[0]
@@ -183,6 +186,7 @@ module Ox
183
186
  # - +children+ [Array] array of OX
184
187
  def remove_children(*children)
185
188
  return self if children.compact.empty?
189
+
186
190
  recursive_children_removal(children.compact.map { |c| c.object_id })
187
191
  self
188
192
  end
@@ -198,6 +202,7 @@ module Ox
198
202
  del_locate(path.split('/')) unless path.nil?
199
203
  self
200
204
  end
205
+
201
206
  # Handles the 'easy' API that allows navigating a simple XML by
202
207
  # referencing elements and attributes by name.
203
208
  # - +id+ [Symbol] element or attribute name
@@ -209,17 +214,20 @@ module Ox
209
214
  ids = id.to_s
210
215
  i = args[0].to_i # will be 0 if no arg or parsing fails
211
216
  nodes.each do |n|
212
- if (n.is_a?(Element) || n.is_a?(Instruct)) && (n.value == id || n.value == ids || name_matchs?(n.value, ids))
213
- return n if 0 == i
214
- has_some = true
215
- i -= 1
217
+ unless (n.is_a?(Element) || n.is_a?(Instruct)) && (n.value == id || n.value == ids || name_matchs?(n.value, ids))
218
+ next
216
219
  end
220
+ return n if 0 == i
221
+
222
+ has_some = true
223
+ i -= 1
217
224
  end
218
225
  if instance_variable_defined?(:@attributes)
219
226
  return @attributes[id] if @attributes.has_key?(id)
220
227
  return @attributes[ids] if @attributes.has_key?(ids)
221
228
  end
222
229
  return nil if has_some
230
+
223
231
  raise NoMethodError.new("#{ids} not found", name)
224
232
  end
225
233
 
@@ -228,6 +236,7 @@ module Ox
228
236
  # *return* true if the element has a member that matches the provided name.
229
237
  def respond_to?(id, inc_all=false)
230
238
  return true if super
239
+
231
240
  id_str = id.to_s
232
241
  id_sym = id.to_sym
233
242
  nodes.each do |n|
@@ -247,10 +256,11 @@ module Ox
247
256
  step = path[0]
248
257
  if step.start_with?('@') # attribute
249
258
  raise InvalidPath.new(path) unless 1 == path.size
259
+
250
260
  if instance_variable_defined?(:@attributes)
251
261
  step = step[1..-1]
252
262
  sym_step = step.to_sym
253
- @attributes.each do |k,v|
263
+ @attributes.each do |k, v|
254
264
  found << v if ('?' == step or k == step or k == sym_step)
255
265
  end
256
266
  end
@@ -261,6 +271,7 @@ module Ox
261
271
  else
262
272
  name = step[0..i-1]
263
273
  raise InvalidPath.new(path) unless step.end_with?(']')
274
+
264
275
  i += 1
265
276
  qual = step[i..i] # step[i] would be better but some rubies (jruby, ree, rbx) take that as a Fixnum.
266
277
  if '0' <= qual and qual <= '9'
@@ -270,13 +281,13 @@ module Ox
270
281
  end
271
282
  index = step[i..-2].to_i
272
283
  end
273
- if '?' == name or '*' == name
284
+ if ['?', '*'].include?(name)
274
285
  match = nodes
275
286
  elsif '^' == name[0..0] # 1.8.7 thinks name[0] is a fixnum
276
287
  case name[1..-1]
277
- when 'Element'
288
+ when 'Element'
278
289
  match = nodes.select { |e| e.is_a?(Element) }
279
- when 'String', 'Text'
290
+ when 'String', 'Text'
280
291
  match = nodes.select { |e| e.is_a?(String) }
281
292
  when 'Comment'
282
293
  match = nodes.select { |e| e.is_a?(Comment) }
@@ -285,7 +296,7 @@ module Ox
285
296
  when 'DocType'
286
297
  match = nodes.select { |e| e.is_a?(DocType) }
287
298
  else
288
- #puts "*** no match on #{name}"
299
+ # puts "*** no match on #{name}"
289
300
  match = []
290
301
  end
291
302
  else
@@ -302,7 +313,7 @@ module Ox
302
313
  when '>'
303
314
  match = index <= match.size ? match[index + 1..-1] : []
304
315
  when '@'
305
- k,v = step[i..-2].split('=')
316
+ k, v = step[i..-2].split('=')
306
317
  if v
307
318
  match = match.select { |n| n.is_a?(Element) && (v == n.attributes[k.to_sym] || v == n.attributes[k]) }
308
319
  else
@@ -328,10 +339,11 @@ module Ox
328
339
  step = path[0]
329
340
  if step.start_with?('@') # attribute
330
341
  raise InvalidPath.new(path) unless 1 == path.size
342
+
331
343
  if instance_variable_defined?(:@attributes)
332
344
  step = step[1..-1]
333
345
  sym_step = step.to_sym
334
- @attributes.delete_if { |k,v| '?' == step || k.to_sym == sym_step }
346
+ @attributes.delete_if { |k, v| '?' == step || k.to_sym == sym_step }
335
347
  end
336
348
  else # element name
337
349
  if (i = step.index('[')).nil? # just name
@@ -340,6 +352,7 @@ module Ox
340
352
  else
341
353
  name = step[0..i-1]
342
354
  raise InvalidPath.new(path) unless step.end_with?(']')
355
+
343
356
  i += 1
344
357
  qual = step[i..i] # step[i] would be better but some rubies (jruby, ree, rbx) take that as a Fixnum.
345
358
  if '0' <= qual and qual <= '9'
@@ -349,13 +362,13 @@ module Ox
349
362
  end
350
363
  index = step[i..-2].to_i
351
364
  end
352
- if '?' == name or '*' == name
365
+ if ['?', '*'].include?(name)
353
366
  match = nodes
354
367
  elsif '^' == name[0..0] # 1.8.7 thinks name[0] is a fixnum
355
368
  case name[1..-1]
356
- when 'Element'
369
+ when 'Element'
357
370
  match = nodes.select { |e| e.is_a?(Element) }
358
- when 'String', 'Text'
371
+ when 'String', 'Text'
359
372
  match = nodes.select { |e| e.is_a?(String) }
360
373
  when 'Comment'
361
374
  match = nodes.select { |e| e.is_a?(Comment) }
@@ -364,7 +377,7 @@ module Ox
364
377
  when 'DocType'
365
378
  match = nodes.select { |e| e.is_a?(DocType) }
366
379
  else
367
- #puts "*** no match on #{name}"
380
+ # puts "*** no match on #{name}"
368
381
  match = []
369
382
  end
370
383
  else
@@ -381,7 +394,7 @@ module Ox
381
394
  when '>'
382
395
  match = index <= match.size ? match[index + 1..-1] : []
383
396
  when '@'
384
- k,v = step[i..-2].split('=')
397
+ k, v = step[i..-2].split('=')
385
398
  if v
386
399
  match = match.select { |n| n.is_a?(Element) && (v == n.attributes[k.to_sym] || v == n.attributes[k]) }
387
400
  else
@@ -427,6 +440,7 @@ module Ox
427
440
  # - +found+ [Array] An array of Ox::Element
428
441
  def recursive_children_removal(found)
429
442
  return if found.empty?
443
+
430
444
  nodes.tap do |ns|
431
445
  # found.delete(n.object_id) stops looking for an already found object_id
432
446
  ns.delete_if { |n| found.include?(n.object_id) ? found.delete(n.object_id) : false }
@@ -438,6 +452,7 @@ module Ox
438
452
 
439
453
  def name_matchs?(pat, id)
440
454
  return false unless pat.length == id.length
455
+
441
456
  pat.length.times { |i| return false unless '_' == id[i] || pat[i] == id[i] }
442
457
  true
443
458
  end
data/lib/ox/error.rb CHANGED
@@ -1,6 +1,4 @@
1
-
2
1
  module Ox
3
-
4
2
  # Base error class for Ox errors.
5
3
  class Error < StandardError
6
4
  end # Error
@@ -24,5 +22,4 @@ module Ox
24
22
  super("#{path.join('/')} is not a valid location.")
25
23
  end
26
24
  end # InvalidPath
27
-
28
25
  end # Ox
data/lib/ox/hasattrs.rb CHANGED
@@ -1,6 +1,4 @@
1
-
2
1
  module Ox
3
-
4
2
  # An Object that includes the HasAttrs module can have attributes which are a Hash of String values and either String
5
3
  # or Symbol keys.
6
4
  #
@@ -10,7 +8,7 @@ module Ox
10
8
  # Returns all the attributes of the Instruct as a Hash.
11
9
  # *return* [Hash] all attributes and attribute values.
12
10
  def attributes
13
- @attributes = { } if !instance_variable_defined?(:@attributes) or @attributes.nil?
11
+ @attributes = {} if !instance_variable_defined?(:@attributes) or @attributes.nil?
14
12
  @attributes
15
13
  end
16
14
 
@@ -18,6 +16,7 @@ module Ox
18
16
  # - +attr+ [Symbol|String] attribute name or key to return the value for
19
17
  def [](attr)
20
18
  return nil unless instance_variable_defined?(:@attributes) and @attributes.is_a?(Hash)
19
+
21
20
  @attributes[attr] or (attr.is_a?(String) ? @attributes[attr.to_sym] : @attributes[attr.to_s])
22
21
  end
23
22
 
@@ -25,14 +24,15 @@ module Ox
25
24
  # - +attr+ [Symbol|String] attribute name or key
26
25
  # - +value+ [Object] value for the attribute
27
26
  def []=(attr, value)
28
- raise "argument to [] must be a Symbol or a String." unless attr.is_a?(Symbol) or attr.is_a?(String)
29
- @attributes = { } if !instance_variable_defined?(:@attributes) or @attributes.nil?
27
+ raise 'argument to [] must be a Symbol or a String.' unless attr.is_a?(Symbol) or attr.is_a?(String)
28
+
29
+ @attributes = {} if !instance_variable_defined?(:@attributes) or @attributes.nil?
30
30
  a_str = attr.to_s
31
31
  a_sym = attr.to_sym
32
32
  if @attributes.has_key?(a_str)
33
- attr = a_str
33
+ attr = a_str
34
34
  elsif @attributes.has_key?(a_sym)
35
- attr = a_sym
35
+ attr = a_sym
36
36
  end
37
37
  @attributes[attr] = value.to_s
38
38
  end
@@ -50,6 +50,5 @@ module Ox
50
50
  end
51
51
  raise NoMethodError.new("#{ids} not found", name)
52
52
  end
53
-
54
53
  end # HasAttrs
55
54
  end # Ox
data/lib/ox/instruct.rb CHANGED
@@ -1,6 +1,4 @@
1
-
2
1
  module Ox
3
-
4
2
  # An Instruct represents a processing instruction of an XML document. It has a target, attributes, and a value or
5
3
  # content. The content will be all characters with the exception of the target. If the content follows a regular
6
4
  # attribute format then the attributes will be set to the parsed values. If it does not follow the attribute formate
@@ -19,18 +17,18 @@ module Ox
19
17
  @content = nil
20
18
  end
21
19
  alias target value
22
-
20
+
23
21
  # Returns true if this Object and other are of the same type and have the
24
22
  # equivalent value and the equivalent elements otherwise false is returned.
25
23
  # - +other+ [Object] Object compare _self_ to.
26
24
  # *return* [Boolean] true if both Objects are equivalent, otherwise false.
27
25
  def eql?(other)
28
26
  return false unless super(other)
29
- return false unless self.attributes == other.attributes
30
- return false unless self.content == other.content
27
+ return false unless attributes == other.attributes
28
+ return false unless content == other.content
29
+
31
30
  true
32
31
  end
33
32
  alias == eql?
34
-
35
33
  end # Instruct
36
34
  end # Ox
data/lib/ox/node.rb CHANGED
@@ -1,10 +1,9 @@
1
-
2
1
  module Ox
3
2
  # The Node is the base class for all other in the Ox module.
4
3
  class Node
5
4
  # String value associated with the Node.
6
5
  attr_accessor :value
7
-
6
+
8
7
  # Creates a new Node with the specified String value.
9
8
  # - +value+ [String] string value for the Node
10
9
  def initialize(value)
@@ -16,9 +15,9 @@ module Ox
16
15
  # - +other+ [Object] Object to compare _self_ to.
17
16
  def eql?(other)
18
17
  return false if (other.nil? or self.class != other.class)
19
- other.value == self.value
18
+
19
+ other.value == value
20
20
  end
21
21
  alias == eql?
22
-
23
22
  end # Node
24
23
  end # Ox
data/lib/ox/raw.rb CHANGED
@@ -1,4 +1,3 @@
1
-
2
1
  module Ox
3
2
  # Raw elements are used to inject existing XML strings into a document
4
3
  # WARNING: Use of this feature can result in invalid XML, since `value` is
@@ -9,6 +8,5 @@ module Ox
9
8
  def initialize(value)
10
9
  super
11
10
  end
12
-
13
11
  end # Raw
14
12
  end # Ox
data/lib/ox/sax.rb CHANGED
@@ -1,4 +1,3 @@
1
-
2
1
  module Ox
3
2
  # A SAX style parse handler. The Ox::Sax handler class should be subclasses
4
3
  # and then used with the Ox.sax_parse() method. The Sax methods will then be
@@ -6,7 +5,7 @@ module Ox
6
5
  # IO streams.<p/>
7
6
  #
8
7
  # *Example*
9
- #
8
+ #
10
9
  # require 'ox'
11
10
  #
12
11
  # class MySax < ::Ox::Sax
@@ -56,10 +55,10 @@ module Ox
56
55
  # will hold the number of bytes from the start of the document.
57
56
  class Sax
58
57
  # Create a new instance of the Sax handler class.
59
- def initialize()
60
- #@pos = nil
61
- #@line = nil
62
- #@column = nil
58
+ def initialize
59
+ # @pos = nil
60
+ # @line = nil
61
+ # @column = nil
63
62
  end
64
63
 
65
64
  # To make the desired methods active while parsing the desired method
@@ -67,47 +66,32 @@ module Ox
67
66
  # they will not be called during parsing.
68
67
  private
69
68
 
70
- def instruct(target)
71
- end
69
+ def instruct(target); end
72
70
 
73
- def end_instruct(target)
74
- end
71
+ def end_instruct(target); end
75
72
 
76
- def attr(name, str)
77
- end
73
+ def attr(name, str); end
78
74
 
79
- def attr_value(name, value)
80
- end
75
+ def attr_value(name, value); end
81
76
 
82
- def attrs_done()
83
- end
77
+ def attrs_done; end
84
78
 
85
- def doctype(str)
86
- end
79
+ def doctype(str); end
87
80
 
88
- def comment(str)
89
- end
81
+ def comment(str); end
90
82
 
91
- def cdata(str)
92
- end
83
+ def cdata(str); end
93
84
 
94
- def text(str)
95
- end
85
+ def text(str); end
96
86
 
97
- def value(value)
98
- end
87
+ def value(value); end
99
88
 
100
- def start_element(name)
101
- end
89
+ def start_element(name); end
102
90
 
103
- def end_element(name)
104
- end
105
-
106
- def error(message, line, column)
107
- end
91
+ def end_element(name); end
108
92
 
109
- def abort(name)
110
- end
111
-
93
+ def error(message, line, column); end
94
+
95
+ def abort(name); end
112
96
  end # Sax
113
97
  end # Ox
data/lib/ox/version.rb CHANGED
@@ -1,5 +1,4 @@
1
-
2
1
  module Ox
3
2
  # Current version of the module.
4
- VERSION = '2.14.14'
3
+ VERSION = '2.14.17'
5
4
  end