class Rsxml::Visitor::WriteXmlVisitor

Attributes

xml[R]

Public Class Methods

new(xml_builder=nil) click to toggle source
# File lib/rsxml/visitor.rb, line 18
def initialize(xml_builder=nil)
  @xml = xml_builder || Builder::XmlMarkup.new
end

Public Instance Methods

element(context, name, attrs, ns_decls) { || ... } click to toggle source
# File lib/rsxml/visitor.rb, line 22
def element(context, name, attrs, ns_decls)
  qname = Namespace::compact_qname(context.ns_stack, name)
  qattrs = Namespace::compact_attr_qnames(context.ns_stack, attrs)
  ns_attrs = Namespace::namespace_attributes(ns_decls)
  attrs = qattrs.merge(ns_attrs)

  xml.__send__(qname, attrs) do
    yield
  end
end
text(context, text) click to toggle source
# File lib/rsxml/visitor.rb, line 33
def text(context, text)
  xml << text
end
to_s() click to toggle source
# File lib/rsxml/visitor.rb, line 37
def to_s
  xml.target!
end