From: Sean Chittenden Date: 2002-07-10T07:03:44+09:00 Subject: Re: [ANNOUNCE] ruby-libxml (2002-07-09)... > Sean Chittenden wrote: > > [libxml] > > great > > > >DocBook > > > what's to be implemented for DocBook? Honestly, I'm not 100% sure yet. libxml's huge and there's lots there. I'm still uncovering features and nifty ways of doing things. My best guess is that it's basically a Schema/DTD for the DocBook markup (ie, won't let you write a bad/invalid docbook document). > >xd = XML::Document.file('some_xml_file.xml') > >xd.xpath_find('/my/xpath/query').each do |node| > > puts "Filename: #{node.child('filename')}" > > puts "Mode: #{node.child('mode')}" > > puts "Content: #{node.child('content')}" > >end > > > what do the puts put? In this case, the contents of the node's child. With the XML below (and the amended example: sorry, was doing a little too much copy/pasting from the rubynet test examples), it would produce: Filename: uga Mode: ble Content: sweet # Amended example xd = XML::Document.file('some_xml_file.xml') xd.xpath_find('/my/xpath/query').each do |node| puts "Filename: #{node.child('foo')}" puts "Mode: #{node.child('bar')}" puts "Content: #{node.child('baz')}" end # XML snippet uga ble sweet node.to_s == node.child.content -sc -- Sean Chittenden