expat parsing error

John Machin sjmachin at lexicon.net
Tue Jun 1 20:47:25 EDT 2010


On Jun 2, 1:57 am, "kak... at gmail.com" <kak... at gmail.com> wrote:
> On Jun 1, 11:12 am, "kak... at gmail.com" <kak... at gmail.com> wrote:
>
>
>
> > On Jun 1, 11:09 am, John Bokma <j... at castleamber.com> wrote:
>
> > > "kak... at gmail.com" <kak... at gmail.com> writes:
> > > > On Jun 1, 10:34 am, Stefan Behnel <stefan... at behnel.de> wrote:
> > > >> kak... at gmail.com, 01.06.2010 16:00:
>
> > > >> > how can i fix it, how to "ignore" the headers and parse only
> > > >> > the XML?
>
> > > >> Consider reading the answers you got in the last thread that you opened
> > > >> with exactly this question.
>
> > > >> Stefan
>
> > > > That's exactly, what i did but something seems to not working with the
> > > > solutions i had, when i changed my implementation from pure Python's
> > > > sockets to twisted library!
> > > > That's the reason i have created a new post!
> > > > Any ideas why this happened?
>
> > > As I already explained: if you send your headers as well to any XML
> > > parser it will choke on those, because the headers are /not/ valid /
> > > well-formed XML. The solution is to remove the headers from your
> > > data. As I explained before: headers are followed by one empty
> > > line. Just remove lines up and until including the empty line, and pass
> > > the data to any XML parser.
>
> > > --
> > > John Bokma                                                               j3b
>
> > > Hacking & Hiking in Mexico -  http://johnbokma.com/http://castleamber.com/-Perl& Python Development
>
> > Thank you so much i'll try it!
> > Antonis
>
> Dear John can you provide me a simple working solution?
> I don't seem to get it

You're not wrong. Trysomething like this:

rubbish1, rubbish2, xml = your_guff.partition('\n\n')



More information about the Python-list mailing list