Re: xsd

Hi Kevin,

> I tried to validate the an XSD, using on on-line xml validator
> (http://apps.gotdotnet.com/xmltools/xsdvalidator/Default.aspx) but
> returned following error:
>
> Validation error:
>
> Cannot resolve schemaLocation attribute. An error
> occurred at , (3, 4).

This error is telling you that the validator couldn't use a
schemaLocation attribute to identify a schema that it should use. This
could be a problem with the xsi:schemaLocation attribute in your
instance document, but I think it's probably talking about the fact
that where you import a schema for the
'http://www.w3.org/2000/09/xmldsig#' namespace, you don't supply a
schemaLocation attribute so it doesn't know where to find the schema
for that namespace.

> The 'http://www.w3.org/2000/09/xmldsig#:Signature' element is not
> declared. An error occurred at , (69, 10).

This arises because the validator couldn't find a schema for the
'http://www.w3.org/2000/09/xmldsig#' namespace. Without a schema,
there aren't any element declarations, so it can't find the element
declaration for the <Signature> element in that namespace that you
refer to in your schema.

The solutions are to either:

1. put a schemaLocation attribute on the <xs:import> element to point
the validator to the location of a schema for that namespace: there's
one at http://www.w3.org/TR/xmlndsig-core/xmldsig-core-schema.xsd that
you could use:

<xs:import namespace="http://www.w3.org/2000/09/xmldsig#"
  schemaLocation="http://www.w3.org/TR/xmlndsig-core/xmldsig-core-schema.xsd"/>

2. use a wildcard that allows any element in the
'http://www.w3.org/2000/09/xmldsig#' namespace rather than a pointer
to the particular <Signature> element:

  <xs:any namespace="http://www.w3.org/2000/09/xmldsig#" />

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/

Received on Thursday, 10 July 2003 04:35:32 UTC