On Jul 31, 2006, at 6:16, chiaro scuro wrote:

> Does anybody know of a library that allows to go through an xml tree 
> as if
> it were made of normal objects?

Your sample code looks a lot like RubyfulSoup. Although originally 
intended for traversing HTML documents, it has an option for 
non-specific XML as well.

> * people.each_person {...}
> * people.person[2].name
> * people.person.name              #takes the first person
> * people.person.size

RubyfulSoup would (I believe) look something like:

	people.find_all['person'].each	
	people.person.name
	people.person.size

if the XML were like

	<people>
		<person>
			<name>Fred</name>
			<size>150 kg</size>
		</person>
		<person>
			<name>Sally</name>
		.
		.
		.
		</person>
	</people>

If instead your XML is like

	<people>
		<person name="Fred" size="150 kg"/>
		<person name="Sally" size="88 kg"/>
		.
		.
		.
	</people>

Then you'd be looking at

	
	people.find_all['person'].each	
	people.person['name']
	people.person['size']

I don't remember what it does with XML tags with squiggles and dots.