Start a new topic
Answered

Uisng less than (<) and greater than (>) signs in an XML configuration

I am getting an error "The character '<' cannot be used in an attribute value" when I use the "<" operator.



Best Answer

In the SystemWeaver Path Language, one can do an expression similar to below, using less than (<), greater than (>), etc.:



However, when adding the same expression to an XML configuration, we get an error:




The reason is because some characters are reserved in XML/HTML, e.g., less than (<) and greater than (>) signs. So when using these reserved signs in an XML configuration, e.g., report, graph, chart, etc., you need to replace them with HTML character entities. Below is a table with three commonly used signs. Find more HTML character entities here https://oinam.github.io/entities/




So, replacing (<) with (&lt;) in the script will resolve the error.


<Report>
<Text>#{? value:=3; value &lt; 2}</Text>
</Report>



Thanks for sharing Bashar!

Answer

In the SystemWeaver Path Language, one can do an expression similar to below, using less than (<), greater than (>), etc.:



However, when adding the same expression to an XML configuration, we get an error:




The reason is because some characters are reserved in XML/HTML, e.g., less than (<) and greater than (>) signs. So when using these reserved signs in an XML configuration, e.g., report, graph, chart, etc., you need to replace them with HTML character entities. Below is a table with three commonly used signs. Find more HTML character entities here https://oinam.github.io/entities/




So, replacing (<) with (&lt;) in the script will resolve the error.


<Report>
<Text>#{? value:=3; value &lt; 2}</Text>
</Report>


Login to post a comment