Baldurien wrote:
> Hello, again.
>
> I have an attribute in my schema whose name is "class". The generator is
> not happy about that, and so it warns me.
>
> Here is the the part of the schema (if you want to test, you can/should
> remove the sequence, and left only the attributes) :
>
> <xsi:complexType name="CommandType">
> <xsi:sequence maxOccurs="1" minOccurs="1">
> <xsi:element maxOccurs="unbounded" minOccurs="0" name="import"
> type="ImportOptionType">
> </xsi:element>
> <xsi:element maxOccurs="unbounded" minOccurs="0" name="invoke"
> type="InvocationOptionType">
> </xsi:element>
> </xsi:sequence>
> <xsi:attribute name="class" type="xsi:string"
> use="required"></xsi:attribute>
> <xsi:attribute name="name" type="xsi:ID" use="required"></xsi:attribute>
> <xsi:attribute name="shortName" type="xsi:NMTOKEN"
> use="optional"></xsi:attribute>
> </xsi:complexType>
>
>
> Then in my bindings, I have this:
>
> <attributeBinding name="/complexType:CommandType/@class">
> <member name="className" type="java.lang.String" />
> </attributeBinding>
>
> The result that I'm expecting is that it should rename "class" into
> "className", but it won't.
>
> However, if I put "clazz" instead of class as attribute name in my
> schema, and then rename it in the bindings, it successfully rename the
> attribute.
I am not 100% sure, but - as per the warning - Castor will
(automatically) rename any XML name artefact that is in conflict with a
Java identifier to something meaningful: class --> clazz. Why the
binding is not used ... I will have to cross-check.
>
> How can I have a "class" attribute, and rename it with the name of my
> choice?
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
> http://xircles.codehaus.org/manage_email
>
>
>
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email