I know I have done this before, but it isn\'t working today, nor can I find anywhere that explains how to do it. It could be my lack of sleep, but I suspect gremlins.
You don't need to manually associate the files in Visual Studio - it will automatically match an XML file to a XSD file if you have them both open, and you have your namespace defined correctly.
To define the namespace:
In the XML file's root element:
...
In the XSD file's schema element:
...
A note on using Types in your schema when you have a targetNamespace
Because you are specifying a targetNamespace
in your schema, any references to types defined in the schema will need to be prefixed with a namespace (which is why we added the xmlns:this
attribute in the above
element).