W3C home > Mailing lists > Public > xmlschema-dev@w3.org > June 2007

Reusing a unique constraint

From: Todd Moon <tmrfcm@gmail.com>
Date: Fri, 29 Jun 2007 14:38:32 -0400
Message-ID: <2dc6e4c80706291138m6dc88d82w1f69f3886cb27428@mail.gmail.com>
To: xmlschema-dev@w3.org

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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:59 GMT