E N D
Mule ESB: Data Weave XML – Java Conversion
XML – Java Conversion in Dataweave Mule Pre-requisites: • Anypoint Studio • Mule ESB Runtime 3.7 • xml input file. Input XML File
In the transform code I created the Object type in the header “ %type user = :object { class: "testweave.User"} ” And the payload of the transform is converted to User Object using the transform logic as below. { firstName: payload.user.name, lastName: payload.user.lastName } as :user
package testweave; publicclass User { private String firstName; private String lastName; public String getFirstName() { returnfirstName; } publicvoidsetFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { returnlastName; } publicvoidsetLastName(String lastName) { this.lastName = lastName; } @Override public String toString() { // TODO Auto-generated method stub returnthis.firstName+" "+this.lastName; } } User.java