Hi.
I have a XMLFragment mapping, thats only working one way.
My mapping looks something like this;
public XMLDescriptor createMoxySoapMessageDescriptor() {
XMLDescriptor envelope =
this.buildDescriptor(MoxySoapMessage.class);
envelope.setDefaultRootElement("env:Envelope");
envelope.setDefaultRootElementType(new
QName("env:Envelope"));
XMLChoiceObjectMapping body = new
XMLChoiceObjectMapping();
body.setAttributeName("body");
body.addChoiceElement("env:Body", Body.class);
envelope.addMapping(body);
return envelope;
}
public XMLDescriptor createBodyDescriptor() {
XMLDescriptor body = this.buildDescriptor(Body.class);
XMLFragmentMapping node = new XMLFragmentMapping();
node.setAttributeName("node");
node.setSetMethodName("setNode");
node.setGetMethodName("getNode");
node.setXPath(".");
body.addMapping(node);
return body;
}
import org.w3c.dom.Node;
public class Body {
protected Node node;
public Node getNode() {
return this.node;
}
public void setNode(final Node node) {
this.node = node;
}
}
If I go from object to xml, I get the right output:
<?xml version="1.0" encoding="UTF-8"?>
<env:Body>
</bar:foo>
</env:Body>
</env:Envelope>
But when I parse this to objects again, I get Body.node as
null.... :-P
--
/Magnus Heino