From: Eric Armstrong Date: 2006-06-15T05:05:55+09:00 Subject: Re: Processing mixed content with REXML ?? Robert Klemme wrote: > > If I'm not mistaken each_element works recursively > - so you get all children. > You're thinking of each_recursive, which does that. But both methods return elements /only/, not text nodes. To get the text, you use Element.text--which only returns the /first/ text element, or Element.texts, which returns all of them, but without any way I can see to seqeunce them with elements that are mixed in (XML mixed content model) Example -------

A bold word

Structure --------- elem:

text: "A " elem: text: "bold" text: " word" From

: * text() gives you "A " * each_element gives you (b.text => "bold" * texts() gives you ["A ", " word"] But there is no way I can to see to determine whethe the element comes before or after " word" in the node sequence. Surely Element has a getChildren or getNodes method? I don't see an inclusion or inheritance in the API docs that show me one, but perhaps I missed it. On the other hand, it could be that this capability is simply missing from REXML, and I should be using a different package.