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.
我将如何匹配一个简单的 xml 元素(带有 id),如下所示:
<g id="crop"></g>
使用正则表达式?
谢谢
冒着被否决的风险... 为工作使用正确的工具怎么样?
var xmlStr = "<g id=\"crop\"></g>"; var att = XElement.Parse(xmlStr).Attribute("id"); var id = (string)att;