当我尝试验证亚马逊商城网络服务SubmitFeed以完成订单时,我收到以下错误:
xmllint.exe --schema OrderFulfillment.xsd OrderFulfillment.xml
OrderFulfillment.xml:2:element AmazonEnvelope:架构有效性错误:元素 'AmazonEnvelope':没有可用于验证r的匹配全局声明 OOT。 OrderFulfillment.xml无法验证
OrderFulfillment.xml
<?xml version="1.0" encoding="UTF-8"?>
<AmazonEnvelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="amzn-envelope.xsd">
<Header>
<DocumentVersion>1.01</DocumentVersion>
<MerchantIdentifier>AXGZ4X5NTV6SN</MerchantIdentifier>
</Header>
<MessageType>OrderFulfillment</MessageType>
<Message>
<MessageID>1</MessageID>
<OrderFulfillment>
<AmazonOrderID>104-5894782-1841713</AmazonOrderID>
<FulfillmentDate>2012-04-07T15:54:40.154Z</FulfillmentDate>
<FulfillmentData>
<CarrierCode>USPS</CarrierCode>
<ShippingMethod>Priority</ShippingMethod>
<ShipperTrackingNumber>9109901000372243321450</ShipperTrackingNumber>
</FulfillmentData>
</OrderFulfillment>
</Message>
</AmazonEnvelope>
我做错了什么?
答案 0 :(得分:1)
找到解决方案,您必须使用父架构进行验证,在本例中为amzn-envelope.xsd
请参阅How can lxml validate some XML against both an XSD file while also loading an inline schema too?