我一直在通过 xsd 进行 XML 验证,但我还是新手。我尝试验证此 xml,但它向我弹出此错误:cvc-elt.1:找不到元素“客户”的声明。[5]
<?xml version="1.0"?>
<customers xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://w3schools.com requested_customer.xsd">
<customer name="Vladimir Putin" address="St. Petersburg, wadim street 23, Russia"/>
</customers>
和 XSD
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<xs:element name="customers">
<xs:complexType>
<xs:sequence>
<xs:element name="customer">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:string" name="name"/>
<xs:attribute type="xs:string" name="address"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
谢谢你的帮助!