yigal
yigal

Reputation: 4725

How to locate an XML Schema (XSD) by namespace?

is there any easy and generic way to locate a schema based on namespace?. for example, in the XML below, how do i find the schema for http://schemas.microsoft.com/developer/msbuild/2003 ?

<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

Upvotes: 2

Views: 5494

Answers (2)

kjhughes
kjhughes

Reputation: 111621

Where to look for an XSD given an XML namespace:

  1. Check the location given by any available xsi:schemaLocation hint: xsi:schemaLocation="namespace location".

    In this case, we do not have a schema location hint.

  2. Check the namespace value if in URI form by typing it into a browser.

    In this case, the http://schemas.microsoft.com/developer/msbuild/2003 namespace is in the form of a URI, but there is no XSD at the endpoint:

    The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

  3. Check the URI Resolution entries of any XML Catalogs that are in play.

    In this case, no XML catalogs were mentioned.

  4. Check the XML Standards Library.

    In this case, there's no entry for the sought namespace.

  5. Check Wikipedia's List of XML markup languages and List of XML schemas.

    In this case, there's no entry for the sought namespace.

  6. Check the schema association mechanism of your XML tool. Here are a few:

    In this case, no tool was mentioned, but it is a Microsoft namespace, so if Visual Studio is installed, check the associations listed in the XML Schemas Dialog Box and the local schema cache.

    According to this source, the XSD for the given namespace is msbuild.xsd and can be located in the Visual Studio schema cache. It is the schema for MSBuild make files.

Bottom line: In general, the above procedure should allow you to resolve a namespace to a physical location for an XSD, but beware that the difficulty can vary from simple to impossible.

Upvotes: 6

BadZen
BadZen

Reputation: 4265

There's no mapping between XML namespaces and resource URLs where you can expect to find the schema resources. Namespaces are just that - spaces in which names can be defined so as not to conflict with others.

Upvotes: 1

Related Questions