XML Schema Validation : Cannot find the declaration of element

前端 未结 3 619
野的像风
野的像风 2020-12-08 20:04

I am still a bit new to XML Schema etc. and have been working to develop some XML, Schema and a Stylesheet (XSLT). I have made reasonable progress, but then realized that my

3条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-08 20:38

    cvc-elt.1: Cannot find the declaration of element 'Root'. [7]

    Your schemaLocation attribute on the root element should be xsi:schemaLocation, and you need to fix it to use the right namespace.

    You should probably change the targetNamespace of the schema and the xmlns of the document to http://myNameSpace.com (since namespaces are supposed to be valid URIs, which Test.Namespace isn't, though urn:Test.Namespace would be ok). Once you do that it should find the schema. The point is that all three of the schema's target namespace, the document's namespace, and the namespace for which you're giving the schema location must be the same.

    (though it still won't validate as your contains an in the document where the schema expects item)

提交回复
热议问题