Dejame probar mi espanol - tal vez, su ingles es mejor que mi espanol, pero es 
obvio que ese es para una programa espanol...

Una cosa que necesita entender es que jibx emplea un "pull parser".  Uno de los 
"problemas" con los pull parsers es que ellos necesitan saber todos los 
elementos antes que puede hacer algo.  Entonces, su binding necesita declerar 
todos los elementos que pueden aparezca.  Este binding puede procesar su 
ejemplo:

<binding>
  <mapping name="MS01.0.1" class="ContratoLN">
          <value name="HeaderMensagem" field="details" usage="required" />
    <structure name="DadosMensagem" usage="optional" />
    <structure name="TomadorSeguro" usage="optional" />
    <collection name="IdentificacaoPainel" usage="required" field="paineis">
      <value style="element" name="CompanhiaNL" />
    </collection>
    <structure name="CaracterizacaoBasica" usage="optional" />
        <collection name="IdentificacaoSegurados" usage="required" 
field="segurados">
      <value style="element" name="Participante" />
    </collection>
    <collection name="Documentos" usage="optional" field="anexos" />
  </mapping>

  <mapping class="BaseDetails" abstract="true"/>

  <mapping name="HeaderMensagem" class="ContratoDetails" extends="BaseDetails">
    <value name="CodigoMensagem" field="mensagemId_cd" style="attribute"/>
  </mapping>

  <mapping name="Documento" class="Documento">
    <value name="NomeDocumento" field="NomeDocumento" />
    <value name="Ficheiro" field="Ficheiro" />
  </mapping>
</binding>

Yo puse un nueve clase que llame "Documento" por que si no existe, el "pull 
parser" no puede procesar lo (por que necesita saber todos los elementos que 
pueden aparezca).  "Documento" parece como este:

public class Documento
{
        private String NomeDocumento;
        private String Ficheiro;
}

Todavio no procese los "attributes", pero si necesita los, es obvio como poner 
los.  La cosa mejor importante es para entender todos los elementos que pueden 
aparezca en el XML - si su ejemplo es completo, se acabo, pero si el schema 
permita mas elementos, esos necesitan estar en el binding (como "optional", por 
su puesto).

Espero que este puede ayudar - yo se que no hay documentacion de jibx en 
espanol, y jibx es dificil a aprender... a veces, aun los que habla ingles por 
su primera lengua no pueden entender el documentacion.

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Nuno Ferreira
Sent: Wednesday, August 17, 2005 7:35 AM
To: [email protected]
Subject: Re: [jibx-users] Problems to make a mapping of my xml

Hi,

It´s something like this:

public class ContratoLN extends BaseLN {

        private Arraylist paineis;
        private Arraylist segurados;
}

public class BaseLN {
        private BaseDetails details;
        private Arraylist anexos;
}

public class ContratoDetails extends BaseDetails {
        private TomadorSeguroDetails tomadorSeguro;
}


<binding>
       <mapping name="MS01.0.1" class="pt.aps.coseguro.contrato.ContratoLN">
        <structure name="HeaderMensagem" field="details"                        
usage="required"
type="pt.aps.details.comuns.IBaseDetails"/>
                
        <collection name="Documentos" usage="optional"
field="anexos"/>        <collection name="IdentificacaoPainel"
usage="required" field="paineis"/>
        <collection name="IdentificacaoSegurados" usage="required"
field="pessoasSeguras"/>
        </mapping>
        <mapping class="pt.aps.details.comuns.IBaseDetails"
abstract="true"/>
        <mapping name="HeaderMensagem"
class="pt.aps.details.coseguro.gp.contrato.ContratoDetails"                     
        extends="pt.aps.details.comuns.IBaseDetails">
        <value name="CodigoMensagem" field="mensagemId_cd" style="attribute"/>
    </mapping>
</binding>

And when i start i have to instance a ContratoLN, and put inside a
ContratoDetails in details and a TomadorSeguroDetails inside a
ContratoDetails, and of course the collections inside paineis,
segurados e anexos.
But it doesn´t work...


I´m sorry if i wasn´t clear in the late message!!!









On 8/17/05, Mocky Habeeb <[EMAIL PROTECTED]> wrote:
> I'm not sure I understand what the problem is. Can you include a small
> piece of your java source and your binding that is giving you trouble,
> along with any error message?
> 
> Mocky
> 
> 
> 
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Nuno
> Ferreira
> Sent: Wednesday, August 17, 2005 5:26 AM
> To: [email protected]
> Subject: [jibx-users] Problems to make a mapping of my xml
> 
> 
> Hi all,
> 
> I´m try to make a binding to marshall and unmarshall a xml file, but i´m
> not been sucessfull... can anyone help me???
> 
> 
> This is the xml i´m trying to have a binding:
> 
> <MS01.0.1>
>        <HeaderMensagem CodigoMensagem="0000"/>
>        <DadosMensagem TipoInformacao="0000"/>
>        <TomadorSeguro NumeroCliente="123333" TipoCliente="S"/>
>        <IdentificacaoPainel CodigoLider="Stri"
> PercParticipacaoLider="0,0">
>                <CompanhiaNL Referencia="0000" CodigoNaoLider="000" />
>                <CompanhiaNL Referencia="0000" CodigoNaoLider="001" />
>                <CompanhiaNL Referencia="0000" CodigoNaoLider="002" />
>        </IdentificacaoPainel>
>        <CaracterizacaoBasica ApoliceSegurNet="Stringaaaaaaaaaaaa" />
>        <IdentificacaoSegurados NumSegurados="000">
>                <Participante ReferenciaParticipante="000" />
>                <Participante ReferenciaParticipante="000" />
>                <Participante ReferenciaParticipante="000" />
>                <Participante ReferenciaParticipante="000" />
>        </IdentificacaoSegurados>
>        <Documentos>
>                        <Documento>
>                        <NomeDocumento>ola.jpg</NomeDocumento>
>                        <Ficheiro>####</Ficheiro>
>                </Documento>
>                <Documento>
>                        <NomeDocumento>ole.jpg</NomeDocumento>
>                        <Ficheiro>###</Ficheiro>
>                </Documento>
>                <Documento>
>                        <NomeDocumento>oli.jpg</NomeDocumento>
>                        <Ficheiro>##</Ficheiro>
>                </Documento>
>        </Documentos>
> </MS01.0.1>
> 
> 
> And this is the structure that i have to put the data :
> 
>        ContratoLN -> (MS01.0.1)
> 
>        contratoLN.details = (MS01.0.1) - Type (BaseDetails)
>                      instance of object - ContratoDetails extends
> BaseDetails
> 
>        contratoLN.details.tomadorSeguro = (TomadorSeguro) - Type
> (TomadorSeguroDetails)
> 
>        And the collections: (That work fine)
> 
>        contratoLN.paineis = (IdentificacaoPainel) - Type
> (IntervenienteDetails)
>        contratoLN.segurados = (IdentificacaoSegurados ) - Type
> (IdentificacaoSeguradosDetails)
>        contratoLN.anexos= (Documentos) - Type (AnexosDetails)
> 
> 
> in resume the problem is to make a bindind of the object
> contratoLN.details, that have the same binding of contratoLN, probably
> the XML is no well constructed but now are no remedy, i stuck with this.
> I try diferent forms but no one result.
> 
> Can anyone have a example of a binding of this???
> 
> cheers
> 
> 
> -------------------------------------------------------
> SF.Net email is Sponsored by the Better Software Conference & EXPO
> September 19-22, 2005 * San Francisco, CA * Development Lifecycle
> Practices Agile & Plan-Driven Development * Managing Projects & Teams *
> Testing & QA Security * Process Improvement & Measurement *
> http://www.sqe.com/bsce5sf
> _______________________________________________
> jibx-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jibx-users
> 
> 
> 
> 
> -------------------------------------------------------
> SF.Net email is Sponsored by the Better Software Conference & EXPO
> September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
> Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
> Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
> _______________________________________________
> jibx-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jibx-users
>


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to