shanna-xml-sax-machines 0.1.1 → 0.2.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.
@@ -70,17 +70,32 @@ module XML
70
70
  path = @context.path
71
71
  if @buffer > 0 && block = @found.delete(path)
72
72
  @buffer -= 1
73
- block.call(@context) # Copy @context fragment tree to actual fragment?
73
+ block.call(@context)
74
74
  end
75
75
  super
76
76
 
77
77
  if @buffer == 0 && !(path == '/')
78
- # Unlink children if position context []
79
- # @doc.at(path).children.unlink unless path == '/'
80
78
  @document.at(path).unlink
79
+
80
+ # Unlinked children are not garbage collected till the document they were created in is (I think).
81
+ # This hack job halves memory usage but it still grows too fast for my liking :(
82
+ @document = @document.dup
83
+ @context = @document.at(@context.path) rescue nil
81
84
  end
82
85
  end
83
86
 
87
+ def characters(string) # :nodoc:
88
+ @buffer > 0 ? super : (filter && filter.characters(string))
89
+ end
90
+
91
+ def comment(string) # :nodoc:
92
+ @buffer > 0 ? super : (filter && filter.comment(string))
93
+ end
94
+
95
+ def cdata_block(string) # :nodoc:
96
+ @buffer > 0 ? super : (filter && filter.cdata_block(string))
97
+ end
98
+
84
99
  end # FragmentBuilder
85
100
  end # SAX
86
101
  end # XML
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shanna-xml-sax-machines
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shane Hanna
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-03-17 00:00:00 -07:00
12
+ date: 2009-03-21 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -32,19 +32,21 @@ extra_rdoc_files:
32
32
  - README.rdoc
33
33
  - LICENSE
34
34
  files:
35
- - README.rdoc
36
35
  - VERSION.yml
36
+ - README.rdoc
37
37
  - lib/xml-sax-machines
38
- - lib/xml-sax-machines/builder.rb
39
- - lib/xml-sax-machines/debug.rb
40
38
  - lib/xml-sax-machines/filter.rb
39
+ - lib/xml-sax-machines/debug.rb
40
+ - lib/xml-sax-machines/pipeline.rb
41
+ - lib/xml-sax-machines/builder.rb
41
42
  - lib/xml-sax-machines/fragment_builder.rb
42
43
  - lib/xml-sax-machines.rb
44
+ - test/pipeline_test.rb
45
+ - test/filter_test.rb
43
46
  - test/builder_test.rb
47
+ - test/test_helper.rb
44
48
  - test/debug_test.rb
45
- - test/filter_test.rb
46
49
  - test/fragment_builder_test.rb
47
- - test/test_helper.rb
48
50
  - LICENSE
49
51
  has_rdoc: true
50
52
  homepage: http://github.com/shanna/xml-sax-machines