users@jaxb.java.net

Re: Inline Customization, help explain error

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Fri, 30 Mar 2007 12:33:06 -0700

Hank Ratzesberger wrote:
> I was unable to fix a schema parsing issue using an external
> bindings file -- probably because the problem was in an included
> schema file. Anyway, so I attempted inline customization.
> After working past "jxb version not declared" and "binding path
> results in NULL" (sorry, but I am paraphrasing these...) and
> feeling that everything is just about right, I get the
> error: Cannot find the declaration of element 'jxb:bindings'
>
> This doesnt make any sense, because I was getting errors on
> the node binding. Now I don't know how to proceed.
>
> Thanks for any tips,
> Hank Ratzesberger
> UCSB

It's a bug in XJC that it doesn't allow <jaxb:bindings> inline. I just
fixed that for 2.1.3.

In the mean time, you normally don't use <bindings> element for inline
schema. Instead, you just attach your customization (in this case
<jaxb:class> to a proper place, that is as an annotation for the
attribute that you are pointing to.)

Also, <jaxb:class> customization is invalid for an attribute, so it
won't work anyway.

>
> The top level schema element:
>
> <xs:schema targetNamespace="http://www.opengis.net/swe/1.0"
> xmlns:swe="http://www.opengis.net/swe/1.0"
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:gml="http://www.opengis.net/gml"
> elementFormDefault="qualified"
> attributeFormDefault="unqualified" version="1.0"
> xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
> xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
> jxb:extensionBindingPrefixes="xjc"
> jxb:version="1.0">
>
> The binding:
>
> <xs:element name="GeoLocationArea" substitutionGroup="swe:AbstractDataRecord">
> <xs:annotation>
> <xs:documentation>Area used to define bounding boxes</xs:documentation>
> <xs:appinfo>
> <jxb:bindings node="../../../xs:complexType/xs:complexContent/xs:extension/xs:attribute">
> <jxb:class name="aName"/>
> </jxb:bindings>
> </xs:appinfo>
> </xs:annotation>
> <xs:complexType>
> <xs:complexContent>
> <xs:extension base="swe:AbstractVectorType">
> <xs:sequence>
> <xs:element name="member" type="swe:EnvelopePropertyType" maxOccurs="unbounded">
> <xs:annotation>
> <xs:documentation>Is this an aggregate geometry?</xs:documentation>
> </xs:annotation>
> </xs:element>
> </xs:sequence>
> <xs:attribute name="name" type="xs:token"/>
> </xs:extension>
> </xs:complexContent>
> </xs:complexType>
> </xs:element>
>
> The error message:
>
> [java] parsing a schema...
> [java] [ERROR] cvc-elt.1: Cannot find the declaration of element 'jxb:bindings'.
> [java] line 97 of file:positionTypes.xsd
> [java] Failed to parse a schema.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>
>


-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com