0

In my xsd schema, I have a complexType "expression" which has 27 elements and all of them extend a common complexType "StepElement". Here is a sample of the expression complexType.(For simplicity, I'm only showing 8 of them.)

 <xs:complexType name="expression">
            <xs:sequence maxOccurs="unbounded">
                <xs:element name="STEP_ANIMATION" type="Animation_Attributes" minOccurs="0" maxOccurs="unbounded"/>
                <xs:element name="STEP_EXPECT_REPLY" type="Expect_Reply_Attributes" minOccurs="0" maxOccurs="unbounded"/>
                <xs:element name="STEP_RESTART" type="Restart_Attributes" minOccurs="0" maxOccurs="unbounded"/>
                <xs:element name="STEP_REDIRECT" type="Redirect_Attributes" minOccurs="0" maxOccurs="unbounded"/>
                <xs:element name="STEP_SUBGOAL" type="Subgoal_Attributes" minOccurs="0" maxOccurs="unbounded"/>
                <xs:element name="STEP_TIMER" type="Timer_Attributes" minOccurs="0" maxOccurs="unbounded"/>
                <xs:element name="STEP_SITUATION" type="Situation_Attributes" minOccurs="0" maxOccurs="unbounded"/>
                <xs:element name="STEP_SOUND" type="Sound_Attributes" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
        <xs:attribute name="ID" type="xs:integer"/>
        <xs:attribute name="SUCCESS_EVT" type="xs:string"/>
        <xs:attribute name="DELAY" type="xs:float"/>
    </xs:complexType>

Where each of these element types look like this (They all extend StepElement but have different attributes)

<xs:complexType name="Animation_Attributes">
        <xs:complexContent>
            <xs:extension base="StepElement">
                <xs:attribute name="AGENT" type="xs:string" default="$CURRENTBOT"/>
                <xs:attribute name="SUCCESS_EVT" type="xs:string"/>
                <xs:attribute name="FAIL_EVT" type="xs:string"/>
                </xs:extension>
        </xs:complexContent>
</xs:complexType>

And here is how the StepElement looks like

<xs:complexType name="StepElement">
        <xs:simpleContent>
            <xs:extension base="xs:string">
                <xs:attribute name="ID" type="xs:integer"/>
                <xs:attribute name="ENGLISH" type="xs:string"/>
            </xs:extension>
        </xs:simpleContent>

Now the problem that I have is that when I parse this schema, the getter method that the JAXB generates in Expression class is this

 public List<StepElement> getSTEPANIMATIONAndSTEPEXPECTREPLYAndSTEPRESTART()

Am I doing something wrong in the schema structure that is causing this to happen OR is there a solution to tweak the method name?

Jawad Ali
  • 23
  • 3

1 Answers1

1

You can use a JAXB bindings file to customize the method names that are generated. Here's the Oracle documentation on it.

austin
  • 5,816
  • 2
  • 32
  • 40
  • I studied the documentation on Customizing JAXB Bindings but it doesn't say anything about customizing method names :/. – Jawad Ali Jul 12 '13 at 16:48
  • Here's an example. http://stackoverflow.com/questions/4502229/how-do-you-customize-how-jaxb-generates-plural-method-names – austin Jul 12 '13 at 17:29