Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Moxy jaxb-compile fails on xs:choice

Hi Mark,

I've replicated what you're seeing (I made up my own CPX001.xsd and
CPX002.xsd files), and to get around this you can specify the '-nv' argument
as well on your command line:

M:\Programs\eclipselink-2.1.0-M7\bin\jaxb-compiler.cmd Main.xsd -extension
-d M:/Shared/Projects.Java/yellowfire/yellowfire-xml/src/main/gen -verbose
-nv

By default XJC does a very strict "correctness check" of your input schema,
and I have found sometimes it will fail even with a valid schema.  The XJC
team recognize this and provide a way to disable the validation.

By turning validation off the compiler was able to successfully parse your
schema and and Java source was generated, try this and see how you make out.

- Rick


Subject:
[eclipselink-users] Moxy jaxb-compile fails on xs:choice
From:
Mark P Ashworth <info@xxxxxxxxxxxxx>
Date:
Wed, 12 May 2010 23:36:00 -0700 (PDT)
To:
eclipselink-users@xxxxxxxxxxx
To:
eclipselink-users@xxxxxxxxxxx

Hi,

I am trying parse the following schema using Moxy Jaxb-Compile

<?xml version="1.0" encoding="utf-8"?>
<xs:schema
           xmlns:CPX="http://Main/Schemas/CPX"
           attributeFormDefault="unqualified"
           elementFormDefault="unqualified"
           targetNamespace="http://Main/Schemas/v0.0.1"
           id="Main"
           xmlns:xs="http://www.w3.org/2001/XMLSchema">

  <xs:import schemaLocation="CPX001.xsd" namespace="http://Main/Schemas/CPX"
/>
  <xs:import schemaLocation="CPX002.xsd" namespace="http://Main/Schemas/CPX"
/>
  <xs:element name="Message">
    <xs:complexType>
      <xs:choice>
        <xs:element ref="CPX:CPX001" />
        <xs:element ref="CPX:CPX002" />
      </xs:choice>
    </xs:complexType>
  </xs:element>
</xs:schema>


But I am getting the following error:


  
M:\Programs\eclipselink-2.1.0-M7\bin\jaxb-compiler.cmd Main.xsd -extension
    
-d M:/Shared/Projects.Java/yellowfire/yellowfire-xml/src/main/gen  -verbose

parsing a schema...
[ERROR] src-resolve: Cannot resolve the name 'CPX:CPX002' to a(n) 'element
declaration' component.
  line 16 of
file:/M:/Shared/Projects.Java/yellowfire/yellowfire-xml/src/main/xsd/Main.xsd

Failed to parse a schema.


Regards,
Mark P Ashworth
  

--
Rick Barkhouse | Software Developer, EclipseLink | 613.288.4613
Oracle Development
45 O'Connor Street, Suite 400 | Ottawa, Ontario K1P 1A4

Back to the top