Use of Greater Than Symbol in XML

后端 未结 4 942
广开言路
广开言路 2020-12-13 23:49

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 <

相关标签:
4条回答
  • 2020-12-14 00:14

    You need the Character Entity References

    < = &lt;

    > = &gt;

    0 讨论(0)
  • 2020-12-14 00:22

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

    0 讨论(0)
  • 2020-12-14 00:22

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

    0 讨论(0)
  • 2020-12-14 00:24

    CDATA is a better general solution.

    0 讨论(0)
提交回复
热议问题