You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by Hagen Overdick <ha...@hpi.uni-potsdam.de> on 2004/08/10 12:45:08 UTC

Problems with generated code

<xsd:complexType name="AbstractFoo" abstract="true"  />
<xsd:complexType name="GenericFoo">
	<xsd:complexContent>
		<xsd:extension base="AbstractFoo" />
	</xsd:complexContent>
</xsd:complexType>

<xsd:complexType name="Bar">
	<xsd:sequence>
		<xsd:element name="foo" type="AbstractFoo" maxOccurs="unbounded" />
	</xsd:sequence>
</xsd:complexType>


What I get is:

Bar.insertNewFoo(int pos);

Which will insert a new AbstractFoo before position "pos". That does 
not make sense at all:

- AbstractFoo ist abstract, why can I even create an instance of it?
- Most use cases have a insert after or append, not an insert before
- I want to create GenericFoo not AbstractFoo.

My work around is:

int theSize = bar.sizeOfFooArray();
bar.insertNewFoo(theSize).changeType(GenericFoo.type);
bar.getFooArray(theSize);

Which is ugly at best. I'd like to see a method:

Bar.insertNewFoo(int aPos, SchemaType aType)

that will take a negativ aPos as an append (instead of an 
IndexOutOfBoundException)


What do the others think?


- ---------------------------------------------------------------------
To unsubscribe, e-mail:   xmlbeans-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-user-help@xml.apache.org
Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/