I'm not familiar with some of the modules you have used, so do not have a definitive reply. I was also puzzled why the error message mentions a problem at line 55 in a 35 (or so) line program: did you show us the actual program you ran?
It does sound, though, that this is likely to be a problem with the input data, presumably an unmatched tag. Generally the line number in the error message of parsers represents the latest possible place the error lies--i.e. it may be earlier than the fragment you show. If the error is not obvious by inspection, some XML "well-formedness" checker may show you the problem. Also check against the DTD or XML schema if the XML document has one.