Hi Magnus
I think this is a bug.
Your schema imports feature.xsd which
includes (via a long list of dependencies) geometryBasic0d1d.xsd which defines
the LineStringType which is the cause of your first error.
The definition looks like this (where I’ve
removed some annotations for readability):
<complexType name="LineStringType">
<complexContent>
<extension base="gml:AbstractCurveType">
<sequence>
<choice>
<choice minOccurs="2" maxOccurs="unbounded">
<element ref="gml:pos"/>
<element ref="gml:pointProperty"/>
<element ref="gml:pointRep">
</element>
<element ref="gml:coord">
</element>
</choice>
<element ref="gml:posList"/>
<element ref="gml:coordinates">
</element>
</choice>
</sequence>
</extension>
</complexContent>
</complexType>
I think the problem here is that you have
_both_ a choice with minOccurs=”2”
of an element referred to as “gml:pos” _and_ a separate element referred to as “gml:posList”.
Since you can have more than 1 ‘pos’ from the choice, XmlBeans
(under the –javasource 1.5 flag) generates a method that allows you to
get back the list of such ‘pos’s called getPosList(). However there
is also an element at the same level called “posList” so XmlBeans
generates a different method called getPosList() to allow you to get this
single element.
These 2 methods both have no arguments and
hence they clash.
Unfortunately I don’t know of any “proper”
way around this at the moment. You could edit your schema so that one or the
other of the references is renamed – but you may not have control over
the schema. Equally you could edit both the interface and impl files after they
are generated to rename one of the methods. Or you can remove the –javasource
1.5 flag – in which case the generated code no longer has the first of
those generated methods in it and there is no clash. But all of those seem a bit
hacky. Hence I’ve raised a JIRA - http://issues.apache.org/jira/browse/XMLBEANS-225.
Sorry I don’t have better news.
Cheers,
Lawrence
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Magnus
Heino
Sent: Tuesday, November 15, 2005
11:22 PM
To: [email protected]
Subject: scomp problem:
getPosList() is already defined in net.opengis.gml.LineStringType
Hi.
A am trying to compile this schema http://www2.lantmateriet.se/xml/scheman/bryggan/v3.1/g2k_v3.1.xsd
using the xmlbeans 2.1.0 release found here:
http://xmlbeans.apache.org/dist/
But I get these errors. Help please ! :-)
D:\Local\data>scomp -src src -noupa -nopvr -javasource 1.5 -dl g2k.jar
g2k_v3.1.
xsd
Time to build schema type system: 3.156 seconds
Time to generate code: 12.485 seconds
D:\Local\data\src\net\opengis\gml\LineStringType.java:208: getPosList() is
alrea
dy defined in net.opengis.gml.LineStringType
net.opengis.gml.DirectPositionListType getPosList();
^
D:\Local\data\src\net\opengis\gml\LineStringSegmentType.java:162: getPosList()
i
s already defined in net.opengis.gml.LineStringSegmentType
net.opengis.gml.DirectPositionListType getPosList();
^
D:\Local\data\src\net\opengis\gml\impl\LineStringSegmentTypeImpl.java:504:
getPo
sList() is already defined in net.opengis.gml.impl.LineStringSegmentTypeImpl
public net.opengis.gml.DirectPositionListType getPosList()
^
D:\Local\data\src\net\opengis\gml\ArcStringType.java:162: getPosList() is
alread
y defined in net.opengis.gml.ArcStringType
net.opengis.gml.DirectPositionListType getPosList();
^
D:\Local\data\src\net\opengis\gml\impl\ArcStringTypeImpl.java:506: getPosList()
is already defined in net.opengis.gml.impl.ArcStringTypeImpl
public net.opengis.gml.DirectPositionListType getPosList()
^
D:\Local\data\src\net\opengis\gml\ArcStringByBulgeType.java:162: getPosList()
is
already defined in net.opengis.gml.ArcStringByBulgeType
net.opengis.gml.DirectPositionListType getPosList();
^
D:\Local\data\src\net\opengis\gml\impl\ArcStringByBulgeTypeImpl.java:510:
getPos
List() is already defined in net.opengis.gml.impl.ArcStringByBulgeTypeImpl
public net.opengis.gml.DirectPositionListType getPosList()
^
D:\Local\data\src\net\opengis\gml\GeodesicStringType.java:49: getPosList() is
al
ready defined in net.opengis.gml.GeodesicStringType
java.util.List<net.opengis.gml.DirectPositionType>
getPosList();
^
D:\Local\data\src\net\opengis\gml\impl\GeodesicStringTypeImpl.java:109:
getPosLi
st() is already defined in net.opengis.gml.impl.GeodesicStringTypeImpl
public
java.util.List<net.opengis.gml.DirectPositionType> getPosList()
^
D:\Local\data\src\net\opengis\gml\CubicSplineType.java:162: getPosList() is
alre
ady defined in net.opengis.gml.CubicSplineType
net.opengis.gml.DirectPositionListType getPosList();
^
D:\Local\data\src\net\opengis\gml\impl\CubicSplineTypeImpl.java:510:
getPosList(
) is already defined in net.opengis.gml.impl.CubicSplineTypeImpl
public net.opengis.gml.DirectPositionListType getPosList()
^
D:\Local\data\src\net\opengis\gml\BSplineType.java:162: getPosList() is already
defined in net.opengis.gml.BSplineType
net.opengis.gml.DirectPositionListType getPosList();
^
D:\Local\data\src\net\opengis\gml\impl\BSplineTypeImpl.java:512: getPosList()
is
already defined in net.opengis.gml.impl.BSplineTypeImpl
public net.opengis.gml.DirectPositionListType getPosList()
^
D:\Local\data\src\net\opengis\gml\AbstractGriddedSurfaceType.java:165:
getPosLis
t() is already defined in net.opengis.gml.AbstractGriddedSurfaceType.Row
java.util.List<net.opengis.gml.DirectPositionType> getPosList();
^
D:\Local\data\src\net\opengis\gml\impl\AbstractGriddedSurfaceTypeImpl.java:466:
getPosList() is already defined in
net.opengis.gml.impl.AbstractGriddedSurfaceTy
peImpl.RowImpl
public
java.util.List<net.opengis.gml.DirectPositionType> getPosList()
^
D:\Local\data\src\net\opengis\gml\TinType.java:181: getPosList() is already
defi
ned in net.opengis.gml.TinType.ControlPoint
java.util.List<net.opengis.gml.DirectPositionType> getPosList();
^
D:\Local\data\src\net\opengis\gml\impl\TinTypeImpl.java:539: getPosList() is
alr
eady defined in net.opengis.gml.impl.TinTypeImpl.ControlPointImpl
public
java.util.List<net.opengis.gml.DirectPositionType> getPosList()
^
D:\Local\data\src\net\opengis\gml\LinearRingType.java:162: getPosList() is
alrea
dy defined in net.opengis.gml.LinearRingType
net.opengis.gml.DirectPositionListType getPosList();
^
D:\Local\data\src\net\opengis\gml\impl\LinearRingTypeImpl.java:504:
getPosList()
is already defined in net.opengis.gml.impl.LinearRingTypeImpl
public net.opengis.gml.DirectPositionListType getPosList()
^
D:\Local\data\src\net\opengis\gml\impl\LineStringTypeImpl.java:659:
getPosList()
is already defined in net.opengis.gml.impl.LineStringTypeImpl
public net.opengis.gml.DirectPositionListType getPosList()
^
Note: * uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
20 errors
BUILD FAILED
D:\Local\data>
--
/Magnus Heino