geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aaron Mulder <>
Subject Re: [XML Parsing]
Date Mon, 01 Sep 2003 15:39:05 GMT
On Mon, 1 Sep 2003, Aaron Mulder wrote:
> On Mon, 1 Sep 2003, James Strachan wrote:
> > If we go the POJO route (as described in the [vote] XML Parsing thread) 
> > then using Betwixt (which uses Digester) is my preferred route. We can 
> > then let Xerces take care of the XSD validation.

	Well, I tried, and I'm defeated by Betwixt.  Does anyone have an
example?  I'm trying to map a tiny EJB JAR DD fragment to beans.  I can
get the version (an attribute) into a bean property, but I can't get the
description (a repeating element) into a child bean property.  I've
included the XML fragment, the two source files, and the two .betwixt
files, but the result of parsing this is that I get an EjbJarTag with the
version set and no descriptions set.

	Also, between Digester and Betwixt, the performance on this sucks.  
Perhaps it's related to the (I kid you not) 1023 lines of log output
resulting from parsing my 33-line XML file.

	Also, the profusion of commons libraries required to get this
running is a little frustrating.

	Can we just use DOM please?


<ejb-jar version="2.1">
    <description lang="en">text</description>
    <description lang="es">text</description>

public class EjbJarTag {
    private String version;
    private List descriptions = new ArrayList();

    public String getVersion() {
        return version;

    public void setVersion(String version) {
        this.version = version;

    public DescriptionTag[] getDescriptions() {
        return (DescriptionTag[])descriptions.toArray(new 

    public void addDescription(DescriptionTag desc) {

    <element name="ejb-jar">
        <attribute name="version" property="version" />
        <element name="description" property="description" />

public class DescriptionTag {
    private String lang;
    private String content;

    public String getContent() {
        return content;

    public void setContent(String content) {
        this.content = content;

    public String getLang() {
        return lang;

    public void setLang(String lang) {
        this.lang = lang;

    <element name="description">
        <text property="content" />
        <attribute name="lang" property="lang" />

View raw message