XML SAX parser for scripting using reflection

故事扮演 提交于 2019-12-05 13:30:58

Although not SAX parsers, MSBuild and NAnt are excellent examples of XML-based scripting platforms. Both support developing custom actions and have large communities of users who may be able to help as you go along.

If you must build this from scratch, I recommend building serializable classes implementing a simple execution interface (e.g., a Run() method, known events, etc.). You can then use the .NET XmlSerializer to deserialize objects, cast to the interface, and invoke their routines.

Microsoft does not have a SAX parser for .Net. However, they do have an XmlTextReader class that you can use to read xml a node at a time. In addition to MSBuild it seems as though the xaml dialect used by Microsoft first for WPF and now in .Net 4.0 WWF might be similar to what you want to do as far as scripting. I am not sure what your requirements are for this project, if you really wanted to go all out you could use the code generation technology in .Net to compile the script to possibly get better performance.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!