# XJC --> Java-Objects compile Problem



## sdx (6. Aug 2010)

Hallo, versuche gerade die opendocument content.xml file für chart-objecte in java Beans abzubilden, bekomme dabei eine fehlermeldung:

XJC Befehl über commandozeile:


```
xjc -p opendoc content.xsd
```

meine content.xsd sieht so aus:

[XML]
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
elementFormDefault="qualified" 
targetNamespace="urnasis:names:tcpendocument:xmlnsffice:1.0" 
xmlns:table="urnasis:names:tcpendocument:xmlns:table:1.0" 
xmlns:fo="urnasis:names:tcpendocument:xmlns:xsl-fo-compatible:1.0" 
xmlns:text="urnasis:names:tcpendocument:xmlns:text:1.0" 
xmlns:number="urnasis:names:tcpendocument:xmlns:datastyle:1.0" 
xmlns:chart="urnasis:names:tcpendocument:xmlns:chart:1.0" 
xmlns:draw="urnasis:names:tcpendocument:xmlns:drawing:1.0" 
xmlns:svg="urnasis:names:tcpendocument:xmlns:svg-compatible:1.0" 
xmlns:style="urnasis:names:tcpendocument:xmlns:style:1.0" 
xmlnsffice="urnasis:names:tcpendocument:xmlnsffice:1.0">
  <xs:import namespace="urnasis:names:tcpendocument:xmlns:chart:1.0" schemaLocation="chart.xsd"/>
  <xs:import namespace="urnasis:names:tcpendocument:xmlns:datastyle:1.0" schemaLocation="number.xsd"/>
  <xs:import namespace="urnasis:names:tcpendocument:xmlns:drawing:1.0" schemaLocation="draw.xsd"/>
  <xs:import namespace="urnasis:names:tcpendocument:xmlns:style:1.0" schemaLocation="style.xsd"/>
  <xs:import namespace="urnasis:names:tcpendocument:xmlns:svg-compatible:1.0" schemaLocation="svg.xsd"/>
  <xs:import namespace="urnasis:names:tcpendocument:xmlns:table:1.0" schemaLocation="table.xsd"/>
  <xs:import namespace="urnasis:names:tcpendocument:xmlns:text:1.0" schemaLocation="text.xsd"/>
  <xs:import namespace="urnasis:names:tcpendocument:xmlns:xsl-fo-compatible:1.0" schemaLocation="fo.xsd"/>
  <xs:element name="document-content">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="office:automatic-styles"/>
        <xs:element ref="office:body"/>
      </xs:sequence>
      <xs:attribute name="version" use="required" form="qualified" type="xs:decimal"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="automatic-styles">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="number:number-style"/>
        <xs:element maxOccurs="unbounded" ref="style:style"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="body">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="office:chart"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="chart">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="chart:chart"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>
[/XML]

Die chart.xsd:

[XML]
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
elementFormDefault="qualified" 
targetNamespace="urnasis:names:tcpendocument:xmlns:chart:1.0" 
xmlns:table="urnasis:names:tcpendocument:xmlns:table:1.0" 
xmlns:fo="urnasis:names:tcpendocument:xmlns:xsl-fo-compatible:1.0" 
xmlns:text="urnasis:names:tcpendocument:xmlns:text:1.0" 
xmlns:number="urnasis:names:tcpendocument:xmlns:datastyle:1.0" 
xmlns:chart="urnasis:names:tcpendocument:xmlns:chart:1.0" 
xmlns:draw="urnasis:names:tcpendocument:xmlns:drawing:1.0" 
xmlns:svg="urnasis:names:tcpendocument:xmlns:svg-compatible:1.0" 
xmlns:style="urnasis:names:tcpendocument:xmlns:style:1.0" 
xmlnsffice="urnasis:names:tcpendocument:xmlnsffice:1.0">
  <xs:import namespace="urnasis:names:tcpendocument:xmlns:datastyle:1.0" schemaLocation="number.xsd"/>
  <xs:import namespace="urnasis:names:tcpendocument:xmlns:drawing:1.0" schemaLocation="draw.xsd"/>
  <xs:import namespace="urnasis:names:tcpendocument:xmlnsffice:1.0" schemaLocation="content.xsd"/>
  <xs:import namespace="urnasis:names:tcpendocument:xmlns:style:1.0" schemaLocation="style.xsd"/>
  <xs:import namespace="urnasis:names:tcpendocument:xmlns:svg-compatible:1.0" schemaLocation="svg.xsd"/>
  <xs:import namespace="urnasis:names:tcpendocument:xmlns:table:1.0" schemaLocation="table.xsd"/>
  <xs:import namespace="urnasis:names:tcpendocument:xmlns:text:1.0" schemaLocation="text.xsd"/>
  <xs:import namespace="urnasis:names:tcpendocument:xmlns:xsl-fo-compatible:1.0" schemaLocation="fo.xsd"/>
  <xs:attribute name="connect-bars" type="xs:boolean"/>
  <xs:attribute name="display-label" type="xs:boolean"/>
  <xs:attribute name="logarithmic" type="xs:boolean"/>
  <xs:attribute name="reverse-direction" type="xs:boolean"/>
  <xs:attribute name="right-angled-axes" type="xs:boolean"/>
  <xs:attribute name="visible" type="xs:boolean"/>
  <xs:element name="chart">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="chart:legend"/>
        <xs:element ref="chartlot-area"/>
      </xs:sequence>
      <xs:attribute name="class" use="required" form="qualified" type="xs:NMTOKEN"/>
      <xs:attribute name="style-name" use="required" form="qualified" type="xs:NCName"/>
      <xs:attribute ref="svg:height" use="required"/>
      <xs:attribute ref="svg:width" use="required"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="legend">
    <xs:complexType>
      <xs:attribute name="legend-position" use="required" form="qualified" type="xs:NCName"/>
      <xs:attribute name="style-name" use="required" form="qualified" type="xs:NCName"/>
      <xs:attribute ref="svg:x" use="required"/>
      <xs:attribute ref="svg:y" use="required"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="plot-area">
    <xs:complexType>
      <xs:sequence>
        <xs:element maxOccurs="unbounded" ref="chart:axis"/>
        <xs:element maxOccurs="unbounded" ref="chart:series"/>
        <xs:element ref="chart:wall"/>
        <xs:element ref="chart:floor"/>
      </xs:sequence>
      <xs:attribute name="data-source-has-labels" use="required" form="qualified" type="xs:NCName"/>
      <xs:attribute name="style-name" use="required" form="qualified" type="xs:NCName"/>
      <xs:attribute ref="svg:height" use="required"/>
      <xs:attribute ref="svg:width" use="required"/>
      <xs:attribute ref="svg:x" use="required"/>
      <xs:attribute ref="svg:y" use="required"/>
      <xs:attribute ref="table:cell-range-address" use="required"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="axis">
    <xs:complexType>
      <xs:choice>
        <xs:element ref="chart:categories"/>
        <xs:element ref="chart:grid"/>
      </xs:choice>
      <xs:attribute name="dimension" use="required" form="qualified" type="xs:NCName"/>
      <xs:attribute name="name" use="required" form="qualified" type="xs:NCName"/>
      <xs:attribute name="style-name" use="required" form="qualified" type="xs:NCName"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="categories">
    <xs:complexType>
      <xs:attribute ref="table:cell-range-address" use="required"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="grid">
    <xs:complexType>
      <xs:attribute name="class" use="required" form="qualified" type="xs:NCName"/>
      <xs:attribute name="style-name" use="required" form="qualified" type="xs:NCName"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="series">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="chart:data-point"/>
      </xs:sequence>
      <xs:attribute name="class" use="required" form="qualified" type="xs:NMTOKEN"/>
      <xs:attribute name="style-name" use="required" form="qualified" type="xs:NCName"/>
      <xs:attribute name="values-cell-range-address" use="required" form="qualified" type="xs:NMTOKEN"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="data-point">
    <xs:complexType>
      <xs:attribute name="repeated" use="required" form="qualified" type="xs:integer"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="wall">
    <xs:complexType>
      <xs:attribute name="style-name" use="required" form="qualified" type="xs:NCName"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="floor">
    <xs:complexType>
      <xs:attribute name="style-name" use="required" form="qualified" type="xs:NCName"/>
    </xs:complexType>
  </xs:element>
</xs:schema>
[/XML]

Die Fehlermeldung sieht so aus:


```
parsing a schema...
compiling a schema...
[ERROR] A class/interface with the same name "opendoc.Chart" is already in use.
Use a class customization to resolve this conflict.
  line 46 of file:/D:/workspace_iav/iav_ODSReport/src/content.xsd

[ERROR] (Relevant to above error) another "Chart" is generated from here.
  line 17 of file:/D:/workspace_iav/iav_ODSReport/src/chart.xsd

[ERROR] Two declarations cause a collision in the ObjectFactory class.
  line 17 of file:/D:/workspace_iav/iav_ODSReport/src/chart.xsd

[ERROR] (Related to above error) This is the other declaration.
  line 46 of file:/D:/workspace_iav/iav_ODSReport/src/content.xsd

Failed to produce code.
```

Bin für jede Hilfe dankbar!


----------



## sdx (6. Aug 2010)

hatte davor falsche fehlermeldung, hier die richtige:


```
parsing a schema...
compiling a schema...
[ERROR] A class/interface with the same name "opendoc.Chart" is already in use.
Use a class customization to resolve this conflict.
  line 46 of file:/D:/workspace_iav/iav_ODSReport/src/content.xsd

[ERROR] (Relevant to above error) another "Chart" is generated from here.
  line 28 of file:/D:/workspace_iav/iav_ODSReport/src/chart.xsd

[ERROR] Two declarations cause a collision in the ObjectFactory class.
  line 28 of file:/D:/workspace_iav/iav_ODSReport/src/chart.xsd

[ERROR] (Related to above error) This is the other declaration.
  line 46 of file:/D:/workspace_iav/iav_ODSReport/src/content.xsd

Failed to produce code.
```


----------



## Sempah (6. Aug 2010)

sieht auf den ersten Blick nach einem doppelten Namen (chart) aus.
Versuch mal entweder in content.xsd line 46 das chart in chart1 zu ändern oder in chart.xsd line 28.


----------



## sdx (6. Aug 2010)

das umbenennen hat leider nichts gebracht, bekomme den gleichen fehler

finde ganz komisch dass die Werte in office.xsd gleich sind wie in content.xsd die anderen schemas haben fast keine elemente nur paar attribute

hier die office.xsd

[XML]
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
elementFormDefault="qualified" 
targetNamespace="urnasis:names:tcpendocument:xmlnsffice:1.0" 
xmlns:table="urnasis:names:tcpendocument:xmlns:table:1.0" 
xmlns:fo="urnasis:names:tcpendocument:xmlns:xsl-fo-compatible:1.0" 
xmlns:text="urnasis:names:tcpendocument:xmlns:text:1.0" 
xmlns:number="urnasis:names:tcpendocument:xmlns:datastyle:1.0" 
xmlns:chart="urnasis:names:tcpendocument:xmlns:chart:1.0" 
xmlns:draw="urnasis:names:tcpendocument:xmlns:drawing:1.0" 
xmlns:svg="urnasis:names:tcpendocument:xmlns:svg-compatible:1.0" 
xmlns:style="urnasis:names:tcpendocument:xmlns:style:1.0" 
xmlnsffice="urnasis:names:tcpendocument:xmlnsffice:1.0">
  <xs:import namespace="urnasis:names:tcpendocument:xmlns:chart:1.0" schemaLocation="chart.xsd"/>
  <xs:import namespace="urnasis:names:tcpendocument:xmlns:datastyle:1.0" schemaLocation="number.xsd"/>
  <xs:import namespace="urnasis:names:tcpendocument:xmlns:drawing:1.0" schemaLocation="draw.xsd"/>
  <xs:import namespace="urnasis:names:tcpendocument:xmlns:style:1.0" schemaLocation="style.xsd"/>
  <xs:import namespace="urnasis:names:tcpendocument:xmlns:svg-compatible:1.0" schemaLocation="svg.xsd"/>
  <xs:import namespace="urnasis:names:tcpendocument:xmlns:table:1.0" schemaLocation="content.xsd"/>
  <xs:import namespace="urnasis:names:tcpendocument:xmlns:text:1.0" schemaLocation="text.xsd"/>
  <xs:import namespace="urnasis:names:tcpendocument:xmlns:xsl-fo-compatible:1.0" schemaLocation="fo.xsd"/>
  <xs:element name="document-content">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="office:automatic-styles"/>
        <xs:element ref="office:body"/>
      </xs:sequence>
      <xs:attribute name="version" use="required" form="qualified" type="xs:decimal"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="automatic-styles">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="number:number-style"/>
        <xs:element maxOccurs="unbounded" ref="style:style"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="body">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="office:chart"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="chart">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="chart:chart"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:attribute name="value" type="xs:decimal"/>
  <xs:attribute name="value-type" type="xs:NCName"/>
</xs:schema>

[/XML]


----------



## sdx (6. Aug 2010)

@Sempah danke für den tip, habe ein paar namen geändert und es lässt sich bauen:

und zwar einmal in content.xsd zeile 49 auf chart:chart2

und in chart.xsd zeile 28 auf chart2


----------

