Marcus Walls wrote:
> Apologies if this has come up before (I have a feeling it might have
> done) but I can't currently search the archives - I get the error
> message "Invalid search expression - stack not empty after final
> evaluation." when searching for "customization not used".
>
> My code works fine in beta and I'm now upgrading it to 1.0.
> Now my schema won't compile, and after changing my print and parse
> attributes to printMethod and parseMethod as per the spec, I'm still
> getting the error:
>
> [ERROR] Specified javaType customization is not used.
> line 27 of services.xsd
>
> However, I'm definitely using it - lines 35-37 and 48-49!
>
> Does anybody have any idea what's happened? Presumably some
> tightening of the spec between beta and 1.0 that I don't appreciate...
It is probably the tightening of the RI to conform to the spec.
Please try moving the customization to the annotation element of the <simpleType>
from the annotation element of the <restriction> i.e.
<xsd:simpleType name="trimmedString">
<xsd:annotation>
<xsd:appinfo>
<jxb:javaType name="java.lang.String"
parseMethod="com.aspective.common.jaxb.TrimmedString.trim"
printMethod="com.aspective.common.jaxb.TrimmedString.trim">
</jxb:javaType>
</xsd:appinfo>
</xsd:annotation>
<xsd:restriction base="xsd:string"/>
</xsd:simpleType>
The specification restricts where annotations can be specified ( we may revisit
this in future). The placement of customizations is specified in the
"Customizable schema elements" section for a customization. For <javaType>,
section 6.9.6.1, "Simple Type Definition" specifies the customization should be
placed in the annotation element of the simple type definition.
>
>
> I have attached my schema.
>
> Thanks
>
> Marcus
>
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
> jxb:version="1.0">
>
> <xsd:element name="services">
> <xsd:complexType>
> <xsd:sequence>
> <xsd:element name="service" type="ServiceDefinition" minOccurs="1" maxOccurs="unbounded">
> <xsd:annotation>
> <xsd:appinfo>
> <jxb:property name="services"/>
> </xsd:appinfo>
> </xsd:annotation>
> </xsd:element>
> </xsd:sequence>
> </xsd:complexType>
> </xsd:element>
>
> <xsd:simpleType name="trimmedString">
> <xsd:restriction base="xsd:string">
> <xsd:annotation>
> <xsd:appinfo>
> <jxb:javaType name="java.lang.String"
> parseMethod="com.aspective.common.jaxb.TrimmedString.trim"
> printMethod="com.aspective.common.jaxb.TrimmedString.trim">
> </jxb:javaType>
> </xsd:appinfo>
> </xsd:annotation>
> </xsd:restriction>
> </xsd:simpleType>
>
> <xsd:complexType name="ServiceDefinition">
> <xsd:sequence>
> <xsd:element name="name" type="trimmedString"/>
> <xsd:element name="description" type="trimmedString"/>
> <xsd:element name="class" type="trimmedString">
> <xsd:annotation>
> <xsd:appinfo>
> <jxb:property name="implementationClass"/>
> </xsd:appinfo>
> </xsd:annotation>
> </xsd:element>
> <xsd:element name="stoppable" type="xsd:boolean"/>
> <xsd:element name="loadOnStartup" type="xsd:boolean"/>
> <xsd:element name="loadOrder" type="xsd:int"/>
> </xsd:sequence>
> <xsd:attribute name="id" use="required" type="trimmedString"/>
> <xsd:attribute name="path" use="optional" type="trimmedString" default=""/>
> </xsd:complexType>
>
> </xsd:schema>
Sekhar