Problems with Microsft's new Office 'XML'by graq (Curate)
|on Oct 04, 2005 at 16:57 UTC||Need Help??|
graq has asked for the
wisdom of the Perl Monks concerning the following question:
I am having problems parsing an 'XML' file.
Microsoft is moving it's Office software over to using XML, so they are now producing "Microsoft Excel XML spreadsheets" - and this is what I have to work on.
I have tried XML::Parser but it bombs out horribly. I have double checked the file, getting a colleague to download it onto the local server, but it still appears full of 'padding' at the end of the file. The error is: not well-formed (invalid token) at line 1, column 181703, byte 181705 at PATH/XML/Parser.pm line 187
I toyed with merlyn's idea of using HTML::Parser, but the XML structure is too flat - the state just always being "Workbook Worksheet Table Row Cell Data", so I unable to identify the data.
Does anyone know of any other tools, or have any ideas on how to deal with this? Getting rid of the 'padding' seems tricky to me as it's a load of gibberish - but so is Microsoft's 'XML'.
(Apologies for not being able to supply the data - the only file I have is company sensitive)
Sample code piece 1:
Sample code piece 2 (lifted from Merlyn's site):