Hello,

I am using CXF HTTP RESTful invocations, and I have been successfully using the default serialization in CXF to convert XML such as the following:

<MyObject>
   <myVar1>value 1</myVar1>
   <myVar2>value 2</myVar2>
</MyObject>

to a Java object such as:

public class MyObject {

   private String myVar1;
   private String myVar2;

   // <setters and getters for myVar1 and myVar2
   ...
}

What I would like to do, is change the serialization so that attributes map to Java properties, so that using the same Java object above, the following XML would properly map using CXF:

<MyObject myVar1="value 1" myVar2="value 2" />

Can someone enlighten me as to how this is done? That is step 1. The second step is to map other object types to properties, as in:

<MyObject>
   <myChildObject>
       <myVar1>value 1</myVar1>
       <myVar2>value 2</myVar2>
   </myChildObject>
</MyObject>


mapping to these Java classes:


public class MyObject {

   private MyChildObject myChildObject;

   // <setter and getter for myChildObject
   ...
}

public class MyChildObject {

   private String myVar1;
   private String myVar2;

   // <setters and getters for myVar1 and myVar2
   ...
}

Any help would be greatly appreciated!

Thanks,

Brad

Reply via email to