When I was trying to validate my XML files, I found that ">" (greater than symbol) is supported in XML attributes, while "<" (less than symbol) is not.
For example, the following XML element is valid:
<formula expression="a > 0" />
However, the following XML element is invalid:
<formula expression="a < 0" />
The error message says: error on line 1 at column 24: Unescaped '<' not allowed in attributes values
.
I thought that both "<" and ">" needs to be escaped as <
and >
, but it seems that only "<" needs to be escaped. Why is that? Is there a specification for this behavior? Thanks.
Note: I'm using an online XML validator at https://www.w3schools.com/xml/xml_validator.asp.