在 XML 中使用大于号
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/330725/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Use of Greater Than Symbol in XML
提问by praveenjayapal
I had created the xml document with xml version="1.0".
我用 xml version="1.0" 创建了 xml 文档。
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.
我应该如何包含这些符号?它不起作用。
>and <are not working for me.
>并且<不对我来说有效。
Is there any special encoder for this?
是否有任何特殊的编码器?
回答by Greg
回答by Patrick Desjardins
You can try to use CDATAto put all your symbols that don't work.
您可以尝试使用CDATA来放置所有不起作用的符号。
An example of something that will work in XML:
将在 XML 中工作的示例:
<![CDATA[
function matchwo(a,b) {
if (a < b && a < 0) {
return 1;
} else {
return 0;
}
}
]]>
And of course you can use <and >.
当然你可以使用<and >。
回答by tonys
Use >and <for 'greater-than' and 'less-than' respectively
使用>并<分别“低于”大于'和

