class XTemplate::XMLListener

Public Class Methods

new() click to toggle source
# File lib/xtemplate/xml.rb, line 259
def initialize
  init_root()
end

Public Instance Methods

attlistdecl(content) click to toggle source
# File lib/xtemplate/xml.rb, line 298
def attlistdecl(content)
  push_content("<!ATTLIST #{content}>")
end
cdata(s) click to toggle source
# File lib/xtemplate/xml.rb, line 318
def cdata(s)
  push_content("<![CDATA[#{s}]]>")
end
comment(str) click to toggle source
# File lib/xtemplate/xml.rb, line 283
def comment(str)
  push_content("<!--#{str}-->")
end
doctype(root, pub_sys, long_name, uri) click to toggle source
# File lib/xtemplate/xml.rb, line 287
def doctype(root, pub_sys, long_name, uri)
  if( root && pub_sys && uri )
    push_content("<!DOCTYPE #{root} #{pub_sys} \"#{long_name}\" \"#{uri}\">")
  elsif( root && pub_sys && !uri )
    push_content("<!DOCTYPE #{root} #{pub_sys} \"#{long_name}\">")
  elsif( root && !pubid && !uri )
    push_content("<!DOCTYPE #{root}>")
  end
  push_content(NEWLINE)
end
elementdecl(content) click to toggle source
# File lib/xtemplate/xml.rb, line 302
def elementdecl(content)
  push_content("<!ELEMENT #{content}>")
end
entity(s) click to toggle source
# File lib/xtemplate/xml.rb, line 314
def entity(s)
  push_content("%#{s};")
end
entitydecl(contents) click to toggle source
# File lib/xtemplate/xml.rb, line 306
def entitydecl(contents)
  push_content("<!ENTITY #{contents.join(' ')}>")
end
instruction(target, pi) click to toggle source
# File lib/xtemplate/xml.rb, line 279
def instruction(target, pi)
  push_pi(target, pi)
end
notationdecl(content) click to toggle source
# File lib/xtemplate/xml.rb, line 310
def notationdecl(content)
  push_content("<!NOTATION #{content}>")
end
tag_end(name) click to toggle source
# File lib/xtemplate/xml.rb, line 271
def tag_end(name)
  pop_node()
end
tag_start(name, attrs) click to toggle source
# File lib/xtemplate/xml.rb, line 263
def tag_start(name, attrs)
  push_tag(name)
  attrs.each{|attr,val|
    push_attr(attr)
    push_attrval(val)
  }
end
text(str) click to toggle source
# File lib/xtemplate/xml.rb, line 275
def text(str)
  push_content(REXML::Text::normalize(str))
end
xmldecl(version, encoding, standalone) click to toggle source
# File lib/xtemplate/xml.rb, line 322
def xmldecl(version, encoding, standalone)
  content = []
  if( version )
    content.push("version=\"#{version}\"")
  end
  if( encoding )
    content.push("encoding=\"#{encoding}\"")
  end
  if( standalone )
    content.push("standalone=\"#{standalone}\"")
  end
  push_content("<?xml #{content.join(' ')}?>", NEWLINE)
end