Hi David,
I am trying to create a XML file that can be parsed by MagicParser, but whatever I try, it can't be parsed.
Below is the XML I try to use:
<?xml version="1.0" encoding="iso-8859-1"?>
<!--Generated on 2008/08/11 (http://www.bijnavakantie.nl)-->
<products>
<product>
<place>1</place>
<name>Appartementen Dosjoimi, Costa Brava</name>
<price>279,- p.p. | 4 personen | 8 dagen</price>
<productURL>http://zomer.bizztravel.nl/tradetracker/?tt=216_0_16631_&r=%2Fvakantie%2Fspanje%2Fcosta-brava%2Flloret-de-mar%2Fappartementen-dosjoimi.html</productURL>
<imageURL>http://images.bizztravel.nl/pics/1203343612.jpg</imageURL>
<date>20 september 2008</date>
</product>
<product>
<place>2</place>
<name>Appartementen Dosjoimi, Costa Brava</name>
<price>279,- p.p. | 4 personen | 8 dagen</price>
<productURL>http://zomer.bizztravel.nl/tradetracker/?tt=216_0_16631_&r=%2Fvakantie%2Fspanje%2Fcosta-brava%2Flloret-de-mar%2Fappartementen-dosjoimi.html</productURL>
<imageURL>http://images.bizztravel.nl/pics/1203343612.jpg</imageURL>
<date>20 september 2008</date>
</product>
</products>
I'm sure something is wrong with this XML, but I can't figure what it is.
Can you help me?
Thanks!
/Jasper
Hello Jasper,
The XML is not valid because of the "&" character in each of the productURL fields.
There are 2 ways to deal with this.
The first option is to use the XML Entity for "&" which is "&". This would make your productURL fields something like:
<productURL>http://zomer.bizztravel.nl/tradetracker/?tt=216_0_16631_&r=%2Fvakantie%2Fspanje%2Fcosta-brava%2Flloret-de-mar%2Fappartementen-dosjoimi.html</productURL>
The second option is to wrap the field in CDATA tags, which informs XML that all it is all literal data:
<productURL><![CDATA[http://zomer.bizztravel.nl/tradetracker/?tt=216_0_16631_&r=%2Fvakantie%2Fspanje%2Fcosta-brava%2Flloret-de-mar%2Fappartementen-dosjoimi.html]]></productURL>
Hope this helps!
Regards,
David.