Hi,

From: David Corbin <dcorbin / imperitek.com>
Date: Sat, 21 Apr 2001 07:32:49 +0900
> >  * MoonWolf's xml2rb.  xml2rb like XMLC of Enhydra, but it creates
> >    Ruby objects, not Java.
> >    http://www.moonwolf.com/ruby/archive/xml2rb-0.1.2.tar.bz2
> 
> Coolness.  I was just contemplating doing this one as my first Ruby
> project.  Now I don't have to...:)

OK. Here is a translation of README.rd.ja.

--README.rd.en--------------------------------------------------------
=begin
= xml2rb - XML document compiler
Coptright (c)2001, MoonWolf. All right reserved.

compile XML document and generate Ruby class.

== usage

  xml2rb.rb [--name name] [<input-file> <output-file>]

:--name name
  module name
  (default: capitalized input-file or output-file)
  (ex. testdoc.html => Testdoc)
:<input-file>
  XML document (default: STDIN)
:<output-file>
  script file (default: STDOUT)

=== example
+ compile
   $ ruby xml2rb.rb testdoc.html testdoc.rb
+ coding
   see test.rb
+ execute
   $ ruby test.rb > testout.html

== generate XHTML
You can use htmlconv.rb to convert HTML into XHTML.
htmlconv.rb calls ``HTML Tidy(http://www.w3.org/People/Raggett/tidy/)''
and converts HTML into XHTML.

=== usage of htmlconv.rb

  htmlconv.rb <input-file> <output-file>

:<input-file>
  HTML document
:<output-file>
  XHMTL document (default: <input-file> with `.xhtml')

== structure of module
  <html> <- Testdoc::Document
   <body>
    <p id="field"> <- Testdoc::Document#field
    <table id="Fragment1"> <- Testdoc::Fragment1
    </table>
    <ul id="Fragment2"> <- Testdoc::Fragment2
     <li>Item</li>
    </ul>
   </body>
  </html>

This XML docuemnt is translated as follow:

  module Testdoc    #namespace (name of --name)
    class Document  #document itself
      def document  #instance of XML::DOM::Document
      end
      def field     #elements with id="field"
      end
    end
    class Fragment1 #fragment
      def document  #instance of XML::DOM::DocumentFragment
      end
    end
    class Fragment2 #fragment
      def document  #instance of XML::DOM::DocumentFragment
      end
    end
  end

== usage of generated class
ex. testdoc.rb

=== generate XML document
  require 'testdoc'            #load module
  doc = Testdoc::Document.new  #generate DOM tree
  print doc.to_s               #output XML document

=== output XHTML
When you need compatibility for HTML, you should use XHTMLWriter.

  require "xhtmlwriter"        #load XHTMLWriter
  require "testdoc"            #load module
  doc=Testdoc::Document.new    #generate DOM tree
  writer = XHTMLWriter.new($stdout)
  doc.accept(writer,[])        #output XHTML document

=== access to element
you can refer Element with variable name of id attribute

  doc.attribute_change.setAttribute("style","color:red")

== check output
When you check XML output, you can use output.rb.

  output.rb <filename> [module name]

:filename
  filename generated by xml2rb.rb
:module name
  module name using in xml2rb.rb's option(--name)
  (default: same as xml2rb.rb)

When you check XHTML output, you can use xhtmlwriter.rb.

  xhtmlwriter.rb <filename> [module name]

:filename
  (same as output.rb)
:module name
  (same as output.rb)

== history
* 2001/03/01 21:15 - MoonWolf
  * Version 0.1.2
  * fix a bug of escaping Attribute
  * add XHTMLWriter
  * add htmlconv.rb
* 2001/02/25 16:39 - MoonWolf
  * Version 0.1.1
  * fix a bug of excaping character entity reference
  * not process id attribute which has trouble as class name
  * add output.rb
  * delete indentation processing
* 2001/02/24 06:16 - MoonWolf
  * Version 0.1.0
  * initial release
=end

--README.rd.en--------------------------------------------------------


TAKAHASHI Masayoshi (maki / open-news.com)