Developers Program

API Call returns an 'XML Error Text' error

Published: September 06 2006, 4:55:00 PMยทUpdated: July 26 2022, 5:02:03 PM

Products

Question

Question: Why am I getting the following error message when I make an AddItem request when I try to add HTML to my descrption? <Errors> <ShortMessage>XML Parse error. </ShortMessage> <LongMessage>XML Error Text: &quot;; nested exception is: org.xml.sax.SAXParseException: The element type "br" must be terminated by the matching end-tag ...&quot;.</LongMessage> </Errors>

Answer

Answer:
Summary

To add HTML content to your description, you need to wrap it in CDATA so that server does not try to parse the content when the request is received.
Detailed Description

Here is a sample AddItem request that demonstrates how to send in the description:

<?xml version="1.0" encoding="utf-8"?>
<AddItemRequest xmlns="urn:ebay:apis:eBLBaseComponents">
<Version>1123</Version>
<ErrorLanguage>en_US</ErrorLanguage>
<WarningLevel>High</WarningLevel>
<Item>
<Country>US</Country>
<Currency>USD</Currency>
<Description><![CDATA[ your description goes here ....]]></Description>
<ListingDuration>Days_7</ListingDuration>
<PostalCode>San Jose, CA</PostalCode>
<PaymentMethods>PaymentSeeDescription</PaymentMethods>
<PrimaryCategory>
<CategoryID>1463</CategoryID>
</PrimaryCategory>
<Quantity>1</Quantity>
<StartPrice>1.0</StartPrice>
<Title>title</Title>
</Item>
<RequesterCredentials>
<eBayAuthToken>***</eBayAuthToken>
</RequesterCredentials>
</AddItemRequest>
How well did this answer your question?