PyCharm complaining about unescaped XML character within <script> tag

My .html file:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "">
<html xmlns="" xmlns="" lang="en">
<script type="application/javascript">
x = 1 < 2; //Error here


PyCharm marks the less than operator as an unescaped XML character.

Assuming that this is my fault, how can I convince PxCharm to NOT show this error?

1 comment

You are using <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" ""> doctype.
This doctype prohibits usage of the unescaped symbols 'less-than' and 'ampersand' according to the spec:
So, PyCharm works as expected. You should change < into &lt; to make document valid.

Or, if you don't care about document validity, you can suppress the inspection: hit Alt+Enter, Right, then choose the desired option ('Disable inspection', 'Suppress for statement', etc.) from the popup


Please sign in to leave a comment.