Pramod J George
Pramod J George

Reputation: 1723

Xml parsing terminates

I tried to parse the following xml;

 <coupon>
  <MerchantName>Iwantoneofthose.com</MerchantName>
  <MerchantLink>www.redtagdeals.com/iwantoneofthose-coupons</MerchantLink>
   <Title>£5 Off on Orders £30+</Title>
    <CouponCode>5OFFOCT</CouponCode>
     <CouponLink>
         www.redtagdeals.com/online-coupons.php?coupon=1594262&afsrc=1
        </CouponLink>
        <Expirydate>2012-10-15</Expirydate>
       </coupon>

But the parsing terminates while encounter the character "£".

What will be the issue and how to resolve it.

thanks in advance

Upvotes: 1

Views: 85

Answers (1)

Anil Jadhav
Anil Jadhav

Reputation: 2158

Whenever you want to parse xml having special characters,then you must have to use encoding. i.e. at time of parsing xml instead of normal parsing use encoding as given below,

 InputSource is = new InputSource(url.openStream());
 is.setEncoding("ISO-8859-1");
 Reader.parse(is);

Upvotes: 2

Related Questions