You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by vladimir lenin <ch...@yahoo.com> on 2005/10/07 00:44:22 UTC

Apache betwixt

Hello,
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? if so, can someone please provide me a
simple example that reads an XML with namespaces and
converts it into a javabean
thank you


		
__________________________________ 
Yahoo! Mail - PC Magazine Editors' Choice 2005 
http://mail.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: Apache betwixt

Posted by vladimir lenin <ch...@yahoo.com>.
Robert,thanks for the reply.
After I sent the email, I did some further
experimenting and set the
setNamespaceAware(true/false) method of the beanReader
to true. I was able to read fine without the need for
a .betwixt file

--- robert burrell donkin
<ro...@blueyonder.co.uk> wrote:

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



	
		
__________________________________ 
Yahoo! Mail - PC Magazine Editors' Choice 2005 
http://mail.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: Apache betwixt

Posted by robert burrell donkin <ro...@blueyonder.co.uk>.
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