commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kim Scott <>
Subject Digester Newbie Question
Date Thu, 06 Feb 2003 22:02:23 GMT

I am having a problem using digester 1.3 to parse element text.
Digester always returns the empty string for the element  text.  No
exceptions are thrown and the logging doesn't show any error messages.
Attributes work fine for me.  I tried digester 1.2 and then both work.
Does anyone have any suggestions on what could be going wrong when I try
1.3?  I'd like to use 1.3 so I can use a schema for validation.  The
code follows.

Thanks very much,

Here is the code.  I changed it to no longer set the schema when I
switched to 1.2.

    private static EmailContent parseEmailContent(String emailXmlString)
throws Exception
      // Create reader for email xml string
      StringReader reader = new StringReader(emailXmlString);

      // Create digester
      Digester digester = new Digester();

      // Setup Parse Rules
      digester.addObjectCreate("Email", EmailContent.class);
      digester.addCallMethod("Email/Subject", "setSubject", 0);
      digester.addCallMethod("Email/Body", "setBodyText", 0);

      // Parse the configuration file
      EmailContent emailContent = (EmailContent)digester.parse(reader);


    } // parseEmailContent

Here's a sample of the xml:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE Email SYSTEM "config/email.dtd">
<Email xmlns:xsi=''
Critical Alert
Oracle Financial System is impacting Order Flow.

View raw message