Mapping between Representations:
Assume we have a classCustomer defined as follows:
Mapping XML to Java:
We can map the following XML objectCustomer in the following way:
Mapping Java to XML:
We can map thecustomer back to XML as follows:
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Customer defined as follows:
@XmlRootElement(name="customer", namespace="http://camunda.org/test")
public class Customer {
private String name;
@XmlElement(namespace="http://camunda.org/test")
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<customer xmlns="http://camunda.org/example">
<name>Kermit</name>
</customer>
Customer in the following way:
import static org.camunda.spin.Spin.XML;
String xmlInput = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><customer xmlns=\"http://camunda.org/example\"><name>Kermit</name></customer>";
Customer customer = XML(xmlInput).mapTo(Customer.class);
customer back to XML as follows:
import static org.camunda.spin.Spin.XML;
String xml = XML(customer).toString();