commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Kitching <>
Subject Re: Problem with Digester
Date Fri, 08 Apr 2005 09:22:57 GMT
Hi Veerendra,

Veerendra wrote:
> Hi,
> 	I want to use digester frame work. I took some example from net modified
> for my testing, but when I am not getting the result as null. if I use
> uniqueid instead of UniqueID in xml it is working. is that case sensitive.
> Can some body pls help me.
> Here is my programs.
> Test.xml :
> <?xml version="1.0" encoding="UTF-8"?>
> <gp:academy UniqueID="JAcademy"
> xmlns:gp="">
> </gp:academy>

The standard coding convention is for java bean property names to start 
with a *lower-case* letter.

property: "someProperty"
setter method name: "setSomeProperty"
getter method name: "getSomeProperty".

This is defined in detail in the java beans specification.

Digester expects the Java Beans specification to be followed. So when 
the input xml has an attribute "someProperty", the SetPropertiesRule 
will try to set a java bean property of name "someProperty" by calling a 
method of name "setSomeProperty".

The SetPropertiesRule constructor can take two arrays of strings to set 
up non-standard mappings from xml attribute name to java bean property 
name if you need this. There are a number of capitalisation conventions 
used in XML so it´s fairly common to need this (but Java code should 
always use the standard Java capitalisation conventions).

By the way, I am surprised that you say that using "uniqueid" in your 
input xml works; I believe this should cause a call to "setUniqueid" 
which doesn´t exist. Using "uniqueID" in your input xml should be the 
correct value (maps to a setter method "setUniqueID", whihc is what is 
defined on your class).



To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message