Thanks for posting this Christopher!
Radu
________________________________
From: Christopher Hunt [mailto:[EMAIL PROTECTED]
Sent: Wednesday, September 03, 2008 11:45 PM
To: [email protected]
Subject: RE: Problem compiling a set of schemas with xmlbeans 2.0.0
Hi there,
I was experiencing the same problem even with the latest GML schemas.
The problem is that GML defines a Pos and a PosList element. xmlbeans
accordingly declares a getPosList() method twice - once for return a list of
pos elements, and the other for returning a single posList element i.e.
/**
* Gets a List of "pos" elements
*/
public java.util.List<net.opengis.gml.x32.DirectPositionType>
getPosList()
and
/**
* Gets the "posList" element
*/
public net.opengis.gml.x32.DirectPositionListType getPosList()
...of course there are two identical method signatures with different
return types. This causes scomp to yield the error:
.../target/generated-sources/net/opengis/gml/x32/impl/LinearRingTypeImpl.java:506:
getPosList() is already defined in net.opengis.gml.x32.impl.LinearRingTypeImpl
public net.opengis.gml.x32.DirectPositionListType getPosList()
To avoid this error you have to tell xmlbeans to override one of the
names. I decided that instead of xmlbeans mapping GML "pos" elements to Java
"pos" members, they map to "position" instead. To achieve this use a command
line similar to the following:
scomp -d target/generated-classes/ -src target/generated-sources/ -dl
-javasource 1.5 -mx 512m src/main/resources/gml.xsd
src/main/resources/gml.xsdconfig
and an xsdconfig of:
<xb:config
xmlns:xb="http://xml.apache.org/xmlbeans/2004/02/xbean/config"
xmlns:gml="http://www.opengis.net/gml/3.2">
<xb:qname name="gml:pos" javaname="Position"/>
</xb:config>
'hope that this helps someone else using xmlbeans with GML.
Cheers,
-C