KeyInfo: sequence or choice

As already mentioned, the definition of ds:KeyInfo uses a (1,unbounded) 
choices over mandatory elements to emulate an unordered set of optional 
elements. On hindsight this appears to be a bad choice for a couple reasons. 
First, it can make derivations difficult as the optionality can not be 
easily constrained since it is "simulated." Second, I thought an unordered 
list was preferable but now it seems preferable to know when you are going 
to see these elements (e.g., what's the point of having these things in a 
random order, particularly elements from an external namespace). Third, with 
our present approach of using choice, I can't think of a way to constrain 
KeyValue to occurring once. (See examples below of how this can be 
expressed). The only down side is that this sort of structure permits and 
empty KeyInfo, which Merlin just suggested a fix for given use of "choice."

Any thoughts?


<element name="KeyInfo" type="ds:KeyInfoType"/>
<complexType name="KeyInfoType" mixed="true">
     <element ref="ds:KeyName" minOccurs="0" maxOccurs="unbounded"/>
     <element ref="ds:KeyValue" minOccurs="0" maxOccurs="1"/>
     <element ref="ds:RetrievalMethod" minOccurs="0" maxOccurs="unbounded"/>
     <element ref="ds:MgmtData" minOccurs="0" maxOccurs="unbounded"/>
     <element ref="ds:PGPData" minOccurs="0" maxOccurs="unbounded"/>
     <element ref="ds:SPKIData" minOccurs="0" maxOccurs="unbounded"/>
     <element ref="ds:X509Data" minOccurs="0" maxOccurs="unbounded"/>
     <any processContents="lax" namespace="##other" minOccurs="0" 
     <!-- (0,unbounded) elements from (0,unbounded) namespaces -->
   <attribute name="Id" type="ID" use="optional"/>

    <!ELEMENT KeyInfo	(#PCDATA|KeyName*|KeyValue?|RetrievalMethod*|
                X509Data*|PGPData*|SPKIData*|MgmtData* %KeyInfo.ANY;) >
    <!ATTLIST KeyInfo
    	Id	ID	#IMPLIED >


Joseph Reagle Jr.       
W3C Policy Analyst      
IETF/W3C XML-Signature Co-Chair
W3C XML Encryption Chair

Received on Wednesday, 7 March 2001 15:21:14 UTC