users@jaxb.java.net

Error while trying to run xjc on a 3rd party schema

From: prerna2008 <prerna.arora_at_gs.com>
Date: Tue, 25 Mar 2008 13:24:08 -0700 (PDT)

Hi,

I am trying to use JAXB to unmarshal/marshal xml files used for
configuration in Open Adaptor (a 3rd party product). I am unable to get the
schema to compile with JAXB 2.0 and also with JAXB RI.

My first attempt at compiling was using JAXB 2.0 ..

     <xjc schema="../conf/spring-beans-2.0.xsd"
package="harmony.openadapter" destdir="../gen-src">
        <produces dir="../gen-src/harmony.openadapter" includes="**/*.java"
/>
        <arg value="-nv" />
    </xjc>

Errors:

Compiling file:/C:/Harmony_Admin/conf/spring-beans-2.0.xsd
[ERROR] Property "Ref" is already defined.
  line 922 of file:/C:/Harmony_Admin/conf/spring-beans-2.0.xsd

[ERROR] The following location is relevant to the above error
  line 940 of file:/C:/Harmony_Admin/conf/spring-beans-2.0.xsd

[ERROR] Property "Value" is already defined.
  line 924 of file:/C:/Harmony_Admin/conf/spring-beans-2.0.xsd

[ERROR] The following location is relevant to the above error
  line 947 of file:/C:/Harmony_Admin/conf/spring-beans-2.0.xsd

[ERROR] Property "Ref" is already defined.
  line 553 of file:/C:/Harmony_Admin/conf/spring-beans-2.0.xsd

[ERROR] The following location is relevant to the above error
  line 582 of file:/C:/Harmony_Admin/conf/spring-beans-2.0.xsd

[ERROR] Property "Value" is already defined.
  line 555 of file:/C:/Harmony_Admin/conf/spring-beans-2.0.xsd

[ERROR] The following location is relevant to the above error
  line 589 of file:/C:/Harmony_Admin/conf/spring-beans-2.0.xsd

[ERROR] Property "Key" is already defined.
  line 1010 of file:/C:/Harmony_Admin/conf/spring-beans-2.0.xsd

[ERROR] The following location is relevant to the above error
  line 1013 of file:/C:/Harmony_Admin/conf/spring-beans-2.0.xsd


On further reading, I thought JAB RI is the solution and hence, attempted
the follwing:
1) I downloaded the nightly build for JAXB RI (JAXB RI 2.2.x nightlies)
2) Used the following schemalet as recommended on this link
(http://weblogs.java.net/blog/kohsuke/archive/2006/03/simple_and_bett.html)

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="no-such-thing"
        xmlns:xs="http://www.w3.org/2001/XMLSchema"
        xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" jaxb:version="2.0"
        xmlns:xjc= "http://java.sun.com/xml/ns/jaxb/xjc"
jaxb:extensionBindingPrefixes="xjc">
  <xs:annotation><xs:appinfo>
    <jaxb:globalBindings>
            <xjc:simple />
    </jaxb:globalBindings>
  </xs:appinfo></xs:annotation>
</xs:schema>


3) Tried to compile the xsd using the follwing command ..

Z:\JWSDP\JAX RI\openadapter>xjc spring-beans-2.0.xsd -extension
simpleMode.xsd
p harmony.openadapter -d gen-src -nv

and here is the output...(looks similar to the first one :( )

parsing a schema...
[ERROR] Property "Ref" is already defined.
  line 553 of file:/Z:/JWSDP/JAX%20RI/openadapter/spring-beans-2.0.xsd

[ERROR] The following location is relevant to the above error
  line 582 of file:/Z:/JWSDP/JAX%20RI/openadapter/spring-beans-2.0.xsd

[ERROR] Property "Value" is already defined.
  line 555 of file:/Z:/JWSDP/JAX%20RI/openadapter/spring-beans-2.0.xsd

[ERROR] The following location is relevant to the above error
  line 589 of file:/Z:/JWSDP/JAX%20RI/openadapter/spring-beans-2.0.xsd

[ERROR] Property "Ref" is already defined.
  line 922 of file:/Z:/JWSDP/JAX%20RI/openadapter/spring-beans-2.0.xsd

[ERROR] The following location is relevant to the above error
  line 940 of file:/Z:/JWSDP/JAX%20RI/openadapter/spring-beans-2.0.xsd

[ERROR] Property "Value" is already defined.
  line 924 of file:/Z:/JWSDP/JAX%20RI/openadapter/spring-beans-2.0.xsd

[ERROR] The following location is relevant to the above error
  line 947 of file:/Z:/JWSDP/JAX%20RI/openadapter/spring-beans-2.0.xsd

[ERROR] Property "Key" is already defined.
  line 1010 of file:/Z:/JWSDP/JAX%20RI/openadapter/spring-beans-2.0.xsd

[ERROR] The following location is relevant to the above error
  line 1013 of file:/Z:/JWSDP/JAX%20RI/openadapter/spring-beans-2.0.xsd

Failed to parse a schema.


Can someone please suggest a way to get this to work without having to
change the original schema.

Thanks a ton.

Regards,
Prerna

PFA the original schema file.
http://www.nabble.com/file/p16287760/spring-beans-2.0.xsd
spring-beans-2.0.xsd
-- 
View this message in context: http://www.nabble.com/Error-while-trying-to-run-xjc-on-a-3rd-party-schema-tp16287760p16287760.html
Sent from the java.net - jaxb users mailing list archive at Nabble.com.