Jackson XML Annotations: String element with attribute

You should use JacksonXmlText annotation for value field.

public class Element2 
{
    @JacksonXmlProperty(isAttribute = true)
    private String ns = "yyy";
    @JacksonXmlText
    private String value;

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }
}  

then XML will looks like

<Root>
    <Element1 ns="xxx">
        <Element2 ns="yyy">A String</Element2>
    </Element1>
</Root>

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)