javaxsdapache-poixmlbeans

xmlbeans auto-capitalize the class name in generated sources and xsb files


I'm using xmlbeans to generate jar file for our schema, however I have noticed an issue with one of the method defined in our .xsd file. The method name in the .xsd file is "UserGetRequest21sp1V2" (lower case "s" for sp1). This method name is getting transformed to "UserGetRequest21Sp1V2" (upper case "S" for sp1) in the generated class and xsb files. I tried to modify the source and xsb file to replace upper case "S" with the lower case but as soon as you change the index.xsb file the magic cookie changes as well and file becomes invalid.

$ dumpxsb ./schemaorg_apache_xmlbeans/system/s1DB123878BBA9EF9AE780681B98C7DCC/index.xsb
/Softwares/xmlbeans-3.1.0/bin
./schemaorg_apache_xmlbeans/system/s1DB123878BBA9EF9AE780681B98C7DCC/index.xsb
  Magic cookie: efbfbd7a
  Wrong magic cookie.

The generated jar from this invalid file returns an exception in our main application.

Our backend system is case sensitive and it returns Authorization error for request with upper case "S". I read in the xmlbeans documentation that it follows java convention i.e CamelCase to generate the class names.

Is there a way to keep the class names same in the generated java classes and xsb files as defined in the schema xsd files?


Solution

  • After looking into the xmlbeans documentation I figured it out that java classnames can be override using qname tag in the config.xsdconfig file. The details are mentioned here:

    https://cwiki.apache.org/confluence/display/XMLBEANS/XmlBeansFaq#XmlBeansFaq-configPackageName

    Another relevant doc from Oracle that helped me out:

    https://docs.oracle.com/cd/E13226_01/workshop/docs81/doc/en/workshop/guide/howdoi/howGuideXMLBeansTypeNaming.html?skipReload=true