Help parsing a text file
William Gill
nospam at domain.invalid
Thu Sep 1 14:38:09 EDT 2011
On 9/1/2011 1:58 PM, JT wrote:
> On Monday, August 29, 2011 1:21:48 PM UTC-5, William Gill wrote:
>>
>> I have a text file with XML like records that I need to parse. By XML
>> like I mean records have proper opening and closing tags. but fields
>> don't have closing tags (they rely on line ends). Not all fields appear
>> in all records, but they do adhere to a defined sequence.
>
> lxml can parse XML and broken HTML (see http://lxml.de/parsing.html).
>
> - James
>
Thanks to everyone.
Though I didn't get what I expected, it made me think more about the
reason I need to parse these files to begin with. So I'm going to do
some more homework on the overall business application and work backward
from there. Once I know how the data fits in the scheme of things, I
will create an appropriate abstraction layer, either from scratch, or
using one of the existing parsers mentioned, but I won't really know
that until I have finished modeling.
More information about the Python-list
mailing list