上传亚马逊产品变体

时间:2017-01-24 14:56:30

标签: xml amazon-web-services amazon amazon-mws

我正在尝试使用亚马逊MWS上传产品。我的代码如下:

<Message>
    <MessageID>3933</MessageID>
    <OperationType>PartialUpdate</OperationType>
    <Product>
        <SKU>EL01080-CC</SKU> 
        <StandardProductID>
            <Type>EAN</Type>
            <Value>8435405918599</Value>
        </StandardProductID>          
        <Condition>
            <ConditionType>New</ConditionType>
        </Condition>
        <DescriptionData>
            <Title><![CDATA[Power Hair X5 Maquillaje capilar indetectable para calvicie. Bote de 25g , color castaño claro]]></Title> 
            <Brand><![CDATA[PowerHair]]></Brand> 
            <Description><![CDATA[Gama de colores...]]></Description> 
            <Manufacturer><![CDATA[PowerHair]]></Manufacturer>
            <MfrPartNumber><![CDATA[EL01080-CC]]></MfrPartNumber>
            <RecommendedBrowseNode>2928542031</RecommendedBrowseNode>
        </DescriptionData>
        <ProductData><Home>
                <Parentage>child</Parentage>
                <VariationData>
                    <VariationTheme>Size-Color</VariationTheme>
                </VariationData>
                <Size>Medium</Size>
                <Color>Dark Grey Melange</Color>
            </Home></ProductData>
    </Product>
</Message>

我收到以下错误:

XML Parsing Error at Line 145520, Column 11: cvc-complex-type.2.4.a: Invalid content was found starting with element &"Size&". One of &"{BatteryDescription, CanShipInOriginalContainer, CountryAsLabeled, CountryOfOrigin, CountryProducedIn, ImportDesignation, FurDescription, IdentityPackageType, IncludedComponents, FabricType, PatternName, SeatHeight, SpecialFeatures, StyleName, Occasion, MatteStyle, DisplayLength, DisplayWidth, DisplayHeight, DisplayDepth, DisplayDiameter, DisplayVolume, DisplayWeight, ItemPackageQuantity, ManufacturerWarrantyDescription, Volume, VolumeCapacity, Material, ThreadCount, NumberOfPieces, SafetyWarning, AwardsWon, BatteryAverageLife, BatteryAverageLifeStandby, BatteryChargeTime, BatteryTypeLithiumIon, BatteryTypeLithiumMetal, LithiumBatteryEnergyContent, LithiumBatteryPackaging, LithiumBatteryVoltage, LithiumBatteryWeight, MfgWarrantyDescriptionLabor, MfgWarrantyDescriptionParts, MfgWarrantyDescriptionType, NumberOfItemsInPackage, NumberOfLithiumIonCells, NumberOfLithiumMetalCells, PowerSourceType, RegionOfOrigin, SellerWarrantyDescription, SizeMap, Warnings, Wattage, Length, Width, Height, Depth, Diameter, Weight, Spread, SunlightExposure, MoistureNeeds, USDAHardinessZone, SunsetClimateZone, NumberOfSets}&" is expected.

如果我删除ProducData标签,我可以上传它没有问题。如何使用此变体上传它?我找不到任何适当的文件说明如何做到这一点。我在尺寸和颜色标签方面遇到问题。

1 个答案:

答案 0 :(得分:3)

您的XML无法验证。 <Size><Color>代码需要嵌套在<VariationData>中。以下是XML的副本,其中添加了<AmazonEnvelope>,其他标题数据以及提到的标记已移动:

<AmazonEnvelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="amzn-envelope.xsd">
    <Header>
        <DocumentVersion>1.01</DocumentVersion>
        <MerchantIdentifier>YOURMERCHANTIDENTIFIER</MerchantIdentifier>
    </Header>
    <MessageType>Product</MessageType>
    <PurgeAndReplace>false</PurgeAndReplace>
    <Message>
        <MessageID>3933</MessageID>
        <OperationType>PartialUpdate</OperationType>
        <Product>
            <SKU>EL01080-CC</SKU> 
            <StandardProductID>
                <Type>EAN</Type>
                <Value>8435405918599</Value>
            </StandardProductID>          
            <Condition>
                <ConditionType>New</ConditionType>
            </Condition>
            <DescriptionData>
                <Title><![CDATA[Power Hair X5 Maquillaje capilar indetectable para calvicie. Bote de 25g , color castaño claro]]></Title> 
                <Brand><![CDATA[PowerHair]]></Brand> 
                <Description><![CDATA[Gama de colores...]]></Description> 
                <Manufacturer><![CDATA[PowerHair]]></Manufacturer>
                <MfrPartNumber><![CDATA[EL01080-CC]]></MfrPartNumber>
                <RecommendedBrowseNode>2928542031</RecommendedBrowseNode>
            </DescriptionData>
            <ProductData>
                <Home>
                    <Parentage>child</Parentage>
                    <VariationData>
                        <VariationTheme>Size-Color</VariationTheme>
                        <Size>Medium</Size>
                        <Color>Dark Grey Melange</Color>
                    </VariationData>
                </Home>
            </ProductData>
        </Product>
    </Message>
</AmazonEnvelope>

此修改后的XML文件将根据XSD架构进行验证。