gpt4 book ai didi

xml - 如何正确引用 georss : point in my xsd?

转载 作者:数据小太阳 更新时间:2023-10-29 02:12:37 25 4
gpt4 key购买 nike

我正在组合一个 XSD 模式来描述现有的 GeoRSS 提要,但我在尝试使用外部 georss.xsd 来验证 georss:point 类型的元素时遇到了麻烦。因此,我已将问题减少到最小的组件:

XML:

<?xml version="1.0" encoding="utf-8"?>
<this>
<apoint>45.256 -71.92</apoint>
</this>

XSD:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:georss="http://www.georss.org/georss">
<xs:import namespace="http://www.georss.org/georss"
schemaLocation="http://georss.org/xml/1.1/georss.xsd"/>
<xs:element name="this">
<xs:complexType>
<xs:sequence>
<xs:element name="apoint" type="georss:point"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

如果我将点类型设为“xs: string”而不是“georss: point”,XML 会很高兴地针对 XSD 进行验证,但是一旦我引用导入的类型 (georss: point),我的 XML 验证器 (Notepad++ | XML 工具)“无法解析模式”。我做错了什么?

最佳答案

在问题的上下文中,您指的是一个不存在的类型。以下是您正在使用的内容:

enter image description here

如果你想要点元素,那么你就引用它(就像你之后所做的那样)。如果你想用你自己的标签重用类型(内容模型),那么你的 apoint 的类型应该是 doubleList

重用类型并不少见,因为它是一种最大限度地“关闭”实例 XML 中不需要的 XML namespace 的方法(请参阅 Venetian blind authoring style)。在您的情况下,您将获得无命名空间的 XML。

关于xml - 如何正确引用 georss : point in my xsd?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12774641/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com