【发布时间】:2018-04-26 07:16:58
【问题描述】:
我有一个格式如下的 XML 文件:
<information xmlns:xlink="http://www.w3.org/1999/xlink">
<fact>
<header>some text</header>
<text>some text</text>
</fact>
<information>
我想知道是否有人可以帮助我创建一个 XML 模式文件?我目前有以下内容:
<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="information">
<xs:complexType>
<xs:sequence>
<xs:element name="fact">
<xs:complexType>
<xs:sequence>
<xs:element name="heading" type="xs:string"/>
<xs:element name="description" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
但是,当输入验证器时,会出现以下错误:
无效。 错误 - 第 12、9 行:org.xml.sax.SAXParseException;行号:12;列号:9; cvc-complex-type.2.4.d:发现以元素“事实”开头的无效内容。此时不需要子元素。
谢谢。
【问题讨论】: