       # merge attributes and child elements onto parent object.  this may
       # cause collisions.
       mergeAttrs: false
+      # optional validator for schema-driven generawtion
+      validator: null
     # overwrite them with the specified options, if any
     @options[key] = value for own key, value of opts
 

      @emit "end", null
      return true

    @saxParser.write str.toString()

      if @options.emptyTag != undefined && isEmpty obj
        obj = @options.emptyTag

      if @options.validator?
        obj = @options.validator.validate(obj, stack, nodeName)

      # check whether we closed all the open tags
      if stack.length > 0
        if not @options.explicitArray
