From: Christian Neukirchen Date: 2006-02-22T00:40:57+09:00 Subject: Re: How can I search value from xml "William James" writes: > Artit Satanakulpanich wrote: >> How can i search value from xml file such as I want to find from *pubdate *and >> return* **biblioentry >> *Please give me some source code for further study* >> ** >> >> > "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> >> >> >> >> Godfrey >> Vesey >> >> Personal Identity: A Philosophical Analysis >> >> Cornell University Press >> >> 1977 >> > > class String > def xtag(s) > end > def xshow( depth=0 ) > end > > gets(nil).xtag("biblioentry").each { |attr,data| > if data.xtag("pubdate")[0][1] > "1997" > puts attr["id"] > data.xshow( 1 ) > end > } Still doesn't support namespaces, entities and CDATA... ;-) (Or nested tags like
.) -- Christian Neukirchen http://chneukirchen.org