How do I escape ampersands in XML so they are rendered as entities in HTML?

前端 未结 11 1865
野趣味
野趣味 2020-11-22 15:59

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: &.

11条回答
  •  情书的邮戳
    2020-11-22 16:52

    Consider if your XML looks like below.

    
      
        SELECT * FROM EMP WHERE ID=1 AND RES<>'GCF'
      
    
    

    You cannot use the <> directly as it throws an error. In that case, you can use <> in replacement of that.

    
      
        SELECT * FROM EMP WHERE ID=1 AND RES <> 'GCF'
      
    
    

    Click here to see all the codes.

提交回复
热议问题