发布XML模式的标准方法 [英] Standard way of publishing xml schemas

查看:78
本文介绍了发布XML模式的标准方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

说我有一个xml架构,定义了命名空间:http://foo.com/mySchema.是否存在发布模式的标准方法,以便模式的xml实例仅需要定义名称空间,而无需定义xsi:schemaLocation?

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?

例如,如果您查看imdb的站点地图xml: http://www.imdb.com /sitemap_US_index.xml.gz

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

该xml定义了一个命名空间: http://www.sitemaps.org/schemas/sitemap/0.9 ,但未定义schemaLocation.

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

如果您访问此URI,则其中有2个xsds:"siteindex.xsd"和"sitemap.xsd"

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

我的问题是:

  1. 这是xml标准的一部分吗?每个XML解析器都会知道"如何从名称空间URI中找到模式吗?
  2. 是否有一个独立的"xsd存储库"工具可以帮助我在自己的域下发布xsds,而无需自己设置Web服务器.我正在想像某种RESTful API,该API允许我使用名称空间URI
  3. PUT新模式,DELETE现有模式,当然还有GET新模式.
  1. Is this part of the xml standard? Will every xml parser "know" how to find the schema from the namespace URI?
  2. 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

推荐答案

XML标准并未为您作为XSD的发布者提供明确的方式来指示XSD的targetNamespace与XSD的位置之间的绑定

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.

没有通用的"xsd存储库"工具可以管理任何可以帮助您解决此问题的知名存储库.当然,如今,有很多选择使用基于云的存储工具(Google Drive,DropBox,Amazon Cloud Drive等)来轻松发布任何文件并使其通过URL公开可用.

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.

您可以自行决定在何处发布XSD.请记住,命名空间URL不必是可检索的;不需要存在XSD.还请记住,名称空间和XSD物理位置之间的绑定是用户的责任,而不是XSD发布者的责任.您提到xsi:schemaLocation是XML文档作者控制下的一种指定XSD位置的机制.另一个是 XML目录.

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.

这篇关于发布XML模式的标准方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆