Is there a BPMN 2.0 Parser for .NET?

In general, I am looking for a way to model business processes. I found UML and BPMN quite often as an answer to this. Now I want to test these models using a program. There is only the UML specification HOW these elements should look, and not how these different models should be saved. That's why I looked at BPMN. The BPMN 2.0 specification is an object management group.

I downloaded the BPMN editor and started playing with this notation. Now I want to start writing a program that checks these BPMN 2.0 files (more precisely, these are xml files). Is there a .NET Framework and / or Implementation that work with this BPMN? I just don't want to write my own extended XML parser for this.

If not: what other models can be used to programmatically test such models?

About checks: I want to search if various information can be found in the models, and issue warnings if this information cannot be found.

+4
source share
2 answers

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); 
+4
source

A workaround with the @ user2757652 answer problem is to modify BPMN20.xsd and Semantic.xsd downloaded from http://www.omg.org/spec/BPMN/2.0/ . other files can be used without changes.

I replaced flowElement ref with its ancestors (in Semantics.xsd ) and rootElement ref (in BPMN20.xsd ) with process and collaboration . You could replace all rootElement ancestors. Although the resulting xsd is not standard and can check for some invalid BPMN-XML, it met my needs

You can download a modified version from the Github Gist

0
source

Source: https://habr.com/ru/post/1501104/


All Articles