Tôi muốn xác thực lược đồ bằng cách sử dụng tệp XSD. Khi tôi nhập tệp XSD vào Eclipse, mà không cần chạy lớp xác thực, tôi có lỗi sau:src-resolve: Không thể phân giải tên 'ds: Signature' thành thành phần 'khai báo phần tử'
src-resolve: Cannot resolve the name 'ds:Signature' to an 'element declaration' component
Tôi mới dùng quy trình xác thực XML và XSD. Mặc dù tôi đã tìm kiếm các câu hỏi tương tự trên google, tôi không thể tìm ra điều gì sai ở đây.
Các tập tin XSD là như sau:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xerces="http://xerces.apache.org"
xmlns:xades="http://uri.etsi.org/01903/v1.3.2#" xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
xmlns:abc="http://abc.123.com" targetNamespace="http://abc.123.com"
xmlns:xades141="http://uri.etsi.org/01903/v1.4.1#" elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xs:import namespace="http://uri.etsi.org/01903/v1.3.2#" schemaLocation="XAdES.xsd"/>
<xs:import namespace="http://uri.etsi.org/01903/v1.4.1#" schemaLocation="XAdESv141.xsd"/>
<xs:import namespace="http://www.w3.org/2000/09/xmldsig#" schemaLocation="xmldsig-core-schema.xsd"/>
<xs:complexType name="headerType">
<xs:sequence>
<xs:element name="doorNumber" type="xs:int"/>
<xs:element ref="ds:Signature"/>
</xs:sequence>
</xs:complexType>
Làm thế nào tôi nên sửa đổi XSD để sửa lỗi này?
Um ... Lấy 'ds:' ra khỏi 'ref' hoặc thêm giản đồ cho' ds' khi bạn có 'xs'. (Bạn phải thực sự đọc cả thông báo lỗi và XSD. Ba dòng lên từ phía dưới.) –
có lẽ là phần tử Signature không tồn tại trong lược đồ "xmldsig-core-schema.xsd". chú ý rằng xml phân biệt chữ hoa chữ thường. – Kachna