leforestier / yattag

Python library to generate HTML or XML in a readable, concise and pythonic way.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

indent error for very long string

Guang91 opened this issue · comments

commented

Hi,

I'm trying to do a "indent(doc.getvalue())" but got an error:
Unrecognized XML token near '<meta http-equiv="content-type" content="text/html; charset=utf'
I realized this is caused by the length of doc.getvalue(). For shorter strings, the error doesn't occur.

Thanks,
Guang

Hi Guang,
can you make a small example where indent raises that exception and post it here? If your HTML string is too long to post here, I suggest you post the python code that generated it rather than the HTML itself.
Thanks.

commented

Thanks for the quick reply.
After some tests, I realized that's not related to the length of the string. It's just because the html has some text of "1.0 < z < 2.2", that indent doesn't know how to interpret. After removing this text (which is okay for me), it runs through.

Thank you,
Guang