ThatGuyInIT
ThatGuyInIT

Reputation: 2239

why does xmllint return this as invalid

When I try to validate an Amazon Marketplace Web Service SubmitFeed for order fulfillment I get the following error:

xmllint.exe --schema OrderFulfillment.xsd OrderFulfillment.xml

OrderFulfillment.xml:2: element AmazonEnvelope: Schemas validity error : Element 'AmazonEnvelope': No matching global declaration available for the validation r oot. OrderFulfillment.xml fails to validate

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>

What am I doing wrong?

Upvotes: 1

Views: 1142

Answers (1)

ThatGuyInIT
ThatGuyInIT

Reputation: 2239

Found the solution, you have to validate with the parent schema, in this case amzn-envelope.xsd

See How can lxml validate some XML against both an XSD file while also loading an inline schema too?

Upvotes: 1

Related Questions