ginjo-rfm 2.1.7 → 3.0.0
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 +15 -0
- data/CHANGELOG.md +45 -16
- data/README.md +251 -274
- data/lib/rfm.rb +42 -20
- data/lib/rfm/VERSION +1 -1
- data/lib/rfm/base.rb +63 -196
- data/lib/rfm/database.rb +15 -16
- data/lib/rfm/layout.rb +244 -271
- data/lib/rfm/metadata/datum.rb +45 -0
- data/lib/rfm/metadata/field.rb +33 -13
- data/lib/rfm/metadata/field_control.rb +57 -25
- data/lib/rfm/metadata/layout_meta.rb +38 -0
- data/lib/rfm/metadata/resultset_meta.rb +66 -0
- data/lib/rfm/metadata/value_list_item.rb +7 -6
- data/lib/rfm/record.rb +54 -74
- data/lib/rfm/resultset.rb +63 -112
- data/lib/rfm/server.rb +6 -172
- data/lib/rfm/utilities/config.rb +100 -55
- data/lib/rfm/utilities/connection.rb +209 -0
- data/lib/rfm/utilities/core_ext.rb +14 -1
- data/lib/rfm/utilities/factory.rb +68 -65
- data/lib/rfm/utilities/sax_parser.rb +1039 -0
- metadata +154 -206
- data/lib/rfm/utilities/fmpxmlresult.rb +0 -167
- data/lib/rfm/utilities/fmresultset.rb +0 -153
- data/lib/rfm/utilities/xml_parser.rb +0 -124
- data/lib/rfm/xml_mini/hpricot.rb +0 -133
- data/lib/rfm/xml_mini/ox_sax.rb +0 -91
- data/lib/rfm/xml_mini/rexml_sax.rb +0 -81
@@ -1,81 +0,0 @@
|
|
1
|
-
require 'rexml/parsers/sax2parser'
|
2
|
-
require 'rexml/sax2listener'
|
3
|
-
require 'rexml/document'
|
4
|
-
require 'active_support/core_ext/object/blank'
|
5
|
-
require 'stringio'
|
6
|
-
|
7
|
-
# = XmlMini REXML implementation using the SAX2 parser
|
8
|
-
module ActiveSupport
|
9
|
-
module XmlMini_REXMLSAX
|
10
|
-
extend self
|
11
|
-
|
12
|
-
# Class that will build the hash while the XML document
|
13
|
-
# is being parsed using streaming events.
|
14
|
-
class HashBuilder
|
15
|
-
include REXML::SAX2Listener
|
16
|
-
|
17
|
-
CONTENT_KEY = '__content__'.freeze
|
18
|
-
HASH_SIZE_KEY = '__hash_size__'.freeze
|
19
|
-
|
20
|
-
attr_reader :hash
|
21
|
-
|
22
|
-
def current_hash
|
23
|
-
@hash_stack.last
|
24
|
-
end
|
25
|
-
|
26
|
-
def start_document
|
27
|
-
@hash = {}
|
28
|
-
@hash_stack = [@hash]
|
29
|
-
end
|
30
|
-
|
31
|
-
def end_document
|
32
|
-
raise "Parse stack not empty!" if @hash_stack.size > 1
|
33
|
-
end
|
34
|
-
|
35
|
-
def error(error_message)
|
36
|
-
raise error_message
|
37
|
-
end
|
38
|
-
|
39
|
-
def start_element(uri, name, qname, attrs = [])
|
40
|
-
#puts "START_ELEMENT #{name}"
|
41
|
-
#y attrs
|
42
|
-
new_hash = { CONTENT_KEY => '' }.merge(Hash[attrs])
|
43
|
-
new_hash[HASH_SIZE_KEY] = new_hash.size + 1
|
44
|
-
|
45
|
-
case current_hash[name]
|
46
|
-
when Array then current_hash[name] << new_hash
|
47
|
-
when Hash then current_hash[name] = [current_hash[name], new_hash]
|
48
|
-
when nil then current_hash[name] = new_hash
|
49
|
-
end
|
50
|
-
|
51
|
-
@hash_stack.push(new_hash)
|
52
|
-
end
|
53
|
-
|
54
|
-
def end_element(uri, name, qname)
|
55
|
-
if current_hash.length > current_hash.delete(HASH_SIZE_KEY) && current_hash[CONTENT_KEY].blank? || current_hash[CONTENT_KEY] == ''
|
56
|
-
current_hash.delete(CONTENT_KEY)
|
57
|
-
end
|
58
|
-
@hash_stack.pop
|
59
|
-
end
|
60
|
-
|
61
|
-
def characters(string)
|
62
|
-
return unless string and current_hash[CONTENT_KEY]
|
63
|
-
#puts "CHARACTERS #{string}"
|
64
|
-
current_hash[CONTENT_KEY] << string
|
65
|
-
end
|
66
|
-
|
67
|
-
alias_method :cdata, :characters
|
68
|
-
end
|
69
|
-
|
70
|
-
attr_accessor :document_class
|
71
|
-
self.document_class = HashBuilder
|
72
|
-
|
73
|
-
def parse(data)
|
74
|
-
document = self.document_class.new
|
75
|
-
parser = REXML::Parsers::SAX2Parser.new(data)
|
76
|
-
parser.listen(document)
|
77
|
-
parser.parse
|
78
|
-
document.hash
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|