Top Description Methods
org.eclipse.persistence.oxm.annotations

public @Interface XmlCDATA

extends Annotation
Annotations
@Target:FIELD, METHOD
@Retention:RUNTIME
Imports
java.lang.annotation.ElementType, .Retention, .RetentionPolicy, .Target

Wrap the value inside a CDATA section. Normally JAXB will escape certain characters in a string during a marshal operation:

This means a property foo with string value "1 < 2" without @XmlCDATA will be marshalled as <foo>1 < 2</foo>. When @XmlCDATA is used the content is marshalled as <foo><![CDATA[1 < 2]]></foo>.

Example

import jakarta.xml.bind.annotation.XmlRootElement;
import org.eclipse.persistence.oxm.annotations.XmlCDATA;

@XmlRootElement()
public class Root {
    private String foo;

    @XmlCDATA
    public String getFoo() {
        return foo;
    }

    public void setFoo(String foo) {
        this.foo = foo;
    }
}

Method Summary

Inherited from java.lang.annotation.Annotation:
annotationTypeequalshashCodetoString