Class XTemplate::XMLListener
In: lib/xtemplate/xml.rb
Parent: Object

Methods

Included Modules

XNodeManager

Public Class methods

[Source]

# File lib/xtemplate/xml.rb, line 259
    def initialize
      init_root()
    end

Public Instance methods

[Source]

# File lib/xtemplate/xml.rb, line 298
    def attlistdecl(content)
      push_content("<!ATTLIST #{content}>")
    end

[Source]

# File lib/xtemplate/xml.rb, line 318
    def cdata(s)
      push_content("<![CDATA[#{s}]]>")
    end

[Source]

# File lib/xtemplate/xml.rb, line 283
    def comment(str)
      push_content("<!--#{str}-->")
    end

[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

[Source]

# File lib/xtemplate/xml.rb, line 302
    def elementdecl(content)
      push_content("<!ELEMENT #{content}>")
    end

[Source]

# File lib/xtemplate/xml.rb, line 314
    def entity(s)
      push_content("%#{s};")
    end

[Source]

# File lib/xtemplate/xml.rb, line 306
    def entitydecl(contents)
      push_content("<!ENTITY #{contents.join(' ')}>")
    end

[Source]

# File lib/xtemplate/xml.rb, line 279
    def instruction(target, pi)
      push_pi(target, pi)
    end

[Source]

# File lib/xtemplate/xml.rb, line 310
    def notationdecl(content)
      push_content("<!NOTATION #{content}>")
    end

[Source]

# File lib/xtemplate/xml.rb, line 271
    def tag_end(name)
      pop_node()
    end

[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

[Source]

# File lib/xtemplate/xml.rb, line 275
    def text(str)
      push_content(REXML::Text::normalize(str))
    end

[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

[Validate]