org.eclipse.persistence.oxm.annotations
Annotation Type XmlPath
@Target(value={FIELD,METHOD})
@Retention(value=RUNTIME)
public @interface XmlPath
This annotation allows a user to specify an xpath instead of an element name. It
can be used in conjunction with JAXB Annotations to provide a higher level of
customisation to the mappings.
The following types of paths are supported:
- personal-info/first-name/text() - Direct Mapping
- ns:personal-info/ns:first-name/text() - Direct Mapping with Namespace
- street[2]/text() - Direct Mapping positional XPath
- @id - Direct Mapping to Attribute
- contact-info/address - Composite Mapping
- contact-info/address[2] - Composite Mapping positional XPath
- . - Self Composite Object Mapping
Example:
@XmlRootElement(name="customer")
public class Customer {
...
@XmlPath("personal-info/first-name/text()")
@XmlElement
public String firstName
@XmlPath("contact-info/address[1]")
public Address homeAddress;
@XmlPath("contact-info/address[2]")
public Address workAddress;
...
}
Required Element Summary |
java.lang.String |
value
|
value
public abstract java.lang.String value