Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^2: XML Parser not well-formed

by existem (Sexton)
on Nov 02, 2004 at 17:34 UTC ( [id://404684]=note: print w/replies, xml ) Need Help??


in reply to Re: XML Parser not well-formed
in thread XML Parser not well-formed

Thanks for the reply.

Interesting the XML does claim to be UTF-8, here is the first element in the file.

<?xml version="1.0" encoding="UTF-8"?> <OFFERS> <OFFER> <OUR_ID>2752</OUR_ID> <FTA>PTHREE81200013</FTA> <MERCHANTCATEGORY>LG</MERCHANTCATEGORY> <NAME>LG U8120</NAME> <BRAND>LG</BRAND> <MODEL>U8120</MODEL> <PROMOTIONTEXT>Only 15.00 Per Month!</PROMOTIONTEXT> <DESCRIPTION>This latest video phone has stylish looks, rotating video + camera and photo address book. With a range of revolutionary feature +s, the LG 8120 is &lt;b&gt; 'the'&lt;/b&gt; video mobile to be seen w +ith.</DESCRIPTION> <NETWORK>Three</NETWORK> <RENTAL>15.00</RENTAL> <FREE_OFF_PEAK_MINS>0</FREE_OFF_PEAK_MINS> <FREE_CN_MINS>500</FREE_CN_MINS> <FREE_ANYTIME_MINS>0</FREE_ANYTIME_MINS> <FREE_SMS>100</FREE_SMS> <TAR>Talk &amp; Text 600 Special</TAR> <ADDINFO> FREE Promo 12 Months Half Price Line Rental, 3 Months FREE i +nsurance and <b>12 Months Reduced Line Rental - Only GBP15 Per Month< +/b> </ADDINFO> <DEEPLINK>http://www3.fonetasticmobile.co.uk/1/showphones.php?item=275 +2</DEEPLINK> <SMALLIMAGE>http://www3.fonetasticmobile.co.uk/img/phones/bestdeal_u81 +20.jpg</SMALLIMAGE> <BIGIMAGE>http://www3.fonetasticmobile.co.uk/img/phones/big_u8120.jpg< +/BIGIMAGE> <PRICE>0</PRICE> </OFFER> </OFFERS>

I suspect the feed is just not as good as it should be.

I have actually got around the problem by processing the file manually beforing loading it up with XML::Parser, and removing the dodgy characters.

Thanks,
Tom.

Replies are listed 'Best First'.
Re^3: XML Parser not well-formed
by mirod (Canon) on Nov 02, 2004 at 17:45 UTC
    I have actually got around the problem by processing the file manually beforing loading it up with XML::Parser, and removing the dodgy characters.

    That's one way to do it. You could probably figure out in which encoding they are and replace them by the proper utf-8 character. My guess is that some of the text , like the DESCRIPTION is entered through either a web form or word processor, it shoul be possible to find out what encoding is used.

      That character is 0x92, UTF-8 only maps up to 0x7F as a single byte. If the document is representing that character with just one byte then its not UTF-8 and a broken XML instance. That character is represented with 2 bytes in UTF-8.

      Whenever I get confused about UTF-8 I use this reference;

      http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://404684]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2024-04-25 18:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found