commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Agustin Barto" <>
Subject Simple Digester ruleset for a list of String
Date Sun, 03 Sep 2006 15:43:30 GMT
I need to parse an XML like this:


which should render a List<String> (or at least Collection<String>).
Right now what I do is this:

	protected static List<String> parseMessageList(String uri) throws
IOException, SAXException {
		Digester digester = new Digester();
		digester.addObjectCreate("message-list", ArrayList.class );
		digester.addCallMethod("message-list/message", "add", 1, new Class[]
{ String.class });
		digester.addCallParam("message-list/message", 0);
		return (List<String>) digester.parse(uri);

...and I was wondering if it's the right way to do it, and if not, if
there is a better way.


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

View raw message