Parent

Class/Module Index [+]

Quicksearch

AbstractXMLInstantiator

Public Instance Methods

instantiate(str, gcSuspendCount=0) click to toggle source

Parses str and calls start_tag, end_tag, set_attribute and text methods of a subclass.

If gcSuspendCount is specified, the garbage collector will be disabled for that number of start or end tags. After that period it will clean up and then be disabled again. A value of about 1000 can significantly improve overall performance. The memory usage normally does not increase. Depending on the work done for every xml tag the value might have to be adjusted.

# File lib/rgen/instantiator/abstract_xml_instantiator.rb, line 50
def instantiate(str, gcSuspendCount=0)
  gcDisabledBefore = GC.disable
  gcSuspendCount = 0 if gcDisabledBefore
  begin
    visitor = Visitor.new(self, gcSuspendCount)
    parser = Nokogiri::XML::SAX::Parser.new(visitor)
    parser.parse(str) do |ctx|
      @parserContext = ctx
    end
   ensure 
    GC.enable unless gcDisabledBefore
  end
end
text(str) click to toggle source
# File lib/rgen/instantiator/abstract_xml_instantiator.rb, line 64
def text(str)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.