commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robert burrell donkin <robertburrelldon...@blueyonder.co.uk>
Subject Re: Apache betwixt
Date Mon, 10 Oct 2005 00:18:50 GMT
On Thu, 2005-10-06 at 15:44 -0700, vladimir lenin wrote:
> Hello,

hi vladimir

> I am trying to use Betwixt to parse an XML document
> with elements from more than one namespace. But I am
> running into problems. Does Betwixt support
> namespaces? 

yes

at the moment, there are no strategies so you'll need to create dot
betwixt files. (though the strategies would be easy to do.)

> if so, can someone please provide me a
> simple example that reads an XML with namespaces and
> converts it into a javabean

you just need to add uri attributes to the appropriate parts of the dot
betwixt file.

- robert

public class SimpleBean {
    private String alpha;
    private int beta;
    public String getAlpha() {
        return alpha;
    }
    public void setAlpha(String alpha) {
        this.alpha = alpha;
    }
    public int getBeta() {
        return beta;
    }
    public void setBeta(int beta) {
        this.beta = beta;
    }
    
    
}

<?xml version='1.0' encoding='UTF-8' ?>

<info>
	<element name="simple"
uri='http://jakarta.apache.org/commons/betwixt/example'>
		<element name='alpha'
uri='http://jakarta.apache.org/commons/betwixt/example'
property='alpha' />
		<element name='beta'
uri='http://jakarta.apache.org/commons/betwixt/example'
property='beta' />
	</element>
</info>


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