Re: question on important and restriction

"Joseph M. Reagle Jr." <reagle@w3.org> writes:

> Can someone give me a hint as to what exactly I'm doing wrong, or how I
> might better achieve what I'm trying to do: create a xenc:CipherReference
> akin to a ds:Reference but I don't need ds:DigestMethod, ds:DigestValue,
> nor the ds:Type attribute
> 
> http://policy.w3.org/01-17-xmlenc-schema.xsd
> 
> <EncryptedData xmlns="http://www.w3.org/2001/02/xmlenc#">
>   <EncryptionMethod Algorithm="foo"/>
>   <EncryptedKey NameKey="Joe">
>     <EncryptionMethod Algorithm="foo"/>
>     <CipherData>123</CipherData>
>   </EncryptedKey>
>   <CipherReference URI="http://example.com/foo">
>     <Transforms>
>        <Transform Algorithm="http://www.exmple.org/base64"/>
>     </Transforms>
>   </CipherReference>
> </EncryptedData>
> 
> ...
> <invalid char='8' code='cvc-complex-type.1.2.4' line='9'
> resource='file:/d:/2tmp
> /test.xml'>element {http://www.w3.org/2001/02/xmlenc#}:Transform not
> allowed her
> e in element {http://www.w3.org/2001/02/xmlenc#}:Transforms:
> <fsm>

First, note what the error message actually says -- you've got a
Transform where you shouldn't, not a Transforms.  This is a clue to
what's really wrong -- your namespaces are all **$#ed up.  XSV is
letting you down because it doesn't check restrictions -- your
CypherReferenceType is completely bogus, because it tries to rename
elements (e.g. from ds:Transforms to xenc:Transforms) as well as
restricting them.

Second, you don't need to close down occurrences to 0 for elements to
get rid of them, or repeat attributes to retain them -- the following
would have achieved the same (still unsatisfactory) result:

 <complexType name="CipherReferenceType">
  <complexContent>
   <restriction base="ds:ReferenceType">
    <sequence>
     <element name="Transforms" type="ds:TransformsType" minOccurs="0" maxOccurs="1" /> 
    </sequence>
   </restriction>
  </complexContent>
 </complexType>

But note this is bogus in another way -- DigestMethod and DigestValue
are not optional in ds:ReferenceType, so you can't restrict them away
in any case.

Sorry, I don't see any way to get where you're going, other than
define a CipherReferenceType as a new type which simply uses

  <element ref="ds:Transforms"/>

and then be sure to put

  <Transforms xmlns="http://www.w3.org/2000/09/xmldsig#">...</Transforms>

in your instance.
-- 
  Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
          W3C Fellow 1999--2001, part-time member of W3C Team
     2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
	    Fax: (44) 131 650-4587, e-mail: ht@cogsci.ed.ac.uk
		     URL: http://www.ltg.ed.ac.uk/~ht/

Received on Sunday, 18 February 2001 05:42:52 UTC