# class REXML::ReferenceWriter

### Public Class Methods

new(id_type, public_id_literal, system_literal) click to toggle source

    # File lib/rexml/doctype.rb, line 10
    def initialize(id_type,
                   public_id_literal,
                   system_literal)
      @id_type = id_type
      @public_id_literal = public_id_literal
      @system_literal = system_literal
      @default_quote = "\""
    end

### Public Instance Methods

write(output) click to toggle source

    # File lib/rexml/doctype.rb, line 19
    def write(output)
      output << " #{@id_type}"
      if @public_id_literal
        if @public_id_literal.include?("'")
          quote = "\""
        else
          quote = @default_quote
        end
        output << " #{quote}#{@public_id_literal}#{quote}"
      end
      if @system_literal
        if @system_literal.include?("'")
          quote = "\""
        elsif @system_literal.include?("\"")
          quote = "'"
        else
          quote = @default_quote
        end
        output << " #{quote}#{@system_literal}#{quote}"
      end
    end