praveenjayapal
praveenjayapal

Reputation: 38549

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?

Upvotes: 73

Views: 126774

Answers (3)

Patrick Desjardins
Patrick Desjardins

Reputation: 140853

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;.

Upvotes: 24

Greg
Greg

Reputation: 321698

You need the Character Entity References

< = &lt;

> = &gt;

Upvotes: 117

tonys
tonys

Reputation: 3984

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

Upvotes: 18

Related Questions