gpt4 book ai didi

xml - 源解析.4.2 : Error Resolving Component 'ds:Signature'

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

我正在验证来自 xsd 的 XML,但当我说它必须验证签名标签时出现错误

这是 XML:

<?xml version="1.0" encoding="UTF-8"?>
<ValidaLinea>
<cveBanco>40058</cveBanco>
<importe>0</importe>
<fechaHoraEnvio>2002-05-30T09:00:00</fechaHoraEnvio>
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">...
</Signature>
</ValidaLinea>

这是XSD

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
>
<xs:complexType name="ValidaLinea">
<xs:sequence>
<xs:element name="cveBanco">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="[0-9]{5}" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="importe">
<xs:simpleType>
<xs:restriction base="xs:long">
<xs:totalDigits value="14" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="fechaHoraEnvio">
<xs:simpleType>
<xs:restriction base="xs:dateTime">
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Signature" type="ds:Signature"/>
</xs:sequence>
</xs:complexType>
<xs:element name="ValidaLinea" type="ValidaLinea"/>
</xs:schema>

当我尝试进行验证时显示的错误如下:

Src-resolve.4.2: Error Resolving Component 'ds:Signature'.
It Was Detected That 'ds:Signature' Is In Namespace 'http://www.w3.org/2000/09/xmldsig#',
But Components From This Namespace Are Not Referenceable From Schema Document 'null'.

最佳答案

可能为时已晚,但是您错过了 XSD 的导入

<xs:import namespace="http://www.w3.org/2000/09/xmldsig#"
schemaLocation="http://www.w3.org/TR/2002/REC-xmldsig-core-20020212/xmldsig-core-schema.xsd"/>

关于xml - 源解析.4.2 : Error Resolving Component 'ds:Signature' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53109179/

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