class XTemplate::XMLVisitor
Public Class Methods
Source
# File lib/xtemplate/xml.rb, line 83 def initialize init_root() #@orig_kcode = $KCODE end
Public Instance Methods
Source
# File lib/xtemplate/xml.rb, line 201 def on_attr_charref(code) push_attrval("&\##{code};") end
Source
# File lib/xtemplate/xml.rb, line 205 def on_attr_charref_hex(code) push_attrval("&\#x#{'%x' % code};") end
Source
# File lib/xtemplate/xml.rb, line 197 def on_attr_entityref(ref) push_attrval("&#{ref};") end
Source
# File lib/xtemplate/xml.rb, line 193 def on_attr_value(str) push_attrval(str) end
Source
# File lib/xtemplate/xml.rb, line 189 def on_attribute(name) push_attr(name) end
Source
# File lib/xtemplate/xml.rb, line 165 def on_cdata(str) push_content("<![CDATA[#{str}]]>") end
Source
# File lib/xtemplate/xml.rb, line 161 def on_chardata(str) push_content(str) end
Source
# File lib/xtemplate/xml.rb, line 173 def on_charref(code) push_content("&\##{code};") end
Source
# File lib/xtemplate/xml.rb, line 177 def on_charref_hex(code) push_content("&\#x#{'%x' % code};") end
Source
# File lib/xtemplate/xml.rb, line 153 def on_comment(str) push_content("<!--#{str}-->") end
Source
# File lib/xtemplate/xml.rb, line 132 def on_doctype(root,pubid,sysid) if( pubid ) if( sysid ) push_content("<!DOCTYPE #{root} PUBLIC \"#{pubid}\" \"#{sysid}\">") else push_content("<!DOCTYPE #{root} PUBLIC \"#{pubid}\">") end else if( sysid ) push_content("<!DOCTYPE #{root} SYSTEM \"#{sysid}\">") else push_content("<!DOCTYPE #{root}>") end end push_content(NEWLINE) end
Source
# File lib/xtemplate/xml.rb, line 184 def on_end_document #@root.add_child(NEWLINE) #$KCODE = @orig_kcode end
Source
# File lib/xtemplate/xml.rb, line 169 def on_entityref(ref) push_content("&#{ref};") end
Source
# File lib/xtemplate/xml.rb, line 157 def on_pi(target, pi) push_pi(target,pi) end
Source
# File lib/xtemplate/xml.rb, line 149 def on_prolog_space(str) push_content(str) end
Source
# File lib/xtemplate/xml.rb, line 216 def on_stag_end_empty(name) on_stag_end(name) on_etag(name) end
Source
# File lib/xtemplate/xml.rb, line 115 def on_xmldecl_encoding(str) #$KCODE = str push_content(" encoding=\"#{str}\"") end
Source
# File lib/xtemplate/xml.rb, line 128 def on_xmldecl_end push_content("?>", NEWLINE) end
Source
# File lib/xtemplate/xml.rb, line 124 def on_xmldecl_other(name,value) push_content(" #{name}=\"#{value}\"") end
Source
# File lib/xtemplate/xml.rb, line 120 def on_xmldecl_standalone(str) push_content(" standalone=\"#{str}\"") end
Source
# File lib/xtemplate/xml.rb, line 111 def on_xmldecl_version(str) push_content(" version=\"#{str}\"") end
Source
# File lib/xtemplate/xml.rb, line 92 def parse_error(msg) raise(RuntimeError, "%s:%d:%s" % [@parser.path, @parser.lineno, msg]) end
Source
# File lib/xtemplate/xml.rb, line 100 def valid_error(msg) raise(RuntimeError, "%s:%d:%s" % [@parser.path, @parser.lineno, msg]) end
Source
# File lib/xtemplate/xml.rb, line 96 def wellformed_error(msg) raise(RuntimeError, "%s:%d:%s" % [@parser.path, @parser.lineno, msg]) end