- From: Joseph Reagle <reagle@w3.org>
- Date: Wed, 28 Nov 2001 17:13:04 -0500
- To: xmlschema-dev@w3.org, henry@w3.org
- Cc: xenc <xml-encryption@w3.org>
How do I extend descendents of a complex type?
I have an abstract type EncryptedType which relies upon a definition of a
CipherDataType.
<complexType name='EncryptedType' abstract='true'>
<sequence>
<element ref='xenc:CipherData'/>
<element ... />
</sequence>
</complexType>
<element name='CipherData' type='xenc:CipherDataType'/>
<complexType name='CipherDataType'>
<choice>
<element name='CipherValue' type='base64Binary'/>
<element ref='xenc:CipherReference'/>
</choice>
</complexType>
From this abstract type, I derive two related but slightly different
complexTypes.
One of the derived types, EncrypteKeyType is a straightfoward extension,
I'm adding children and attributes to the EncryptedType. *However*, the
other type is tricky. EncryptedDataType needs nothing more complex than an
Nonce attribute added to its CipherData. Simple requirement, but complex in
practice I'm finding.
Can I do this sort of overload and nesting, or do I need to do something
else, and what is recommended?
<element name='EncryptedData' type='xenc:EncryptedDataType'/>
<complexType name='EncryptedDataType'>
<complexContent>
<extension base='xenc:EncryptedType'>
<sequence>
<element name='CipherData'>
<complexType>
<complexContent>
<extension base='xenc:CipherDataType'>
<attribute name='Nonce' type='integer' use='optional'/>
</extension>
</complexContent>
</complexType>
</sequence>
</extension>
</complexContent>
</complexType>
If I can't do something like this, I expect I need to make CipherDataType
and abstract type as well, and then each derivation of EncryptedType will
also use a derivation of CipherDataType... Does that sound right? Any
better ideas?
--
Joseph Reagle Jr. http://www.w3.org/People/Reagle/
W3C Policy Analyst mailto:reagle@w3.org
IETF/W3C XML-Signature Co-Chair http://www.w3.org/Signature/
W3C XML Encryption Chair http://www.w3.org/Encryption/2001/
Received on Wednesday, 28 November 2001 17:13:07 UTC