commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gogineni, Pratima" <>
Subject RE: Problem with Digester
Date Fri, 08 Apr 2005 06:39:20 GMT
Hi Veerendra,

Yes it is case sensitive. when you call addSetProperties. It is trying to
map the attributes of the "academy" element to the properties of the object
on top of the stack (instance of Academy). 

So the name of the attributes of the academy tag should be = property name
on the Academy object instance.

Since you have get/setUniqueId - based on java bean specification the
property name is uniqueID (YES case is important). which means your
attribute name on the academy element should be uniqueID.


-----Original Message-----
From: Veerendra []
Sent: Thursday, April 07, 2005 11:34 PM
Subject: Problem with Digester

	I want to use digester frame work. I took some example from net
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.

Thank You,

Here is my programs.

Test.xml :

<?xml version="1.0" encoding="UTF-8"?>
<gp:academy UniqueID="JAcademy"

package com.tesdig;
import java.util.Vector;

public class Academy {
    private String UniqueID;

    public Academy() {

    public String getUniqueID() {
        return UniqueID;

    public void setUniqueID(String newUniqueID) {
        UniqueID = newUniqueID;

    public String toString() {
        StringBuffer buf = new StringBuffer(60);

        buf.append("Academy UniqueID>> " + this.getUniqueID());

        return buf.toString();

package com.tesdig;

import org.apache.commons.digester.Digester;

public class DigestJavaAcademy {
    public static void main(String[] args) throws Exception {
        DigestJavaAcademy d = new DigestJavaAcademy();

    public void digest() throws Exception {
        Digester digester = new Digester();

        digester.addObjectCreate("academy", Academy.class);

        //Set the attribute values as properties

        //Parse the XML file to get an Academy instance
        File input = new File( "academy.xml" );
        Academy a = (Academy) digester.parse(input);

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

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

View raw message