Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "EclipseLink/DesignDocs/293925/MOXyExtensions/XMLDirectMapping"
< EclipseLink | DesignDocs | 293925 | MOXyExtensions
(→XML Metadata) |
|||
Line 8: | Line 8: | ||
The following example will demonstrate how to configure an XMLDirectMapping via xml-element: | The following example will demonstrate how to configure an XMLDirectMapping via xml-element: | ||
− | === | + | === Java Code === |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
<source lang="java"> | <source lang="java"> | ||
Line 37: | Line 16: | ||
</source> | </source> | ||
− | === | + | === XML Metadata === |
<?xml version="1.0" encoding="US-ASCII"?> | <?xml version="1.0" encoding="US-ASCII"?> |
Revision as of 11:21, 2 February 2010
XMLDirectMapping
Provide support for XML direct mappings via xml-element and xml-attribute.
Example: Configure an XMLDirectMapping via xml-element
The following example will demonstrate how to configure an XMLDirectMapping via xml-element:
Java Code
XMLDirectMapping idMapping = new XMLDirectMapping(); idMapping.setAttributeName("id"); idMapping.setXPath("id/text()");
XML Metadata
<?xml version="1.0" encoding="US-ASCII"?> <xml-bindings xmlns="http://www.eclipse.org/eclipselink/xsds/persistence/oxm">
<java-types> <java-type name="org.example.Employee"> <java-attributes> <xml-element java-attribute="id" xml-path="id/text"/> </java-attributes> </java-type> </java-types>
</xml-bindings>