Problem solved.  I used digester.addCallMethod(...);

-----Original Message-----
From: Jim Henderson [mailto:[EMAIL PROTECTED]
Sent: Monday, September 20, 2004 10:59 AM
To: [EMAIL PROTECTED]
Subject: Digester type conversion




I am trying to process an XML document that defines a date as:

    “<CreationDate>1999/03/23</CreationDate>”

The Java object I am trying to populate defines the attribute as:

    private Date docCreationDate = null;

    public void setDocCreationDate(String docCreationDate)
        throws SAXException
    {
        this.docCreationDate = (docCreationDate == null)
                             ? null
                             : stringToDate(docCreationDate);
    }


The digester rule I am using is:
    digester.addBeanPropertySetter("*/Document/CreationDate",
"docCreationDate");


If I change (type Date changed to String):
    "private Date docCreationDate = null;"
to:
    "private String docCreationDate = null;"
then the setter is called.


How do I force the setter to be called when the Java object docCreationDate
is defined as a Date object rather than a String?

Thanks,
Jim



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to