I'm writing a JAXB plugin (using xjc/jaxb 2.1.6 jars) to process some
additional metadata in our schemas and generate some properties files. When
my custom tag, <crud:dataObject>, appears only under the complexType
declarations, it works fine. But when add another tag <crud:template> I get
an error.
Here is a schema snippet that fails:
<xs:complexType name="Status">
<xs:annotation>
<xs:appinfo>
*<crud:dataObject>
<crud:class>com.foo.Status</crud:class>
</crud:dataObject>*
</xs:appinfo>
</xs:annotation>
<xs:sequence>
<xs:element ref="site">
<xs:annotation>
<xs:appinfo>
* <!-- works if this is commented out -->*
*<crud:template>
<crud:key>1</crud:key>
</crud:template> *
</xs:appinfo>
</xs:annotation>
</xs:element>
[snip]
</xs:sequence>
</xs:complexType>
here is the error xjc throws:
[xjc] [ERROR] compiler was unable to honor this crud:template customization.
It is attached to a wrong place, or its inconsistent with other bindings.
[xjc] line 51 of file:/C:/work/ref/apps/pd/do/src/schema/Foo.xsd
[xjc] [ERROR] (the above customization is attached to the following location
in the schema)
[xjc] line 48 of file:/C:/work/ref/apps/pd/do/src/schema/Foo.xsd
In my plugin, isCustomizationTagName() returns true for any tag matching my
"crud" namespace and run() acknowledges them all.
Am I not allowed to have customizations at both the <xs:complexType> and its
<xs:element>s? Is there another way to do this? I need information at both
levels for the output file I'm writing. I can't put the <crud:template>
information at element's definition (its complexType or simpleType) because
that information varies based on the complexType referencing that element.
-tim