Reputation: 4725
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
Reputation: 111621
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.
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.
Check the URI Resolution entries of any XML Catalogs that are in play.
In this case, no XML catalogs were mentioned.
Check the XML Standards Library.
In this case, there's no entry for the sought namespace.
Check Wikipedia's List of XML markup languages and List of XML schemas.
In this case, there's no entry for the sought namespace.
Check the schema association mechanism of your XML tool. Here are a few:
XML Spy: Check the DTD/Schema > Assign Schema...
menu command or their XML catalog mechanism.
Oxygen XML Editor: Check the Document > Schema > Associate schema...
menu command or their XML catalog mechanism
Visual Studio 2013: Check the XML editor's local schema cache in
the %InstallDir%\Xml\Schemas
directory. The XML editor lets XSDs be associated with
XML document instances via the XML Schemas Dialog Box.
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
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