Werner Guttmann wrote:
> 
> You are using one of the static unmarshal methods, which will ignore any
>  mapping defined by you. Can you please switch to a non-static one, and
> see whether it works ?
> 

Hi, thank you very much for your reply. using non-static methods I am able
to retreive
the Wrapper object (ccsmp-create) ...but I get an empty DialPlan....

<?xml version="1.0" encoding="UTF-8"?>
<ccsmp-create session="8u8989h789h9h8989"> <----This one I can find it
<DialPlan ent-id="name" name="333"/>             <---- The hidden object is
not  found !
</ccsmp-create>


This is how I coded it:

public class BaseCommand {
   String sessionId;

public String getSessionId() {
        return sessionId;
}

public void setSessionId(String sessionId) {
        this.sessionId = sessionId;
}

public List  dialplans = new ArrayList();

public void addDialplan(DialPlan dialplan) {
        dialplans.add(dialplan);
}

public List getDialplans() {
  return dialplans;
}

-------------------------------------------------

public class DialPlan {
  String entId;
  String name;
  // getter and setters here
}

---------------------------------------------->mapping.xml

<mapping>

<class name="BaseCommand">
  <map-to xml="ccsmp-create" />
    
  <field name="sessionId" type="java.lang.String">
     <bind-xml name="session" node="attribute"  />
  </field>
  
  <field name="dialplans" type="DialPlan" collection="collection" />
</class>

  
    <class name="DialPlan">
              
    <field name="entId" type="java.lang.String">
        <bind-xml name="ent-id" node="attribute"  />
    </field>
        <field name="name" type="java.lang.String">
        <bind-xml name="name" node="attribute"  />
    </field>
  </class> 
  
</mapping>


---------------------------------------------------------->data.xml
<?xml version="1.0" encoding="UTF-8"?>
<ccsmp-create session="8u8989h789h9h8989">
<DialPlan ent-id="name" name="333"/>
</ccsmp-create>
------------------------------------------------------------->Client Java
and I unmarshal it this way:

Mapping mapping = new Mapping();
mapping.loadMapping("mapping.xml");

Unmarshaller un = new Unmarshaller(BaseCommand.class);
un.setMapping( mapping );

FileReader in = new FileReader("data.xml");
BaseCommand plan = (BaseCommand) un.unmarshal(in);
in.close();

System.out.println(plan.getSessionId());  // This data is found
List list = plan.getDialplans();                // No data found !

--------------------------
Please help, I'm fighting with this since this morning :-(
thanks a lot
francesco
-- 
View this message in context: 
http://www.nabble.com/Unmarshalling-of-nested-XML-tp19914206p19916098.html
Sent from the Castor - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to