castor
  1. castor
  2. CASTOR-1493

Elements of named complexType which are unbounded choice have incorrect classname generated which does not match complexType

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: 1.0.2
    • Fix Version/s: 1.0.3
    • Component/s: XML code generator
    • Labels:
      None
    • Environment:
      Java 5, NoArch
    • Number of attachments :
      7

      Description

      The Castor SourceGenerator is generating invalid class names (the name of the element instead of the complexType) for named complexType elements having an unbounded choice content model. This results in a compile time error, since the complexType class cannot be resolved.

      The source code is generated using defaultBindingType="type". This behavior appears in some generated files and not in others. If the unbounded choice is made as a singleton (i.e. maxOccurs="1"), then the problem seems to go away.

      An example which illustrates this problem is attached. In this example TopographyType is referenced by both MnmType.java and TeaType.java as a member _foo. In MnmType the member is defined as class TopographyType and in TeaType it is defined as class Foo, which is unexpected and results in a compilation error.

      1. c10_jdk15_issue.tgz
        6 kB
        Simeon de Dios
      2. c10.xml
        0.3 kB
        Simeon de Dios
      3. patch.c1493.20060808.1.txt
        0.5 kB
        Simeon de Dios
      4. patch.c1493.20060808.txt
        19 kB
        Werner Guttmann
      5. patch.c1493.20060820.txt
        5 kB
        Werner Guttmann
      6. patch.c1493.20060822.txt
        6 kB
        Werner Guttmann
      7. SourceFactory.java
        88 kB
        Simeon de Dios

        Activity

        Hide
        Werner Guttmann added a comment -

        No, I don't. I am away now for 7 days, and there's quite some issues that I would want to include.

        Show
        Werner Guttmann added a comment - No, I don't. I am away now for 7 days, and there's quite some issues that I would want to include.
        Hide
        Werner Guttmann added a comment -

        In order to complete the addition of a new test to the CTF test suite (based upon your sample XML Schema), I'd need a valid XML document that I could use to unmarshall against the generated classes. Any chances of supplying me with such a sample XML document instance ?

        Show
        Werner Guttmann added a comment - In order to complete the addition of a new test to the CTF test suite (based upon your sample XML Schema), I'd need a valid XML document that I could use to unmarshall against the generated classes. Any chances of supplying me with such a sample XML document instance ?
        Hide
        Werner Guttmann added a comment -

        Updated patch, based upon Simeon's unified patch for SourceFactory, with added changelog entries. I will commit this patch as is once I have been given a sample XML document that can be usedd within the new CTF test to be unmarshalled against the classes generated from the sample XML Schema.

        Show
        Werner Guttmann added a comment - Updated patch, based upon Simeon's unified patch for SourceFactory, with added changelog entries. I will commit this patch as is once I have been given a sample XML document that can be usedd within the new CTF test to be unmarshalled against the classes generated from the sample XML Schema.
        Hide
        Simeon de Dios added a comment -

        Attached instance document corresponding to test schema.

        Show
        Simeon de Dios added a comment - Attached instance document corresponding to test schema.
        Hide
        Werner Guttmann added a comment -

        Final patch. As I have got problems with authentication on https://svn.codehaus.org/castor, I will commit this patch later.

        Show
        Werner Guttmann added a comment - Final patch. As I have got problems with authentication on https://svn.codehaus.org/castor , I will commit this patch later.

          People

          • Assignee:
            Werner Guttmann
            Reporter:
            Simeon de Dios
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - Not Specified
              Not Specified
              Remaining:
              Remaining Estimate - 0 minutes
              0m
              Logged:
              Time Spent - 20 minutes
              20m