Why does a simple JAXB 2 RI XJC change collection names?

JAXB's simple binding mode changes the collection names to their plural version, for example. "Additional data" becomes "additional data". Is there any solution to change this behavior? I need the name and name of the Java field to match the name of the XSD field. My bindings file:

<?xml version="1.0" encoding="UTF-8"?> <bindings xmlns="http://java.sun.com/xml/ns/jaxb" xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance" xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc" xsi:schemaLocation=" http://java.sun.com/xml/ns/jaxb http://java.sun.com/xml/ns/jaxb/bindingschema_2_0.xsd" version="2.1"> <globalBindings> <serializable uid="1" /> <xjc:simple/> </globalBindings> </bindings> 
+8
java java-metro-framework jaxb jaxb2
source share
1 answer

"Easy Binding Mode" is an advanced feature of JAXB RI (Metro). Creating a collection name for the plural properties was part of its design.

From: http://weblogs.java.net/blog/kohsuke/archive/2007/01/using_jaxb_ris.html

My favorite feature in JAXB RI is a simpler and better binding mode, which makes the generated code even easier to use, ...

  • Eliminate JAXBElement as much as possible
  • Giving you a better, more typed binding in general
  • Use plural property names where applicable

You can use the usual schema settings to control the property name. Refer to one of my previous answers (link below):

  • How do you configure how JAXB generates multiple method names?
+5
source share

All Articles