[Tutor] formatting xml (again)
alan.gauld at yahoo.co.uk
Tue Dec 27 19:40:56 EST 2016
On 27/12/16 19:44, richard kappler wrote:
> Using python 2.7 - I have a large log file we recorded of streamed xml data
> that I now need to feed into another app for stress testing. The problem is
> the data comes in 2 formats.
> 1. each 'event' is a full set of xml data with opening and closing tags +
> x02 and x03 (stx and etx)
> 2. some events have all the xml data on one 'line' in the log, others are
> in typical nested xml format with lots of white space and multiple 'lines'
> in the log for each event, the first line of th e 'event' starting with an
> stx and the last line of the 'event' ending in an etx.
It sounds as if an xml parser should work for both. After all
xml doesn't care about layout and whitespace etc.
Which xml parser are you using - I assume you are not trying
to parse it manually using regex or string methjods - that's
rarely a good idea for xml.
Author of the Learn to Program web site
Follow my photo-blog on Flickr at:
More information about the Tutor