发布 xml 模式的标准方式
Standard way of publishing xml schemas
假设我有一个 xml
模式,定义命名空间:http://foo.com/mySchema
。是否有发布架构的标准方法,以便架构的 xml 个实例只需要定义命名空间而不是 xsi:schemaLocation
?
例如,如果您查看 imdb 的站点地图 xml:http://www.imdb.com/sitemap_US_index.xml.gz
xml 定义了一个命名空间:http://www.sitemaps.org/schemas/sitemap/0.9 而没有定义 schemaLocation。
如果你访问这个 URI,它有 2 个 xsds:"siteindex.xsd" 和 "sitemap.xsd"
我的问题是:
- 这部分是 xml 标准吗?每个 xml 解析器 "know" 如何从命名空间 URI 中找到模式?
- 是否有独立的 "xsd repo" 工具可以帮助我在我的域下发布 xsds,而无需自己设置 Web 服务器的麻烦。我正在想象某种 RESTful API 允许我
PUT
新模式,DELETE
现有模式,当然还有 GET
新模式,使用他们的命名空间 URI
XML 标准并未为您作为 XSD 的发布者提供明确的方式来规定 XSD 的 targetNamespace
和XSD.
的位置
没有通用的 "xsd repo" 工具可以管理任何类型的知名存储库,可以在这方面为您提供帮助。当然,现在有很多选择使用基于云的存储设施(Google Drive、DropBox、Amazon Cloud Drive 等)来轻松发布任何文件并通过 URL 使其公开可用。
你自己决定在哪里发布你的 XSD。请记住 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
模式,定义命名空间:http://foo.com/mySchema
。是否有发布架构的标准方法,以便架构的 xml 个实例只需要定义命名空间而不是 xsi:schemaLocation
?
例如,如果您查看 imdb 的站点地图 xml:http://www.imdb.com/sitemap_US_index.xml.gz
xml 定义了一个命名空间:http://www.sitemaps.org/schemas/sitemap/0.9 而没有定义 schemaLocation。
如果你访问这个 URI,它有 2 个 xsds:"siteindex.xsd" 和 "sitemap.xsd"
我的问题是:
- 这部分是 xml 标准吗?每个 xml 解析器 "know" 如何从命名空间 URI 中找到模式?
- 是否有独立的 "xsd repo" 工具可以帮助我在我的域下发布 xsds,而无需自己设置 Web 服务器的麻烦。我正在想象某种 RESTful API 允许我
PUT
新模式,DELETE
现有模式,当然还有GET
新模式,使用他们的命名空间URI
XML 标准并未为您作为 XSD 的发布者提供明确的方式来规定 XSD 的 targetNamespace
和XSD.
没有通用的 "xsd repo" 工具可以管理任何类型的知名存储库,可以在这方面为您提供帮助。当然,现在有很多选择使用基于云的存储设施(Google Drive、DropBox、Amazon Cloud Drive 等)来轻松发布任何文件并通过 URL 使其公开可用。
你自己决定在哪里发布你的 XSD。请记住 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。