Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
以下最小测试用例在 powershell 中引发错误:
[reflection.assembly]::LoadWithPartialName('system.xml.linq') [system.xml.linq.xdocument]::parse('<node>&</node>')
坦率地说,在任何 .net 库中。这在存储 url 时是一个真正的问题 - 例如,如果 was 的<node>内容http://test.com/?one=a&two=b。
<node>
http://test.com/?one=a&two=b
应该如何正确编码?
XML 中的编码 & 符号是&
&
使用编码的 & 符号运行它不会引发异常:
[reflection.assembly]::LoadWithPartialName('system.xml.linq') [system.xml.linq.xdocument]::parse('<node>&</node>')