Issue Details (XML | Word | Printable)

Key: XMLBEANS-188
Type: Bug Bug
Status: Closed Closed
Resolution: Won't Fix
Priority: Major Major
Assignee: Unassigned
Reporter: Shaik Reyaz
Votes: 1
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
XMLBeans

wrong java classes created for element "AccumProfitsDividends2ndTier"

Created: 12/Aug/05 11:38 PM   Updated: 25/Oct/09 03:13 AM
Return to search
Component/s: Compiler
Affects Version/s: Version 2 Beta 1
Fix Version/s: None

Time Tracking:
Not Specified

Environment: Windows XP, Jdk 1.5_04

Resolution Date: 25/Oct/09 03:13 AM


 Description  « Hide
i have the following element in my xsd ....

- <xsd:element name="AccumProfitsDividends2ndTier" type="AccumProfitsDividends2ndTierType" minOccurs="0" maxOccurs="unbounded">
- <xsd:annotation>
- <xsd:documentation>
  <Description>Accumulated Profits table</Description>
  </xsd:documentation>
  </xsd:annotation>
  </xsd:element>

When i looked at the produced Java class here is the snipped what it looked like, comments have been properly given but the method name has a capital alphabet after a number....
    /**
     * Appends and returns a new empty value (as xml) as the last "AccumProfitsDividends2ndTier" element
     */
    gov.irs.efile.AccumProfitsDividends2NdTierType addNewAccumProfitsDividends2NdTier();


Similarly for 3rd it has generated with 3Rd... here is the snippet....
    /**
     * Gets ith "UndistrEarnDividends3rdTier" element
     */
    gov.irs.efile.UndistrEarnDividends3RdTierType getUndistrEarnDividends3RdTierArray(int i);
    
    /**
     * Returns number of "UndistrEarnDividends3rdTier" element
     */
    int sizeOfUndistrEarnDividends3RdTierArray();
    
    /**
     * Sets array of all "UndistrEarnDividends3rdTier" element
     */
    void setUndistrEarnDividends3RdTierArray(gov.irs.efile.UndistrEarnDividends3RdTierType[] undistrEarnDividends3RdTierArray);
    
    /**
     * Sets ith "UndistrEarnDividends3rdTier" element
     */
    void setUndistrEarnDividends3RdTierArray(int i, gov.irs.efile.UndistrEarnDividends3RdTierType undistrEarnDividends3RdTier);



 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Peer Törngren added a comment - 15/Sep/06 09:16 PM
I have a similar problem. My registered domain name is p2r.se, and hence, all my Java classes and XSD namespaces end with p2r.se. But compiler generates package name p2R.se. It appears that this somehow conflicts with the Windows file system case handling and my manually written classes; they all end up in the same directory, but cannot be loaded from the built jar; I get
java.lang.NoClassDefFoundError: se/p2R/playlister/plug/monitor/GenreAnalyst (wrong name: se/p2r/playlister/plug/monitor/GenreAnalyst)

I cannot simply rename the package; this is my registered domain name.

Peer Törngren added a comment - 15/Sep/06 09:25 PM
PS: I am running XML Beans 2.2.0.

Shaik Reyaz added a comment - 18/Sep/06 01:33 PM
Peer i have written private method to handle this situation.. this method returns the way XMLBeans is returning values... Here is the code.. hope this helps you out....

private static String postNumberBugFix(String s) {
char[] c = s.toCharArray();
for (int i = 0; i < c.length - 1; i++) {
if (Character.isDigit(c[i]) && Character.isLetter(c[i + 1])) {
c[i + 1] = Character.toUpperCase(c[i + 1]);
}
}
return new String(c);
                       }

Radu Preotiuc-Pietro added a comment - 16/Oct/06 10:33 PM
Maybe I am not understanding the issue, is it not possible to use a .xsdconfig to override the package name with something you're comfortable with?

Peer Törngren added a comment - 14/Nov/06 09:01 PM
Have not studied what you can or cannot do with .xsdconfig, but I suspect I would have configure every package, thus creating a maintenance nightmare. And it wouldn't solve the issue with class names? Either way, you should not need to do that - names with embedded numerics are (for some reason) simply not generated correctly.

Wing Yew Poon added a comment - 25/Oct/09 03:13 AM
The behavior is by design. The name-mangling is according to the algorithm XMLBeans uses, it is followed by JAXB, I believe.
The user can work around the name-mangling by using xsdconfig if he doesn't accept the name-mangling.