What is the best way to parse Visual Studio .csproj file using python, for further modification?
It is some .csproj file:
...
...
visual basic,...
I want to insert this:
path/to/SomeAassembly.dll
into the node.
解决方案
vscode运行python,VS project files are XML. Python comes with a number of XML parsing libraries: http://docs.python.org/library/markup.html
Either of xml.parsers.expat or xml.minidom could accomplish what you describe. For processing small XML documents like VS project files, choosing among them is a matter of taste. The example code in the documentation for each should help you decide.
An elegant alternative, especially if you have many such transformations to apply, would be to use a filter object with the xml.sax API.
版权声明:本站所有资料均为网友推荐收集整理而来,仅供学习和研究交流使用。
同时也捎带提醒一句,如果你发现你 hook 系统的方法不起作用的时候,或许可以检查一下你项目里引入的第三方框架里是否也 hook 了和你一样的" alt="从使用 KVO 监听 readonly 属性说起">
工作时间:8:00-18:00
客服电话
电子邮件
admin@qq.com
扫码二维码
获取最新动态