Chris Wenham
Chris Wenham

Reputation: 24017

Including WPF's namespace in an XSD

We have a custom XML schema that can contain chunks of XAML for defining WPF DataTemplates. I used Visual Studio 2010's "Create Schema" command to generate an XSD based on a sample document that uses our schema.

One of the first lines in the generated schema was this:

<xs:import namespace="http://schemas.microsoft.com/winfx/2006/xaml/presentation"/>

However, Visual Studio generates this warning for the line:

"Imported schema for namespace 'http://schemas.microsoft.com/winfx/2006/xaml/presentation' was not resolved"

Does it need an XSD for Microsoft's presentation schema to work? If so, is there anywhere I can download WPF's XSD (I haven't found one with Google, yet). Is there another way around this?

Upvotes: 1

Views: 351

Answers (1)

dima
dima

Reputation: 11

If you use xs:import, and want to use that schema for validation, you will have to provide that (XAML) schema. This can be done in different ways: place file in a known folder, use URL, or load schemas one by one into .NET schema set.
Another option is to use xs:any to declare your chunks of XAML, then you will have option to validate it against XAML schema or not.

Upvotes: 1

Related Questions