Как работать с МВт представить кормить в C#
Здравствуйте, я пытаюсь загрузить продукт через mws Submitfeed с помощью C# VS2017.
Я столкнулся с этой ошибкой.
Фатальная ошибка синтаксического анализа XML в строке 23, столбец 15: cvc-complex-type.4: атрибут 'unitOfMeasure' должен появиться на элементе 'Length'. cvc-комплексный тип.4: атрибут 'unitOfMeasure' должен появиться на элементе 'Length'
Что я уже пробовал:
XML-канал это:
1 <amazonenvelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 2 3 <documentversion>1.01 4 <merchantidentifier>A22RO79OS4OIEE 5 6 <messagetype>Product 7 <purgeandreplace>false 8 <message> 9 <messageid>1 10 <operationtype>Update 11 <product> 12 <sku>BGS-2111 Black 8oz 13 <standardproductid> 14 <type>EAN 15 <value>8971227095747 16 17 <producttaxcode>A_GEN_NOTAX 18 <descriptiondata> 19 <title>BOXING GLOVES "SUPREME" 20 <brand>Greenhill 21 <description>Product description. 22 <bulletpoint>MADE OF COWHIDE LEATHER 23 <bulletpoint>For Training 24 <msrp currency="EUR">25.19 25 <manufacturer>Greenhill 26 <itemtype>Gloves 27 28 <productdata> 29 <sports> 30 <producttype> 31 <sportsmisc> 32 <value>Gloves 33 <directions>Use Carefully
и код C# это:
{ SubmitFeedRequest request = new SubmitFeedRequest(); request.Merchant = merchantId; request.MWSAuthToken = "amzn.mws.82a5d9b7-0376-ed71-de61-b9ffdae2d926"; // Optional request.MarketplaceIdList = new IdList(); request.MarketplaceIdList.Id = new List<string>(new string[] { marketplaceId }); // MWS exclusively offers a streaming interface for uploading your feeds. This is because // feed sizes can grow to the 1GB+ range - and as your business grows you could otherwise // silently reach the feed size where your in-memory solution will no longer work, leaving you // puzzled as to why a solution that worked for a long time suddenly stopped working though // you made no changes. For the same reason, we strongly encourage you to generate your feeds to // local disk then upload them directly from disk to MWS. request.FeedContent = File.Open("P1.xml", FileMode.Open, FileAccess.Read); //Calculating the MD5 hash value exhausts the stream, and therefore we must either reset the // position, or create another stream for the calculation. request.ContentMD5 = MarketplaceWebServiceClient.CalculateContentMD5(request.FeedContent); request.FeedContent.Position = 0; request.FeedType = "_POST_PRODUCT_DATA_"; SubmitFeedSample.InvokeSubmitFeed(service, request); }
Richard MacCutchan
Ваш XML плохо сформирован, много незамкнутых тегов.