Reusing a unique constraint

I have a complexType, "Transaction", which ideally would be reused in
multiple schemas. This may not be possible, though. The Transaction
type has a child sequence of type "PartList". Sometimes the PartList
needs a unique constrain, and sometimes it does not. Since I am
ignorant of any advance feature of XSD that helps me, it seems I have
to define the Transaction type in each of my schemas, and sometimes
it's PartList will have a constraint and sometimes not.

I have a master XSD which defines some basic types and I'm reusing
them in my individual schemas. If I could define two elements of type
PartList in my master schema include, one which is constrained and one
which is not, and reference ("ref") them in my schemas as needed.

I don't mind defining the Transaction or PartList elements in each
schema as long as I can reuse the unique constraint if I need to. In
fact, I think I might always define the Transaction type in each
schema because I want to make certain attributes only appear in
certain transactions. That's basically the same issue as my PartList
issue. Sometimes I want something required, and sometimes I don't, but
it's the same basic Transaction element structure each time

Is there any way to reuse a unique constraint? Is there some other XSD
feature which might help me out?

Is there a way to use a complexType, but then override whether an
attribute is required in specific usages?

Thanks for any info you can provide!

- Todd

Received on Friday, 29 June 2007 18:38:37 UTC