leforestier / yattag

Python library to generate HTML or XML in a readable, concise and pythonic way.
328 stars 31 forks source link

indent error for very long string #70

Closed Guang91 closed 2 years ago

Guang91 commented 2 years ago

Hi,

I'm trying to do a "indent(doc.getvalue())" but got an error: Unrecognized XML token near '<!DOCTYPE html><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

leforestier commented 2 years ago

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.

Guang91 commented 2 years ago

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