def method_missing(sym, *args, &block)
      if respond_to?(:name)
        ns = name.split(':').first
        if ns and ns != name
          target = locate(ns + ':' + sym.to_s).first
          return target if target
        end
      end
      super(sym, *args, &block)
    rescue Exception => orig_error
      begin
        # handling Constant look up to dynamically extend or add to element
        if lowercase?(sym)
          if (const = look_up_const) and const.is_a?(Module)
            extend const
            result = method(sym).call(*args)
            return(result) unless block_given?
            yield(result)
          elsif block_given?
            new_method = proc(&block)
            self.const_set(sym, new_method)
            return new_method.call *args
          else
            raise orig_error
          end # if (const = look_up_const) ... elsif block_given? ... else ...
        else
          results = filter(sym, args)
          return results unless block_given?
          results.keep_if do |node| yield(node) end
        end # if lowercase? ... else ...
      rescue Exception
        raise orig_error
      end
    end
def method_missing(sym, *args, &block)
      if respond_to?(:name)
        ns = name.split(':').first
        if ns and ns != name
          target = locate(ns + ':' + sym.to_s).first
          return target if target
        end
      end
      super(sym, *args, &block)
    rescue Exception => orig_error
      begin
        # handling Constant look up to dynamically extend or add to element
        if lowercase?(sym)
          if (const = look_up_const) and const.is_a?(Module)
            extend const
            result = method(sym).call(*args)
            return(result) unless block_given?
            yield(result)
          elsif block_given?
            new_method = proc(&block)
            self.const_set(sym, new_method)
            return new_method.call *args
          else
            raise orig_error
          end # if (const = look_up_const) ... elsif block_given? ... else ...
        else
          results = filter(sym, args)
          return results unless block_given?
          results.keep_if do |node| yield(node) end
        end # if lowercase? ... else ...
      rescue Exception
        raise orig_error
      end
    end
welcome to Lazy-Ox - where any method that doesn't exist, you can create on the fly and assign its methods to
 a corresponding Duxml::Element. see Regexp.nmtoken and String#nmtokenize and String#constantize to see how a given symbol
 can be converted into XML element names and vice versa. it can also use Class names as method calls to return children by type

 this method uses Ox::Element's :method_missing but adds an additional rescue block that:
   matches namespaced Ruby module to this Element's name and extends this node with module's methods
   then method matching symbol is called again with given arguments, yielding result to block if given, returning result if not
   e.g.
     module Duxml
       module Throwable
         def throw
           puts 'throwing!!'
         end
       end
     end

     Element.new('throwable').throw => 'throwing!!'

   if symbol name matches a module then method yields to block or returns as array child nodes that matches class
   you can further refine search results by adding the symbol of the child instance variable, including name, by which to filter
   if block given, returns first child for which block evaluates to true

   e.g.
     module Child; end

     n = Element.new('node')
     n << 'text'
     n << Element.new('child')
     n << Element.new('child')
     n.Child                                                      # returns Array of Element nodes
         => [#<Duxml::Element:0x0002 @value="child" ...>,
             #<Duxml::Element:0x0003 @value="child" ...>]

     n.Child.each do |child| child << 'some text' end              # adding some text
         => ['textsome text',
             #<Duxml::Element:0x0002 @value="child" ... @nodes=['some text']>,
             #<Duxml::Element 0x0003 @value="child" ... @nodes=['some text']>]

     %w(bar mar).each_with_index do |x, i| next if i.zero?; n.Child[i][:foo] = x end        # adding some attributes
         => ['textsome text',
             #<Duxml::Element:0x0002 @value="child" @attributes={foo: 'bar'} ...>,
             #<Duxml::Element:0x0003 @value="child" @attributes={foo: 'mar'} ...>]

     n.Child(:foo)                                                                       # returns array of Child nodes with attribute :foo
         => [#<Duxml::Element:0x0002 @value="child" @attributes={foo: 'bar'} ...>,
             #<Duxml::Element:0x0003 @value="child" @attributes={foo: 'mar'} ...>]

     n.Child(foo: 'bar')                                                                 # returns array of Child nodes with attribute :foo equal to 'bar'
         => [#<Duxml::Element:0xfff @value="child" @attributes={foo: 'bar'} ...>]


   if element name has no matching Module in namespace,
     if symbol is lower case, it is made into a method, given &block as definition, then called with *args
       e.g. n.change_color('blue') do |new_color|  => #<Duxml::Element:0xfff @value="node" @attributes={color: 'blue'} @nodes=[]>
              @color = new_color
              self
            end
            n.color                                => 'blue'
            n.change_color('mauve').color          => 'mauve'

 @param sym [Symbol] method, class or module
 @param *args [*several_variants] either arguments to method or initializing values for instance of given class
 @param &block [block] if yielding result, yields to given block; if defining new method, block defines its contents