This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_extPart_000_01C07599.A9B0B470
Content-Type: text/plain;
	charsetso-8859-1"
Content-Transfer-Encoding: quoted-printable

xmltreebuilder.rb (look under .../ruby/lib/site_ruby/1.6) seems to implement
a DOM-model. I don't know to what extent, though.
Find attached a small example.
Clemens

-----Ursprgliche Nachricht-----
Von: jweirich / one.net [mailto:jweirich / one.net]
Gesendet am: Mittwoch, 3. Januar 2001 13:48
An: ruby-talk / netlab.co.jp
Betreff: [ruby-talk:8562] XML, DOM, SAX, XSL

I'm going to be doing some demo's of XML parsing in Java over the next
few weeks.  I'd love to put together some Ruby demos at the same time.
I see the XMLParser in RAA which looks like a SAX-like parser.  I
didn't see any DOM oriented libraries or anything that did XSL
processing.  Is anyone working on things along this line?

-- 
-- Jim Weirich     jweirich / one.net    http://w3.one.net/~jweirich
---------------------------------------------------------------------
"Beware of bugs in the above code; I have only proved it correct, 
not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)


------_extPart_000_01C07599.A9B0B470
Content-Type: application/octet-stream;
	name
om.rb"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename
om.rb"

require 'xmltreebuilder'

def annotateWithXPointer(node, recursively = false)
if recursively
node.childNodes do |child|
if child.type == XML::Element
annotateWithXPointer(child, recursively)
end
end
end
xpointer = node.makeXPointer(false)
annotate = XML::Element.new("xpointer", nil, 
[XML::Text.new(xpointer)])
node.insertBefore(annotate, node[0])
end

def test
builder = XML::SimpleTreeBuilder.new
xml = STDIN.read
begin
tree = builder.parse(xml)
rescue XMLParserError => xpe
line = builder.line
print "#{$0}: #{xpe} in line #{line}\n"
exit 1
end

root = tree.documentElement
annotateWithXPointer(root, true)
puts tree.to_s
end

test
-----_extPart_000_01C07599.A9B0B470--