Standard way of publishing xml schemas

Say I have an xml schema, defining the namespace: http://foo.com/mySchema . Is there a standard way to publish the schema so that xml instances of the schema will only need to define the namespace and not the xsi:schemaLocation ?

For example, if you look at imdb's sitemap xml: http://www.imdb.com/sitemap_US_index.xml.gz

The xml defines a namespace: http://www.sitemaps.org/schemas/sitemap/0.9 without also defining a schemaLocation.

If you visit this URI, it has 2 xsds there: "siteindex.xsd" and "sitemap.xsd"

My questions are:

  • Is this part of the xml standard? Will every xml parser "know" how to find the schema from the namespace URI?
  • Is there a standalone "xsd repo" tool that helps me to publish xsds under my domain, without the hassle of setting up a web server myself. I'm imagining something with some sort of RESTful API that allows me to PUT new schemas, DELETE existing schemas and of course GET new schemas, using their namespace URI

  • The XML standard does not provide you as the publisher of an XSD with a definitive way to dictate a binding between the XSD's targetNamespace and the location of the XSD.

    There is no general "xsd repo" tool that manages any sort of well-known repository that can help you in this regard. There are, of course, many options these days using cloud-based storage facilities (Google Drive, DropBox, Amazon Cloud Drive, etc) to easily publish any file and make it publicly available via a URL.

    You're on your own regarding where to publish your XSD. Keep in mind that namespace URLs do not have to be retrievable; there is no requirement that an XSD be there. Also keep in mind that the binding between a namespace and the physical location of an XSD is the responsibility of the user, not the XSD publisher. You mention xsi:schemaLocation as one mechanism under the XML document author's control for specifying XSD location; another is XML Catalog.

    链接地址: http://www.djcxy.com/p/65714.html

    上一篇: 命名空间麻烦

    下一篇: 发布xml模式的标准方式