By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,643 Members | 1,320 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,643 IT Pros & Developers. It's quick & easy.

Wrong XML Format, java

P: 12
Hi,

The below is my xml file.I have to parse this file.I'm using SAX parser.While parsing,it throws exception such as: "Wrong Xml Format" for the node <link>..

On the other hand the data of <title> node is not retrieved,it parses empty value.. but if i remove "<![CDATA[>" from the <title> node(or if the value of <title> node is only plain text i.e A Black Dio Scooter on Sale) then the parser successfully parse the value.Same goes with the <description> node.

Can anyone please help me to solve this problem?


<?xml version="1.0" encoding="iso-8859-1"?>
<item>
<title><![CDATA[ A Black Dio Scooter on Sale ]> </title>
<link>http://www.chhito.com/index.php?page=item&id=266</link>
<guid>http://www.chhito.com/index.php?page=item&id=266</guid>
<description>
<![CDATA[
<p>well protected by seat cover,helmet and bike cover also free.</p> <p>lu7pa 5270.</p> <p>well conditioned bike and one hand..</p> <p>around 15,000 km.</p> <p>self start.</p> <p>look like a fresh.</p> <p>No complain at all in the scooter.</p>
]]>
</description>
<pubDate>Tue, 03 Apr 2012 08:56:57 -0600</pubDate>
</item>
Apr 4 '12 #1
Share this Question
Share on Google+
2 Replies


P: 79
in the title tag ending square bracket
Expand|Select|Wrap|Line Numbers
is missing
replace with this

Expand|Select|Wrap|Line Numbers
  1. <title><![CDATA[ A Black Dio Scooter on Sale ]]> </title>
also you need to replace
Expand|Select|Wrap|Line Numbers
  1. &
with
Expand|Select|Wrap|Line Numbers
  1. &amp;
Expand|Select|Wrap|Line Numbers
  1. <link>http://www.chhito.com/index.php?page=item &amp;id=266</link>
  2. <guid>http://www.chhito.com/index.php?page=item &amp;id=266</guid>
Apr 4 '12 #2

P: 12
Thanks for responding so soon
Apr 4 '12 #3

Post your reply

Sign in to post your reply or Sign up for a free account.