You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Jeehong Min <je...@parasoft.com> on 2004/03/06 01:31:02 UTC

Correct validation of schema type QName

I am wondering if the Value attribute of StatusCode is valid according to the schema:

instance doc:
 <Response 
          InResponseTo="ID_d03037d8-e25a-44dc-a6c2-5195ee3e8d13" 
          IssueInstant="2004-03-05T15:28:51.490Z" 
          MajorVersion="1" 
          MinorVersion="1" 
          ResponseID="ID_e6e8c8e6-d7a4-42e1-8020-b7825e3752fe" 
          xmlns="urn:oasis:names:tc:SAML:1.0:protocol">
  <Status>
   <StatusCode Value="samlp:Success"/>
  </Status>
...
</Response>

schema:
       <element name="StatusCode" type="samlp:StatusCodeType"/>
       <complexType name="StatusCodeType">
               <sequence>
                       <element ref="samlp:StatusCode" minOccurs="0"/>
               </sequence>
               <attribute name="Value" type="QName" use="required"/>
       </complexType>

Note that attribute Value is of type QName.  Currently, my XML validator (based on Xerces of course) throws an error saying:

- cvc-attribute.3: The value 'samlp:Success' of attribute 'Value' on element 'StatusCode' is not valid with respect to its type.
- UndeclaredPrefix: Cannot resolve 'samlp:Success' as a QName: the prefix 'samlp' is not declared.

Does the QName have to be resolveable in the instance document or does it merely have to be a "valid" QName, where a "valid" QName has a prefix, a local part, and a namespace URI?

Thanks,

Jeehong Min

Re: Correct validation of schema type QName

Posted by Mik Lernout <mi...@futurestreet.org>.
Jeehong Min,

The QName needs to be resolvable in the the instance document. This 
basically means thet you will have to declare the prefix you are using 
in the Value-attribute somewhere in the namespace-context of that 
attribute, for example by doing:

<snip>

     <Response
              InResponseTo="ID_d03037d8-e25a-44dc-a6c2-5195ee3e8d13"
              IssueInstant="2004-03-05T15:28:51.490Z"
              MajorVersion="1"
              MinorVersion="1"
              ResponseID="ID_e6e8c8e6-d7a4-42e1-8020-b7825e3752fe"
              xmlns="urn:oasis:names:tc:SAML:1.0:protocol">
      <Status
    xmlns:samlp="http://www.oasis-open.org/committees/security/docs/draft-sstc-schema-protocol-24.xsd">
       <StatusCode Value="samlp:Success"/>
      </Status>

</snip>

Hope that helps,

Mik

Jeehong Min wrote:

> I am wondering if the Value attribute of StatusCode is valid according 
> to the schema:
>  
> instance doc:
>  <Response
>           InResponseTo="ID_d03037d8-e25a-44dc-a6c2-5195ee3e8d13"
>           IssueInstant="2004-03-05T15:28:51.490Z"
>           MajorVersion="1"
>           MinorVersion="1"
>           ResponseID="ID_e6e8c8e6-d7a4-42e1-8020-b7825e3752fe"
>           xmlns="urn:oasis:names:tc:SAML:1.0:protocol">
>   <Status>
>    <StatusCode Value="samlp:Success"/>
>   </Status>
> ...
> </Response>
>  
> schema:
>        <element name="StatusCode" type="samlp:StatusCodeType"/>
>        <complexType name="StatusCodeType">
>                <sequence>
>                        <element ref="samlp:StatusCode" minOccurs="0"/>
>                </sequence>
>                <attribute name="Value" type="QName" use="required"/>
>        </complexType>
>  
> Note that attribute Value is of type QName.  Currently, my XML 
> validator (based on Xerces of course) throws an error saying:
>  
> - cvc-attribute.3: The value 'samlp:Success' of attribute 'Value' on 
> element 'StatusCode' is not valid with respect to its type.
> - UndeclaredPrefix: Cannot resolve 'samlp:Success' as a QName: the 
> prefix 'samlp' is not declared.
> Does the QName have to be resolveable in the instance document or does 
> it merely have to be a "valid" QName, where a "valid" QName has a 
> prefix, a local part, and a namespace URI?
>  
> Thanks,
>  
> Jeehong Min
>  




---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org