gpt4 book ai didi

验证错误 [IDREF 没有 ID/IDREF 绑定(bind)]

转载 作者:行者123 更新时间:2023-12-01 06:47:14 24 4
gpt4 key购买 nike

根据其架构验证我的 XML 文件时,我收到此错误消息。谁能建议可能出了什么问题? XML 文件是:

<?xml version="1.0"?>
<family-tree xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="ftree.xsd">

<person id="p5">
<name>
<given>Al Frank</given>
<surname>Smith</surname>
</name>
</person>

<person id="p6">
<name>
<given>Henry</given>
<surname>Smith</surname>
</name>
<father ref="p5"/>
</person>

</family-tree>

架构是:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">

<xsd:element name="family-tree">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="person" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>

<xsd:element name="person">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="name" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="father" minOccurs="0"/>
</xsd:sequence>
<xsd:attribute name="id" use="required" type="xsd:ID"/>
</xsd:complexType>
</xsd:element>

<xsd:element name="name">
<xsd:complexType>
<xsd:sequence>
<xsd:element minOccurs="0" name="given"/>
<xsd:element minOccurs="0" name="surname"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>

<xsd:element name="given" type="xsd:string"/>
<xsd:element name="surname" type="xsd:string"/>

<xsd:element name="father">
<xsd:complexType>
<xsd:attribute name="ref" use="required" type="xsd:IDREF"/>
</xsd:complexType>
</xsd:element>

</xsd:schema>

最佳答案

您使用的是哪个 XML 解析器?也许您的解析器不喜欢您的 id 没有在文档中的任何地方引用的事实。但是,我不记得阅读过这样的要求。也许在 XML 声明中添加 Standalone="no"( ) 会有所帮助?

关于验证错误 [IDREF 没有 ID/IDREF 绑定(bind)],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3749441/

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