You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by Aaron Mulder <am...@alumni.princeton.edu> on 2003/10/10 04:53:17 UTC

Parallel Extension Question

	I wonder if I can construct something like this in a schema and
get XMLBeans to generate corresponding Java classes:

element "engine"
element "car" contains an "engine"
element "ford-engine" is an extension of "engine"
element "ford" is an restriction of "car" where the "engine" child element 
  must be an instance of "ford-engine"
the "ford*" elements are in a different namespace than the others

so this would be legitimate:

<a:car>
  <a:engine>
</a:car>

and this would be legitimate:

<b:ford>
  <b:ford-engine>
</b:ford>

but this would not:

<b:ford>
  <a:engine>
</b:ford>

	I'm not sure exactly how the "Ford" would be generated into a
JavaBean.  It would extend the "Car" bean.  Perhaps it would override the
"setEngine" method from "Car", but then have an assertion inside that that
"Engine" you passed in was really an "instanceof FordEngine".

	I've tried to construct this in XSD, but I'm stymied by the part
where "ford" restricts "car" to limit the type of engine passed in -- I
keep getting the following message, and it doesn't really give me enough
information to determine whether my syntax is wrong or the whole idea is
wrong or what.  Is this really supposed to be possible?

Thanks,
	Aaron

error: Invalid Restriction.  The derived (restricted) content model must 
match the base content model unless the part of the base content model 
that does not match is optional.  A mismatch found between a base 
<sequence> and a derived <sequence>.  Found derived particles that are not 
matched in the base content model.


- ---------------------------------------------------------------------
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/