You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Leonardo Barbosa <ls...@gmail.com> on 2006/10/18 23:21:02 UTC

Implicit Collection using Betwixt

Hello,

I'm new to Betwixt, and I'm trying to transform this XML:

<Response version="0.2.928" xmlns="">
  <IsError>0</IsError>
  <Content>
    <Id>8107</Id>
    <Title>Ilusionismo - Cris Angel</Title>
    <Description>Show de magica....</Description>
   </Content>
  <Content>
    <Id>8108</Id>
    <Title>Titulo</Title>
    <Description>Bla bla bla</Description>
   </Content>

   ...

</Response>

into these Beans:

public class Response {

	private int IsError = -1;
	private List<Content> Contents = new ArrayList<Content>();

        public Response() {}

	public int getIsError() {
		return IsError;
	}
	public void setIsError(int isError) {
		IsError = isError;
	}
	public List<Content> getContents() {
		return Contents;
	}
	public void addContent(Content content) {
		Contents.add(content);
  }
}


But, as far as I understood, it's only possible if the "Content" tags
have a "container" tag, like "contents". Is that true?
I cannot recreate the XML, with the container tag, because its created
by another system.
I populated the "isError" propertie with no problem.

I found that Xstream has an "addImplicitCollection" method, that alows
exactly this. Does Betwixt has something like this? I'm looking
through the documentation and mail archive for 2 days now and couldn't
find how to do that. :-(

Any help is welcome.

Thanks a lot,
Leonardo Barbosa
lsbarbosa@gmail.com

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