Skip to main content

generation of Java source based on Microsoft office 2003 xml scema files

7 replies [Last post]
ramazanyich2
Offline
Joined: 2005-09-05

I tried to generate java source files from XML schema of office Spreadsheet ML: http://www.microsoft.com/downloads/details.aspx?FamilyId=FE118952-3547-4...

I used ant script with following task:

But I got errors:
[xjc] [ERROR] Property "FullColumns" is already defined.
[xjc] line 591 of file:/C:/projects/JAXBTest/schema1/excelss.xsd

[xjc] [ERROR] The following location is relevant to the above error
[xjc] line 5042 of file:/C:/projects/JAXBTest/schema1/excel.xsd

[xjc] [ERROR] Property "FullRows" is already defined.
[xjc] line 596 of file:/C:/projects/JAXBTest/schema1/excelss.xsd

[xjc] [ERROR] The following location is relevant to the above error
[xjc] line 5047 of file:/C:/projects/JAXBTest/schema1/excel.xsd

[xjc] [ERROR] Property "DefaultColumnWidth" is already defined.
[xjc] line 556 of file:/C:/projects/JAXBTest/schema1/excelss.xsd

[xjc] [ERROR] The following location is relevant to the above error
[xjc] line 5057 of file:/C:/projects/JAXBTest/schema1/excel.xsd

[xjc] [ERROR] Property "DefaultRowHeight" is already defined.
[xjc] line 561 of file:/C:/projects/JAXBTest/schema1/excelss.xsd

[xjc] [ERROR] The following location is relevant to the above error
[xjc] line 5052 of file:/C:/projects/JAXBTest/schema1/excel.xsd

[xjc] [ERROR] Property "Fill" is already defined.
[xjc] line 374 of file:/C:/projects/JAXBTest/schema1/office.xsd
....

It seems xjc has a problem if schema files contain the same attribute/element names in different schemas.
I tried it with latest weekly build (jaxb-ri-20050905).
Is there a way to workaround that problem ?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
ramazanyich2
Offline
Joined: 2005-09-05

Hi,
I changed namespace prefix. WARNING message disappeared, but original problem still remain.
I still got error:
[xjc] [ERROR] Property "FullColumns" is already defined.
[xjc] line 592 of file:/C:/projects/JAXBTest/schema1/excelss.xsd

sekhar
Offline
Joined: 2003-06-25

It appears that the
customization is not working.

I logged an issue: https://jaxb.dev.java.net/issues/show_bug.cgi?id=93

kohsuke
Offline
Joined: 2003-06-09

What we really need is a smarter content model binding algorithm that can treat (B*,(A,B*)?) or
(A,B?)|B, which are commonly used to work around the limitations of W3C XML Schema.

sekhar
Offline
Joined: 2003-06-25

The errors are caused by name collisions on generated properties i.e. two or more attributes/elements are mapping to generated properties with identical names.

So use the JAXB
customization to give a unique name for a generated property to resolve a name collision. JAXB customization can be used inline in the schema or in an external to a schema in an binding file.

ramazanyich2
Offline
Joined: 2005-09-05

I added jaxb: property to my schema file:



[b]
[/b]

Specifies that the columns in this table should occupy the entire height (all rows) of the worksheet.


(Added whitespace for jaxb: property to avoid smiles in post)
Also added attributes xmlns:jaxb="http://java.sun.com./xml/ns/jaxb" jaxb:version="2.0" to root element,
But now I have following error:

[xjc] [WARNING] No JAXB customization was detected in the schema but the prefix "jaxb" is used for other namespace URIs. If you did intend to use JAXB customization, make sure the namespace URI is "http://java.sun.com/xml/ns/jaxb"
[xjc] line 796 of file:/C:/projects/JAXBTest/schema1/excelss.xsd

And still have the same error about property already defined:
[xjc] [ERROR] Property "FullColumns" is already defined.
[xjc] line 592 of file:/C:/projects/JAXBTest/schema1/excelss.xsd

sekhar
Offline
Joined: 2003-06-25

As a work around try using namespace prefix jxb instead of jaxb.

Can you please log an issue against this in Issue Tracker ?

sekhar
Offline
Joined: 2003-06-25

I logged an issue in the Issue Tracker: https://jaxb.dev.java.net/issues/show_bug.cgi?id=89