[xml] Use of Greater Than Symbol in XML

I had created the xml document with xml version="1.0".

In that document I need to use the greater than symbol > and less than symbol <.

How should I include those symbols? It's not working.

&gt; and &lt; are not working for me.

Is there any special encoder for this?

This question is related to xml xsd

The answer is


CDATA is a better general solution.


You can try to use CDATA to put all your symbols that don't work.

An example of something that will work in XML:

<![CDATA[
function matchwo(a,b) {
    if (a < b && a < 0) {
        return 1;
   } else {
       return 0;
   }
}
]]>

And of course you can use &lt; and &gt;.


You need the Character Entity References

< = &lt;

> = &gt;


Use &gt; and &lt; for 'greater-than' and 'less-than' respectively


You need the Character Entity References

< = &lt;

> = &gt;


You can try to use CDATA to put all your symbols that don't work.

An example of something that will work in XML:

<![CDATA[
function matchwo(a,b) {
    if (a < b && a < 0) {
        return 1;
   } else {
       return 0;
   }
}
]]>

And of course you can use &lt; and &gt;.


You need the Character Entity References

< = &lt;

> = &gt;


You can try to use CDATA to put all your symbols that don't work.

An example of something that will work in XML:

<![CDATA[
function matchwo(a,b) {
    if (a < b && a < 0) {
        return 1;
   } else {
       return 0;
   }
}
]]>

And of course you can use &lt; and &gt;.


Use &gt; and &lt; for 'greater-than' and 'less-than' respectively


You need the Character Entity References

< = &lt;

> = &gt;


CDATA is a better general solution.


Use &gt; and &lt; for 'greater-than' and 'less-than' respectively


CDATA is a better general solution.