|Re: [eclipselink-users] Moxy mapping|
There are a couple of options:
1. Create an XMLDirectMapping from an attribute on your object to the XPath "gml:Surface/@gml:id"
If the data corresponds to a property on your object then you can just create a mapping for it. With the XPath above it will put the attribute on the same "gml:Surface" element created by your other mapping.
2. Create an XMLTransformationMapping
If the data does not exist in your object and you want to create it with code you could use a transformation mapping.
XMLTransformationMapping idMapping = new XMLTransformationMapping();
// AttributeTransformers are used to build to build the property value for the domain object.
// FieldTransformers are used to build the XML document.
idMapping.addFieldTransformer("gml:Surface/@gml:id", new IdFieldTransformer());
IdAttributeTransformer is required to implement org.eclipse.persistence.mappings.transformers.AttributeTransformer and IdFieldTransformer is required to implement org.eclipse.persistence.mappings.transformers.FieldTransformer.
Magnus Heino wrote:
Back to the top