ruby_rnv 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- metadata +1 -2
- data/lib/rnv/ox_sax_document.rb +0 -84
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a8fd8bf859c9269e4001838b7399bb2824ab6af9dad1ee25468c7534e3618fcc
|
4
|
+
data.tar.gz: b5a09f8fb49485d338039d91b2f4c4f3f4f6815c68b976f1db716cdda5a4300e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c50fb3f7d4d5b38853169e4043c333b05ad2320c434f10a5474acca146b58769e17e75336cc77c1c7ebd7c3de81925871d3d6dd5f9188b8d126bdfbd5f39093a
|
7
|
+
data.tar.gz: 9314404ae4355a652ec4e0191b68ce908a0a50b87def123b2c2b3b46415c6742477bc6078f49179b009f33925d41fb9736e053e8031f1ae6621b8816e1315125
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_rnv
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Julien Boulnois
|
@@ -147,7 +147,6 @@ files:
|
|
147
147
|
- ext/rnv/src/xsd_tm.c
|
148
148
|
- ext/rnv/src/xsd_tm.h
|
149
149
|
- lib/rnv.rb
|
150
|
-
- lib/rnv/ox_sax_document.rb
|
151
150
|
- lib/rnv/validator.rb
|
152
151
|
homepage:
|
153
152
|
licenses:
|
data/lib/rnv/ox_sax_document.rb
DELETED
@@ -1,84 +0,0 @@
|
|
1
|
-
class OxSaxDocument < ::Ox::Sax
|
2
|
-
attr_accessor :current_element, :current_attributes, :current_ns
|
3
|
-
|
4
|
-
def initialize(document)
|
5
|
-
@document = document
|
6
|
-
@current_ns = {}
|
7
|
-
@pos = nil
|
8
|
-
@line = nil
|
9
|
-
@column = nil
|
10
|
-
end
|
11
|
-
|
12
|
-
def start_element(name)
|
13
|
-
save_line_col
|
14
|
-
@current_element = name.to_s
|
15
|
-
@current_attributes = []
|
16
|
-
end
|
17
|
-
|
18
|
-
def end_element(name)
|
19
|
-
save_line_col
|
20
|
-
@document.end_tag(name_with_ns_uri(name.to_s))
|
21
|
-
@current_element = nil
|
22
|
-
end
|
23
|
-
|
24
|
-
def attr(name, value)
|
25
|
-
if @current_element
|
26
|
-
if name.to_s.start_with?("xmlns")
|
27
|
-
ns = name.to_s.split(":")
|
28
|
-
@current_ns[ns.length > 1 ? ns.last : ""] = value.to_s
|
29
|
-
else
|
30
|
-
@current_attributes << name_with_ns_uri(name.to_s, false)
|
31
|
-
@current_attributes << value.to_s
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
def attrs_done
|
37
|
-
save_line_col
|
38
|
-
if @current_element
|
39
|
-
@document.start_tag(name_with_ns_uri(@current_element), @current_attributes)
|
40
|
-
@current_element = nil
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
def text(value)
|
45
|
-
save_line_col
|
46
|
-
@document.characters(value)
|
47
|
-
end
|
48
|
-
|
49
|
-
if false
|
50
|
-
def value(value)
|
51
|
-
save_line_col
|
52
|
-
@document.characters(value.as_s)
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
def instruct(inst)
|
57
|
-
end
|
58
|
-
|
59
|
-
private
|
60
|
-
def get_ns_uri(ns)
|
61
|
-
@current_ns[ns] ? "#{@current_ns[ns]}:" : ""
|
62
|
-
end
|
63
|
-
|
64
|
-
def name_with_ns_uri(name, explicit_xmlns = true)
|
65
|
-
name_with_ns = name.split(":")
|
66
|
-
if name_with_ns.length > 1
|
67
|
-
"#{get_ns_uri(name_with_ns.first)}#{name_with_ns.last}"
|
68
|
-
else
|
69
|
-
if explicit_xmlns
|
70
|
-
"#{get_ns_uri("")}#{name_with_ns.first}"
|
71
|
-
else
|
72
|
-
name
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
def save_line_col
|
78
|
-
@document.last_line = @line
|
79
|
-
@document.last_col = @column
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
# handler = OxSaxDocument.new(@document)
|
84
|
-
# Ox.sax_parse(handler, file)
|