我有一些XML文本,我希望在HTML页面中呈现。 该文本包含一个&符号,我想在其实体表示中呈现: & 。
如何在源XML中避开这个&符号? 我试过& ,但这被解码为实际的&符号( & ),这在HTML中无效 。
所以我想逃避它,使它将被渲染为& 在使用XML输出的网页中。
I have some XML text that I wish to render in an HTML page. This text contains an ampersand, which I want to render in its entity representation: &.
How do I escape this ampersand in the source XML? I tried &, but this is decoded as the actual ampersand character (&), which is invalid in HTML.
So I want to escape it in such a way that it will be rendered as & in the web page that uses the XML output.
最满意答案
当您的XML包含& ,这将导致文本& 。
当您在HTML中使用它时,将被呈现为& 。
When your XML contains &, this will result in the text &.
When you use that in HTML, that will be rendered as &.
更多推荐
发布评论