Hi all, please can someone help , I am almost at the point of losing it !
:-)


I am writing a drb application that will recieve an XML 'envelope' that
identifies a request, the object type to instantiate and the criteria to
apply to the objects constructor. I am having trouble trying to traverse and
extract the xml data elements

Please could someone help

Here is the request xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<request type="chart" value="PSK">
<criteria>
<market>1</market>
<benchmark>2</benchmark>
<manager>1,2,3,4,5</manager>
<from>31/12/2001</from>
<to>31/12/2002</to>
</criteria>
</request>

the above is assigned to the xmlSent variable
the criteria is where I cannot get it to work

what I want to do is get all the elements for <criteria> and add them into
the hash
for example:

object['criteria']['market'] = '1'
object['criteria']['benchmark'] = '1'
object['criteria']['manager'] = '1,2,3,4,5'

the elements within <criteria> are dynamic so I dont want to hardcode it

rq = (Document.new xmlSent).root
				
		#at this point in time we handle a single xml request
		#if the entity has 1 'record' then process
		if rq.elements.size == 1 then     
			
			object['type'] =
rq.elements["//request"].attributes['type']
			object['value'] =
rq.elements["//request"].attributes['value']
			object['criteria'] = []
			
	
rq.elements.each_element_with_text("//request[1]/criteria") { |element|
#### from here on I have tried everything, the problem is how to loop
criteria and add to hash including the elements tag name ie <market> =
object['criteria']['market']

Any help would be great !!!

Graeme Matthew
Analyst Programmer
Mercer Investment Consulting
Level 29, 101 Collins Street, Melbourne, VIC, 3001, Australia
Tel  - 61 3 9245 5352 Fax - 61 3 9245 5330
visit http://www.merceric.com

__


**********************************************
This e-mail and any attachments may be confidential or legally privileged.
If you received this message in error or are not the intended recipient, you
should destroy the e-mail message and any attachments or copies, and you are
prohibited from retaining, distributing, disclosing or using any information
contained herein.  Please inform us of the erroneous delivery by return
e-mail. 

Thank you for your cooperation.
**********************************************

ec03/04