Hi,
We have a fast parser: XMLPaser. And we have a useful XML object
class: REXML.
So, I wrote REXMLBuilder, REXML document builder using XMLParser.
http://www.rubycolor.org/arc/tmp/rexmlbuilder.rb
It requires a patch for REXML to create DocType by String.
--- doctype.rb.orig Sat Dec 15 11:37:28 2001
+++ doctype.rb Sat Dec 15 11:43:57 2001
@@ -22,19 +22,22 @@
##
# Constructor
- # @param parent if given, is set as the parent of this object
+ # @param parent If first is String, it must be String and set to
+ # external_id. Otherwise, it is set as the parent of this object.
# @param first can be multiple types. If String, name is set to this
# and external_id is set to nil. If DocType, the object is cloned. If
# Source, the source is scanned for the DOCTYPE declaration.
def initialize( first, parent=nil )
- super(parent)
if first.kind_of? String
+ super()
@name = first
- @external_id = nil
+ @external_id = parent
elsif first.kind_of? DocType
+ super(parent)
@name = first.name
@external_id = first.external_id
elsif first.kind_of? Source
+ super(parent)
md = first.match( PATTERN_RE, true )
identity = md[1]
close = md[2]
Regards,
TAKAHASHI 'Maki' Masayoshi E-mail: maki / open-news.com