[JIRA] Commented: (JAXB-420) XJC ignores external bindings if xsd contains annotation at schema level and includes another schema

  • From: "Stillglade (JIRA)" <jira-no-reply@...>
  • To: issues@...
  • Subject: [JIRA] Commented: (JAXB-420) XJC ignores external bindings if xsd contains annotation at schema level and includes another schema
  • Date: Wed, 13 Feb 2013 14:45:53 +0000 (GMT+00:00)
  • Auto-submitted: auto-generated


    [ 
http://java.net/jira/browse/JAXB-420?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=356051#action_356051
 ] 

Stillglade commented on JAXB-420:
---------------------------------

We also have been dealing with this issue for a long time.  It is not just 
the path, but also the machine and JDK version.  For example, I and another 
developer can have the exact same files in the same location using the same 
JDK version, but on one machine the binding file is picked up, and on the 
other it is ignored.  Likewise, we have found that sometimes if you try a 
different JDK version, it will work or not work (there are some schemas where 
we have to run XJC with JDK 5 and others with JDK 6 to make it pick up the 
bindings file).

> XJC ignores external bindings if xsd contains annotation at schema level 
> and includes another schema
> ----------------------------------------------------------------------------------------------------
>
>                 Key: JAXB-420
>                 URL: http://java.net/jira/browse/JAXB-420
>             Project: jaxb
>          Issue Type: Bug
>          Components: xjc
>    Affects Versions: 2.1
>         Environment: Operating System: All
> Platform: All
>            Reporter: schubertf
>            Assignee: jaxb-issues
>             Fix For: not determined
>
>         Attachments: external-customize.zip, sample.tar.gz
>
>
> The XJC compiler ignores any global bindings if my XSD contains an 
> xs:annotation
> entry at schema level and also contains an xs:includes statement.
> To reproduce...
> File : included.xsd
> --------------------
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";>
>   <xs:complexType name="PurchaseOrderType">
>     <xs:sequence>
>       <xs:element name="shipTo" type="USAddress"/>
>       <xs:element name="billTo" type="USAddress"/>
>       <xs:element ref="comment" minOccurs="0"/>
>       <xs:element name="items" type="Items"/>
>     </xs:sequence>
>     <xs:attribute name="orderDate" type="xs:dateTime"/>
>   </xs:complexType>
> </xs:schema>
> File : po.xsd
> ----------------
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";>
> <xs:include schemaLocation="included.xsd"/>
>       <xs:annotation>
>               <xs:documentation xml:lang="en">This annotation entry causes 
> JAXB to ignore
> any global bindings in the external customisation file.</xs:documentation>
>       </xs:annotation>
>   <xs:element name="purchaseOrder" type="PurchaseOrderType"/>
>   <xs:element name="comment" type="xs:string"/>
>   <xs:complexType name="USAddress">
>     <xs:sequence>
>       <xs:element name="name" type="xs:string"/>
>       <xs:element name="street" type="xs:string"/>
>       <xs:element name="city" type="xs:string"/>
>       <xs:element name="state" type="USState"/>
>       <xs:element name="zip" type="ZipCodeType"/>
>     </xs:sequence>
>     <xs:attribute name="country" type="xs:NMTOKEN" fixed="US"/>
>   </xs:complexType>
>   <xs:complexType name="Items">
>     <xs:sequence>
>       <xs:element name="item" minOccurs="1" maxOccurs="unbounded">
>         <xs:complexType>
>           <xs:sequence>
>             <xs:element name="productName" type="xs:string"/>
>             <xs:element name="quantity" default="10">
>               <xs:simpleType>
>                 <xs:restriction base="xs:positiveInteger">
>                   <xs:maxExclusive value="100"/>
>                 </xs:restriction>
>               </xs:simpleType>
>             </xs:element>
>             <xs:element name="USPrice" type="xs:decimal"/>
>             <xs:element ref="comment" minOccurs="0"/>
>             <xs:element name="shipDate" type="xs:dateTime" minOccurs="0"/>
>           </xs:sequence>
>           <xs:attribute name="partNum" type="SKU" use="required"/>
>         </xs:complexType>
>       </xs:element>
>     </xs:sequence>
>   </xs:complexType>
>   <!-- Stock Keeping Unit, a code for identifying products -->
>   <xs:simpleType name="SKU">
>     <xs:restriction base="xs:string">
>       <xs:pattern value="\d{3}-[A-Z]{2}"/>
>     </xs:restriction>
>   </xs:simpleType>
>   <xs:simpleType name="USState">
>     <xs:restriction base="xs:string">
>       <xs:enumeration value="AK"/>
>       <xs:enumeration value="AL"/>
>       <xs:enumeration value="AR"/>
>       <xs:enumeration value="CA"/>
>       <xs:enumeration value="MA"/>
>       <!-- and so on ... -->
>     </xs:restriction>
>   </xs:simpleType>
>   <xs:simpleType name="ZipCodeType">
>     <xs:restriction base="xs:integer">
>       <xs:minInclusive value="10000"/>
>       <xs:maxInclusive value="99999"/>
>     </xs:restriction>
>   </xs:simpleType>
> </xs:schema>
> File 3: binding.xjb
> ----------------------
> <jxb:bindings xmlns:jxb="http://java.sun.com/xml/ns/jaxb";
>                xmlns:xs="http://www.w3.org/2001/XMLSchema";
>                  xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc";
>                jxb:version="2.0"
>                jxb:extensionBindingPrefixes="xjc">
>   <jxb:bindings>
>     <jxb:globalBindings>
>      <jxb:javaType name="org.joda.time.DateTime" xmlType="xs:dateTime"/>
>     </jxb:globalBindings>
>   </jxb:bindings>
> </jxb:bindings>
> With the <xs:annotation> element in po.xsd the orderDate instance variable 
> in
> the PurchaseOrderType class is generated as...
> protected XMLGregorianCalendar orderDate;
> Without the <xs:annotation> element it is generated as...
> protected DateTime orderDate;
> Note that this does not happen if you only have one schema and it does not
> include any other schemas. It only happens when you have included schemas.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://java.net/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


[JIRA] Commented: (JAXB-420) XJC ignores external bindings if xsd contains annotation at schema level and includes another schema

Stillglade (JIRA) 02/13/2013
Terms of Use; Privacy Policy; Copyright ©2013-2015 (revision 20150226.965aeb8)
 
 
Close
loading
Please Confirm
Close