commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Veerendra" <veeren...@cassis-intl.com>
Subject Problem with Digester
Date Fri, 08 Apr 2005 06:34:22 GMT
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.

Thank You,
Veerenrda

Here is my programs.

Test.xml :

<?xml version="1.0" encoding="UTF-8"?>
<gp:academy UniqueID="JAcademy"
xmlns:gp="http://namespaces.globalplatform.org/systems-profiles/1.1.0">
</gp:academy>


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 java.io.File;
import org.apache.commons.digester.Digester;

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

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

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

        //Set the attribute values as properties
        digester.addSetProperties("academy");

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


---------------------------------------------------------------------
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