Hi Daniel, Daniel Gomes-THINK IT wrote:
> Sorry ! > > How do I convert this xml into objects and that the file has > several subitems as row > In the example I got a Resultado after row with elements also have > Automoveis_Completo and their contents in row and so on > > <?xml version="1.0" encoding="utf-8"?> > <root> > <Resultado xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> > <row> > <CPF>12345678901</CPF> > <ID_Base>33585420</ID_Base> > <Nasc>1985-06-28</Nasc> > <Idade>26</Idade> > <Signo>CANCER</Signo> > <Escolaridade>MEDIO COMPLETO</Escolaridade> > <Nome>RAPHAEL DE ANDRADE DA SILVA</Nome> > <Sexo>MASCULINO</Sexo> > <StatusReceita>REGULAR</StatusReceita> > <DT_Consulta>2011-03-09</DT_Consulta> > <HR_Consulta>00:31:41</HR_Consulta> > <Automoveis_Completo > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <row> > <Ano_x0020_Fabricacao xsi:nil="true"/> > <Modelo xsi:nil="true"/> > <Renavam xsi:nil="true"/> > </row> > </Automoveis_Completo> > <Parentes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> > <row> > <CPF>12345678901</CPF> > <Nasc>1982-11-17</Nasc> If you have to match an existing XML, it is always the best to try it the other way round: Generate a model and tweak the XStream settings unless it writes the XML in the structure you're expecting to read. In your special case I'd use a trick for your lists: ======= %< ======= class Results extends AbstractList<Result> { private List<Result> rows = new ArrayList<Result>(); public Result get(int i) { return rows.get(i); } public int size() { return rows.size(); } } xstream.implicitCollection(Results.class, "rows", "row", Result.class); ======= %< ======= Hope this helps, Jörg --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email