I have a xml from third part.
<cts:element-value-query weight="0">
<cts:element xmlns:_1="entitlement:AAA">_1:Entitlement</cts:element>
<cts:text xml:lang="en">TEST</cts:text>
</cts:element-value-query>
Or :
<cts:element-value-query weight="0">
<cts:element xmlns:_1="entitlement:BBB">_1:Entitlement</cts:element>
<cts:text xml:lang="en">CASE</cts:text>
</cts:element-value-query>
I want to unmarshall the xml to Java bean:
@XmlRootElement(name = "element-value-query", namespace= "http://marklogic.com/cts")
@XmlAccessorType(XmlAccessType.FIELD)
public class Query4ElementValue {
@XmlElement(name= "element", namespace="entitlement:AAA")
private String element;
private String text;
}
I can get the correct text value, but for the element, always null.
[element=null, text=TEST]
How can I do then ?
This:
Is an element with the name
elementin thectsnamespace.Your mapping:
Expects an element with the name
elementin the namespace with the URIentitlement:AAA. Which is probably not thectsnamespace you're providing.If you're interested in getting
_1:Entitlementwith_1bound toentitlement:AAAorentitlement:BBB, change the type of the element toQName.