commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Manoj Chakkalakkal" <Manoj.Chakkalak...@semagix.com>
Subject RE: Digester beginner question
Date Mon, 25 Apr 2005 21:44:18 GMT
I tried using the XPath notation as shown, but that does not work.

Digester digester = new Digester();
digester.addObjectCreate("class", Student.class);
digester.addBeanPropertySetter("class/student/attribute[@name='id']",
"id");
digester.addBeanPropertySetter("class/student/attribute[@name='name']",
"name");

But that does not seem to work.


-----Original Message-----
From: Manoj Chakkalakkal 
Sent: Monday, April 25, 2005 5:41 PM
To: Jakarta Commons Users List
Subject: Digester beginner question

I have the following XML.
<class>
 	<student>
  		<attribute name="id">10</attribute>
		<attribute name="name">Mark</attribute>
	</student>
	<student>
  		<attribute name="id">11</attribute>
		<attribute name="name">Mary</attribute>
	</student>

</class>

public class Student{
	String id;
	String name;
}

How do I write use Commons Digester to set the properties id and name of
the class Student?

I cannot change the structure of XML.

Thank you
-Manoj


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message