It seems that BPMN 2.0 Parser for .NET does not exist, but using xsd.exe, which is part of the Microsoft SDK, you can create it yourself, not just for BPMN. How to do it:
- Download 5 xsd files from omg website: http://www.omg.org/spec/BPMN/2.0/ and place them in the same folder.
- run xsd.exe with four parameters:
xsd.exe DC.xsd DI.xsd BPMNDI.xsd BPMN20.xsd/classes
The fifth file will be added by the application. Be sure to have the correct XSD order. Otherwise it will not work.
On my Machine, the Call looks like this:
"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\xsd.exe" "C:\Users\me\DC.xsd" "C:\Users\me\DI.xsd" "C:\Users\me\BPMNDI.xsd" "C:\Users\me\BPMN20.xsd"/classes
As a result, you will get BPMN20.cs with all classes. You can even change the output language (default C #). Just run xsd.exe
without a parameter to see all the parameters.
To use it in .Net, be sure to add System.Xml as an assembly, then you can get the object as follows:
var serialzer = new XmlSerializer(typeof(tDefinitions)); var XmlStream = new StreamReader("bpmn.xml"); var document= (tDefinitions) serialzer.Deserialize(XmlStream);
source share