axml 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/axml/libxml.rb +8 -6
- data/lib/axml/xmlparser.rb +1 -1
- metadata +7 -7
data/lib/axml/libxml.rb
CHANGED
@@ -14,20 +14,22 @@ class AXML::LibXML
|
|
14
14
|
extend AXML
|
15
15
|
class << self
|
16
16
|
|
17
|
+
def parse_it(method, arg, opts={})
|
18
|
+
opts = AXML::DEFAULTS.merge opts
|
19
|
+
XML::Parser.default_keep_blanks = opts[:keep_blanks] if opts.key?(:keep_blanks)
|
20
|
+
XML::Parser.send(method, arg).parse.root
|
21
|
+
end
|
22
|
+
|
17
23
|
# beware that threading with different :keep_blanks values could cause
|
18
24
|
# problems since this is a global Libxml setting
|
19
25
|
def parse_io(io, opts={})
|
20
|
-
|
21
|
-
XML::Parser.default_keep_blanks = opts[:keep_blanks] if opts.key?(:keep_blanks)
|
22
|
-
XML::Parser.io(io).parse.root
|
26
|
+
parse_it(:io, io, opts)
|
23
27
|
end
|
24
28
|
|
25
29
|
# beware that threading with different :keep_blanks values could cause
|
26
30
|
# problems since this is a global Libxml setting
|
27
31
|
def parse_string(string, opts={})
|
28
|
-
|
29
|
-
XML::Parser.default_keep_blanks = opts[:keep_blanks] if opts.key?(:keep_blanks)
|
30
|
-
XML::Parser.string(string).parse.root
|
32
|
+
parse_it(:string, string, opts)
|
31
33
|
end
|
32
34
|
end
|
33
35
|
end
|
data/lib/axml/xmlparser.rb
CHANGED
@@ -81,7 +81,7 @@ class AXML::XMLParser::Parser < XMLParser
|
|
81
81
|
tmpvar = $VERBOSE ; $VERBOSE = nil
|
82
82
|
def endElement(name)
|
83
83
|
if @cur.text.is_a? Array
|
84
|
-
@cur.text
|
84
|
+
@cur.text = [@cur.text.first, byteIndex - @cur.text.first]
|
85
85
|
end
|
86
86
|
@cur = @cur.parent
|
87
87
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: axml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Prince
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-03-06 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -23,12 +23,12 @@ extra_rdoc_files:
|
|
23
23
|
- README
|
24
24
|
- LICENSE
|
25
25
|
files:
|
26
|
-
- lib/axml.rb
|
27
|
-
- lib/axml/libxml.rb
|
28
26
|
- lib/axml/el.rb
|
29
|
-
- lib/axml/xmlparser.rb
|
30
27
|
- lib/axml/autoload.rb
|
28
|
+
- lib/axml/libxml.rb
|
29
|
+
- lib/axml/xmlparser.rb
|
31
30
|
- lib/axml/traverse.rb
|
31
|
+
- lib/axml.rb
|
32
32
|
- README
|
33
33
|
- LICENSE
|
34
34
|
- Rakefile
|
@@ -64,7 +64,7 @@ signing_key:
|
|
64
64
|
specification_version: 2
|
65
65
|
summary: "AXML - Provides a simple, minimalistic DOM for working with data stored in an XML document. The API is very similar to LibXML, differing slightly in the handling of text nodes. It is designed with very large documents in mind: nodes are represented in memory efficient Struct objects and it works with either XMLParser or LibXML!"
|
66
66
|
test_files:
|
67
|
-
- spec/
|
67
|
+
- spec/axml/xmlparser_spec.rb
|
68
68
|
- spec/axml/autoload_spec.rb
|
69
69
|
- spec/axml/libxml_spec.rb
|
70
|
-
- spec/
|
70
|
+
- spec/axml_spec.rb
|