timotheus / ebaysdk-python

eBay API SDK for Python
https://developer.ebay.com/tools/sdks
Other
802 stars 320 forks source link

HTML in item description haven't pass #138

Open dmitri-vlasov opened 8 years ago

dmitri-vlasov commented 8 years ago

Hello,

I've tried to use HTML in Description as stated here:

https://github.com/timotheus/ebaysdk-python/issues/110

But none of my attempts were successful. Even the example text of

"Description": "<![CDATA[Since this is a CDATA section I can use all sorts of reserved characters like \" and & or write things like <foo></bar>but my document is still well formed! ]]>",

and the simplest things like:

<div>Some info</div>

generated an error:

2016-02-16 16:51:58,465 ebaysdk [ERROR]:AddFixedPriceItem: Class: RequestError, Severity: Error, Code: 5, XML Parse error. XML Error Text: "; nested exception is: 
    org.xml.sax.SAXParseException: XML document structures must start and end within the same entity."

That's my test info:

<Item><AutoPay>true</AutoPay><CategoryMappingAllowed>true</CategoryMappingAllo
wed><ConditionID>1000</ConditionID><Country>US</Country><Currency>USD</Currency><Description><![CDATA[<div><div class="productDescriptionWrapper">    lithium polymer batteries      <div class="emptyClear"> </div>   </div><div id="featu
re-bullets" class="a-section a-spacing-medium a-spacing-top-small"><ul class="a-vertical a-spacing-none"><li><span class="a-list-item"> Special design,High quality electric cell ! Say goodbye to dead digital devices !</span></li></ul><
/div></div>]]</Description><DispatchTimeMax>2</DispatchTimeMax><ItemSpecifics><Brand>CBD</Brand></ItemSpecifics><ListingDuration>GTC</ListingDuration><ListingType>FixedPriceItem</ListingType><PayPalEmailAddress>wesale999@gmail.com</Pay
PalEmailAddress><PaymentMethods>PayPal</PaymentMethods><PictureDetails><PictureURL>http://ecx.images-amazon.com/images/I/411kCsuhAzL._SY300_QL70_.jpg</PictureURL><PictureURL>http://ecx.images-amazon.com/images/I/51edPXxkCUL._SY300_QL70
_.jpg</PictureURL><PictureURL>http://ecx.images-amazon.com/images/I/41CqCCfkDdL._SY300_QL70_.jpg</PictureURL><PictureURL>http://ecx.images-amazon.com/images/I/41c1ngJUh9L._SY300_QL70_.jpg</PictureURL><PictureURL>http://ecx.images-amazo
n.com/images/I/31c5jJAsPlL._SY300_QL70_.jpg</PictureURL><PictureURL>http://ecx.images-amazon.com/images/I/31t48z2nSZL._SY300_QL70_.jpg</PictureURL><PictureURL>http://ecx.images-amazon.com/images/I/41MJIZM9M5L._SY300_QL70_.jpg</PictureU
RL></PictureDetails><Quantity>0</Quantity><ReturnPolicy><Description>All Returns accepted within 30 days after receiving the item, refund given as money back (no exchanges), return shipping to be paid by buyer.</Description><RefundOpti
on>MoneyBack</RefundOption><ReturnsAcceptedOption>ReturnsAccepted</ReturnsAcceptedOption><ReturnsWithinOption>Days_30</ReturnsWithinOption><ShippingCostPaidByOption>Buyer</ShippingCostPaidByOption></ReturnPolicy><ShippingDetails><Shipp
ingServiceOptions><ShippingServiceCost>0</ShippingServiceCost></ShippingServiceOptions><ShippingType>Flat</ShippingType></ShippingDetails><Site>US</Site><StartPrice>500</StartPrice><Title>AC Adapter/Power Supply Cord for Asus</Title></
Item></AddFixedPriceItemRequest>

How to use it with HTML correctly? Thank you.

hsannaung commented 7 years ago

I have the same issue as well. I pass this and getting 20170, Schema XML request error. Schema XML request error: SimpleDeserializer encountered a child element

itemDetail={ "ErrorLanguage": "en_US", "WarningLevel": "High", "Item": { "Title": "57.123mm Jadeite Jade Bangle", "PrimaryCategory": { "CategoryID": "50637" }, "Description": "

Jade Bangle Descriptiion

", "InventoryTrackingMethod":"SKU", "SKU":"Test0003", "StartPrice": "1000.0", "CategoryMappingAllowed": "true", "ConditionID": "1000", "Country": "SG", "Currency": "USD", "DispatchTimeMax": "1", "ListingDuration": "Days_30", "ListingType": "FixedPriceItem", "PaymentMethods": "PayPal", "PayPalEmailAddress": "xxxxxxx@gmail.com", "PictureDetails": { "GalleryType": "Gallery" }, "PostalCode": "120605", "Location":"Singapore", "ItemSpecifics":{ "NameValueList":{"Brand":"Ultimate Jadeite"}, "NameValueList":{"Metal": "Not Applicable"},

"MainStone": "Jadeite Jade",

    #"Style": "Bangle",
    #"Color": "Green",
    #"MainStoneTreatment": "Not Enhanced",
  },
  #"ProductListingDetails": {},
  "Quantity": "1",
  "ReturnPolicy": {
    "ReturnsAcceptedOption": "ReturnsAccepted",
    "RefundOption": "MoneyBack",
    "ReturnsWithinOption": "Days_14",
    "Description": "If you are not satisfied, return the item for refund.",
    "ShippingCostPaidByOption": "Buyer"
  },
  "ShippingDetails": {
    "ShippingType": "Flat",
    "ShippingServiceOptions": {
      "ShippingServicePriority": "1",
      "ShippingService": "UPSGround",
      "FreeShipping": "true",
      "ShippingServiceAdditionalCost": {
        "-currencyID": "USD",
        "#text": "0.00"
      }
    }
  },
  "Site": "US"
}

}

hsannaung commented 7 years ago

Just found out that the html need to pass with XML escape sequence.. example <b> Item Description </b> ==> "&lt;b&gt; Item Description &lt;/b&gt;"