views:

197

answers:

1

When I open up an xsd file that includes other xsd files, all of the included files are added to a section called "Unauthorized zone". Visual Studio highlights the xs:include element and gives the following error when trying to resolve the schemaLocation attribute:

Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

I've read the following blog post, but I'm not familiar enough with xsd yet to fully understand it.

Can anyone explain why this is happening or point me to a good resource that can help?

[Edit] All of the xsd files that are to be included are in the Visual Studio project.

A: 

Visual Studio caches XSD schemas at %VsInstallDir%\xml\Schemas with Target Namespace attribute (url of schema file) when you add them to your editor.

Blog post says that
The inclusion of Local.xsd in the “Unauthorized Zone” and the warnings in the error pane about not being able to resolve the schema location are an indication to the end user that the schema they were visiting attempted to bring in a schema from a zone that it is not authorized to access.

Reason the IO Permission error shows itself is your machine has no authority to download external xsd file(s) from the location.So there is no cache that Visual Studio might validate your other xsd files.

You should check your networking options so you may download those xsd files.While you can it means you have access to that location,so Visual Studio can cache them.If you're sure that you have access,you may also download those xsd files and put them Visual Studio's default schema location and indeed add them in editor.

Also check about cache here

Hope this helps
Myra

Myra
Thank you for answering. I was under the impression that that folder was for xsd files for consumption by Visual Studio. This line would seem to suggest that:Because the schema cache directory is global to your computer, you should only add schemas here that are standard and useful to all the Visual Studio projects that may be created on your computer.Is this not correct?
starskythehutch
Correct,You can add local or external schemas as long as you have xsd files.
Myra
Thank you Myra. I used your information in conjunction with this link http://msdn.microsoft.com/en-us/library/ms255816.aspx and succeeded.
starskythehutch