XML中的方括号?

Rah*_*yas 7 xml escaping special-characters

在XML文档中,如何处理方括号(]或[)?

Kir*_*tan 16

方括号在XML中不需要特定的表示法,但在XPath表达式中用于XSL转换时它们具有特殊含义.

<root>
  <el attrib="[">[</el>
</root>
Run Code Online (Sandbox Code Playgroud)


Red*_*ing 3

可能有更好的解决方案。但这有效:

&#x005D;
Run Code Online (Sandbox Code Playgroud)

如:

<blah value="&#x005D;"></blah>
Run Code Online (Sandbox Code Playgroud)

话又说回来,也是如此(参见 Kirtan 的回答):

<blah value="]"></blah> 
Run Code Online (Sandbox Code Playgroud)