module Testdoc
class Document
  def initialize(document)
    @document = document
    parent    = @document
    factory   = @document
    parent.appendChild(factory.createTextNode("\r\n"))

    elem1 = factory.createElement('html')
    elem1.setAttribute("xmlns","http://www.w3.org/1999/xhtml")
    parent.appendChild(elem1)

    elem2 = factory.createElement('head')
    elem1.appendChild(elem2)

    elem3 = factory.createElement('meta')
    elem3.setAttribute("name","generator")
    elem3.setAttribute("content","HTML Tidy, see www.w3.org")
    elem2.appendChild(elem3)

    elem3 = factory.createElement('title')
    elem2.appendChild(elem3)

    elem3.appendChild(factory.createTextNode("XML to Ruby \343\203\206\343\202\271\343\203\210\346\226\207\346\233\270"))

    elem3 = factory.createElement('meta')
    elem3.setAttribute("http-equiv","Content-Type")
    elem3.setAttribute("content","text/html;charset=utf-8")
    elem2.appendChild(elem3)

    elem2 = factory.createElement('body')
    elem2.setAttribute("bgcolor","\#FFFFFF")
    elem1.appendChild(elem2)

    elem3 = factory.createElement('h1')
    elem2.appendChild(elem3)

    elem3.appendChild(factory.createTextNode("XML to Ruby \343\203\206\343\202\271\343\203\210\346\226\207\346\233\270"))

    elem3 = factory.createElement('hr')
    elem2.appendChild(elem3)

    elem3 = factory.createElement('h2')
    elem2.appendChild(elem3)

    elem3.appendChild(factory.createTextNode("\345\237\272\346\234\254\344\273\225\346\247\230"))

    elem3 = factory.createElement('h3')
    elem3.setAttribute('id',"text1")
    @text1=elem3
    elem2.appendChild(elem3)

    elem3.appendChild(factory.createTextNode("\343\203\206\343\202\255\343\202\271\343\203\210\343\201\256\347\275\256\343\201\215\346\217\233\343\201\210"))

    elem3 = factory.createElement('p')
    elem3.setAttribute('id',"text_replace")
    @text_replace=elem3
    elem2.appendChild(elem3)

    elem3.appendChild(factory.createTextNode("Replace Here"))

    elem3 = factory.createElement('h3')
    elem2.appendChild(elem3)

    elem3.appendChild(factory.createTextNode("\343\203\206\343\202\255\343\202\271\343\203\210\343\201\256\347\267\250\351\233\206"))

    elem3 = factory.createElement('p')
    elem3.setAttribute('id',"text_edit")
    @text_edit=elem3
    elem2.appendChild(elem3)

    elem3.appendChild(factory.createTextNode("There's More Than One Way To Do It."))

    elem3 = factory.createElement('h3')
    elem2.appendChild(elem3)

    elem3.appendChild(factory.createTextNode("\345\261\236\346\200\247\343\201\256\345\244\211\346\233\264"))

    elem3 = factory.createElement('p')
    elem3.setAttribute('id',"attribute_change")
    @attribute_change=elem3
    elem2.appendChild(elem3)

    elem3.appendChild(factory.createTextNode("\343\201\223\343\201\256\346\226\207\343\201\257\350\265\244\343\201\247\350\241\250\347\244\272\343\201\225\343\202\214\343\201\276\343\201\231\343\200\202"))

    elem3 = factory.createElement('h3')
    elem2.appendChild(elem3)

    elem3.appendChild(factory.createTextNode("\350\246\201\347\264\240\343\201\256\350\277\275\345\212\240"))

    elem3 = factory.createElement('p')
    elem3.setAttribute('id',"element_add")
    @element_add=elem3
    elem2.appendChild(elem3)

    elem3.appendChild(factory.createTextNode("\343\201\223\343\201\256\345\276\214\343\201\253\343\203\252\343\203\263\343\202\257\343\201\214\350\277\275\345\212\240\343\201\225\343\202\214\343\201\276\343\201\231\343\200\202"))

    elem3 = factory.createElement('hr')
    elem2.appendChild(elem3)

    elem3 = factory.createElement('h2')
    elem2.appendChild(elem3)

    elem3.appendChild(factory.createTextNode("\346\213\241\345\274\265\344\273\225\346\247\230"))

    elem3 = factory.createElement('h3')
    elem2.appendChild(elem3)

    elem3.appendChild(factory.createTextNode("DocumentFragment\343\201\256\347\224\237\346\210\220\343\201\250\347\271\260\343\202\212\350\277\224\343\201\227"))

    elem3 = factory.createElement('p')
    elem2.appendChild(elem3)

    elem3.appendChild(factory.createTextNode("Row\343\202\257\343\203\251\343\202\271\343\201\253\343\202\210\343\202\212\350\241\214\343\202\222\347\224\237\346\210\220\343\201\227\343\201\276\343\201\231\343\200\202"))

    elem3 = factory.createElement('table')
    elem3.setAttribute("align","center")
    elem3.setAttribute('id',"table")
    @table=elem3
    elem2.appendChild(elem3)

    elem4 = factory.createElement('tr')
    elem3.appendChild(elem4)

    elem5 = factory.createElement('th')
    elem5.setAttribute("nowrap","nowrap")
    elem4.appendChild(elem5)

    elem5.appendChild(factory.createTextNode("\346\233\264\346\226\260\346\227\245\346\231\202"))

    elem5 = factory.createElement('th')
    elem5.setAttribute("nowrap","nowrap")
    elem4.appendChild(elem5)

    elem5.appendChild(factory.createTextNode("\343\202\277\343\202\244\343\203\210\343\203\253"))

    elem5 = factory.createElement('th')
    elem5.setAttribute("nowrap","nowrap")
    elem4.appendChild(elem5)

    elem5.appendChild(factory.createTextNode("\344\275\234\350\200\205"))

    parent.appendChild(factory.createTextNode("\r\n"))

    parent.appendChild(factory.createTextNode("\r"))

  end
  attr_reader :document
  attr_reader :text1
  attr_reader :text_replace
  attr_reader :text_edit
  attr_reader :attribute_change
  attr_reader :element_add
  attr_reader :table
  def accept(visitor,*rest)
    visitor.visit_Prologue(prologue,*rest)
    @document.accept(visitor,*rest)
  end
  def prologue
    "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">"
  end
  def to_s
    prologue+@document.to_s
  end
  def method_missing(method,*arg)
    @document.send(method,*arg)
  end
end
class Fresh
  def initialize(factory)
    @document = factory.createDocumentFragment()
    parent    = @document
    elem1 = factory.createElement('tr')
    parent.appendChild(elem1)

    elem2 = factory.createElement('td')
    elem2.setAttribute("align","center")
    elem2.setAttribute("nowrap","nowrap")
    @time=elem2
    elem1.appendChild(elem2)

    elem2.appendChild(factory.createTextNode("2001/02/23\n20:50"))

    elem2 = factory.createElement('td')
    elem2.setAttribute("nowrap","nowrap")
    @title=elem2
    elem1.appendChild(elem2)

    elem3 = factory.createElement('a')
    elem3.setAttribute("href","http://www.moonwolf.com/ruby/")
    elem2.appendChild(elem3)

    elem3.appendChild(factory.createTextNode("Ruby\343\202\271\343\202\257\343\203\252\343\203\227\343\203\210"))

    elem2 = factory.createElement('td')
    elem2.setAttribute("nowrap","nowrap")
    @author=elem2
    elem1.appendChild(elem2)

    elem3 = factory.createElement('a')
    elem3.setAttribute("href","http://www.moonwolf.com/")
    elem2.appendChild(elem3)

    elem3.appendChild(factory.createTextNode("MoonWolf"))

  end
  attr_reader :document
  attr_reader :time
  attr_reader :title
  attr_reader :author
  def to_s
    @document.to_s
  end
  def method_missing(method,*arg)
    @document.send(method,*arg)
  end
end
class Old
  def initialize(factory)
    @document = factory.createDocumentFragment()
    parent    = @document
    elem1 = factory.createElement('tr')
    parent.appendChild(elem1)

    elem2 = factory.createElement('td')
    elem2.setAttribute("align","center")
    elem2.setAttribute("nowrap","nowrap")
    @time=elem2
    elem1.appendChild(elem2)

    elem2.appendChild(factory.createTextNode("2000/10/22\n21:08"))

    elem2 = factory.createElement('td')
    elem2.setAttribute("nowrap","nowrap")
    @title=elem2
    elem1.appendChild(elem2)

    elem3 = factory.createElement('a')
    elem3.setAttribute("href","http://www.jin.gr.jp/~nahi/Ruby/")
    elem2.appendChild(elem3)

    elem3.appendChild(factory.createTextNode("Rubyavailable"))

    elem2 = factory.createElement('td')
    elem2.setAttribute("nowrap","nowrap")
    @author=elem2
    elem1.appendChild(elem2)

    elem3 = factory.createElement('a')
    elem3.setAttribute("href","http://www.jin.gr.jp/~nahi/")
    elem2.appendChild(elem3)

    elem3.appendChild(factory.createTextNode("\343\201\252\343\201\262"))

  end
  attr_reader :document
  attr_reader :time
  attr_reader :title
  attr_reader :author
  def to_s
    @document.to_s
  end
  def method_missing(method,*arg)
    @document.send(method,*arg)
  end
end
end
