| Class | REXML::XMLDecl |
| In: |
|
| Parent: | Child |
Included Modules
Constants
| DEFAULT_VERSION | = | "1.0"; |
| DEFAULT_ENCODING | = | "UTF-8"; |
| DEFAULT_STANDALONE | = | "no"; |
| START | = | |
| STOP | = | '\?>'; |
External Aliases
| standalone | -> | stand_alone? |
| encoding= | -> | old_enc= |
Attributes
| standalone | [RW] | |
| version | [RW] | |
| writeencoding | [R] |
Public Class methods
18: def initialize(version=DEFAULT_VERSION, encoding=nil, standalone=nil) 19: @writethis = true 20: @writeencoding = !encoding.nil? 21: if version.kind_of? XMLDecl 22: super() 23: @version = version.version 24: self.encoding = version.encoding 25: @writeencoding = version.writeencoding 26: @standalone = version.standalone 27: else 28: super() 29: @version = version 30: self.encoding = encoding 31: @standalone = standalone 32: end 33: @version = DEFAULT_VERSION if @version.nil? 34: end
Public Instance methods
52: def ==( other ) 53: other.kind_of?(XMLDecl) and 54: other.version == @version and 55: other.encoding == self.encoding and 56: other.standalone == @standalone 57: end
72: def encoding=( enc ) 73: if enc.nil? 74: self.old_enc = "UTF-8" 75: @writeencoding = false 76: else 77: self.old_enc = enc 78: @writeencoding = true 79: end 80: self.dowrite 81: end
40: def write writer, indent=-1, transitive=false, ie_hack=false 41: return nil unless @writethis or writer.kind_of? Output 42: indent( writer, indent ) 43: writer << START.sub(/\\/u, '') 44: if writer.kind_of? Output 45: writer << " #{content writer.encoding}" 46: else 47: writer << " #{content encoding}" 48: end 49: writer << STOP.sub(/\\/u, '') 50: end