Class: XML::ParserNS

Inherits:
Object
  • Object
show all
Defined in:
lib/xml/parserns.rb

Direct Known Subclasses

DOM::DOMBuilder

Constant Summary collapse

EVENT_HANDLERS =
[
:character,
:processingInstruction,
:unparsedEntityDecl,
:notationDecl,
:externalEntityRef,
:comment,
:startCdata,
:endCdata,
:startNamespaceDecl,
:endNamespaceDecl,
:startDoctypeDecl,
:endDoctypeDecl,
:default,
:defaultExpand,
:unknownEncoding,
:notStandalone,
:elementDecl,
:attlistDecl,
:xmlDecl,
:entityDecl,
:externalParsedEntityDecl,
:internalParsedEntityDecl]

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ ParserNS

Returns a new instance of ParserNS.



212
213
214
# File 'lib/xml/parserns.rb', line 212

def initialize(*args)
  @parser = InternalParserNS.new(self, *args)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args) ⇒ Object



227
228
229
230
231
232
233
234
# File 'lib/xml/parserns.rb', line 227

def method_missing(name, *args)
  if @parser.respond_to?(name)
    @parser.send(name, *args)
  else
    raise NameError.new("undefined method `#{name.id2name}' " +
                        "for #{self.inspect}")
  end
end

Instance Method Details

#parse(*args, &block) ⇒ Object



216
217
218
219
220
221
222
223
# File 'lib/xml/parserns.rb', line 216

def parse(*args, &block)
  EVENT_HANDLERS.each do |m|
    if self.respond_to?(m)
      eval "def @parser.#{m}(*args); @parserNS.#{m}(*args); end"
    end
  end
  @parser.parse(*args, &block)
end

#setReturnNSTriplet(do_nst) ⇒ Object



225
# File 'lib/xml/parserns.rb', line 225

def setReturnNSTriplet(do_nst); end