public void TestInterfaceParser()
        {
            var data   = new ParsableData(System.IO.File.ReadAllText(@"C:\Users\wiw39784\Documents\git\CeusDL2\Test\Data\interface_demo.ceusdl"));
            var p      = new InterfaceParser(data);
            var result = p.Parse();

            // TODO: Ausgabe

            data   = new ParsableData(System.IO.File.ReadAllText(@"C:\Users\wiw39784\Documents\git\CeusDL2\Test\Data\interface_demo2.ceusdl"));
            p      = new InterfaceParser(data);
            result = p.Parse();

            data = new ParsableData(System.IO.File.ReadAllText(@"C:\Users\wiw39784\Documents\git\CeusDL2\Test\Data\interface_demo3.ceusdl"));
            p    = new InterfaceParser(data);
            var result2 = p.Parse();

            if (!result.Name.Equals(result2.Name))
            {
                throw new InvalidOperationException("Name nicht gleich!");
            }
            if (!result.Type.Equals(result2.Type))
            {
                throw new InvalidOperationException("Type nicht gleich!");
            }
            if (!result.Attributes.Count.Equals(result2.Attributes.Count))
            {
                throw new InvalidOperationException("Anzahl Attribute nicht gleich!");
            }
            if (!result.Parameters.Count.Equals(result2.Parameters.Count))
            {
                throw new InvalidOperationException("Anzahl Attribute nicht gleich!");
            }
        }
        public virtual BpmnModel ConvertToBpmnModel(XMLStreamReader xtr)
        {
            BpmnModel model = new BpmnModel
            {
                StartEventFormTypes = startEventFormTypes,
                UserTaskFormTypes   = userTaskFormTypes
            };

            try
            {
                Process            activeProcess        = null;
                IList <SubProcess> activeSubProcessList = new List <SubProcess>();
                while (xtr.HasNext())
                {
                    // xtr.next();
                    if (xtr.EndElement && (BpmnXMLConstants.ELEMENT_SUBPROCESS.Equals(xtr.LocalName) || BpmnXMLConstants.ELEMENT_TRANSACTION.Equals(xtr.LocalName) || BpmnXMLConstants.ELEMENT_ADHOC_SUBPROCESS.Equals(xtr.LocalName)))
                    {
                        activeSubProcessList.RemoveAt(activeSubProcessList.Count - 1);
                    }

                    if (!xtr.IsStartElement())
                    {
                        if (BpmnXMLConstants.ELEMENT_DI_DIAGRAM == xtr.LocalName)
                        {
                            xtr.Skip();
                        }
                        else
                        {
                            continue;
                        }
                    }

                    if (xtr.IsStartElement() && BpmnXMLConstants.ELEMENT_DEFINITIONS.Equals(xtr.LocalName))
                    {
                        definitionsParser.Parse(xtr, model);
                    }
                    else if (BpmnXMLConstants.ELEMENT_RESOURCE.Equals(xtr.LocalName))
                    {
                        resourceParser.Parse(xtr, model);
                    }
                    else if (BpmnXMLConstants.ELEMENT_SIGNAL.Equals(xtr.LocalName))
                    {
                        signalParser.Parse(xtr, model);
                    }
                    else if (BpmnXMLConstants.ELEMENT_MESSAGE.Equals(xtr.LocalName))
                    {
                        messageParser.Parse(xtr, model);
                    }
                    else if (BpmnXMLConstants.ELEMENT_ERROR.Equals(xtr.LocalName))
                    {
                        if (!string.IsNullOrWhiteSpace(xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_ID)))
                        {
                            model.AddError(xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_ID), xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_ERROR_CODE));
                        }
                    }
                    else if (BpmnXMLConstants.ELEMENT_IMPORT.Equals(xtr.LocalName))
                    {
                        importParser.Parse(xtr, model);
                    }
                    else if (BpmnXMLConstants.ELEMENT_ITEM_DEFINITION.Equals(xtr.LocalName))
                    {
                        itemDefinitionParser.Parse(xtr, model);
                    }
                    else if (BpmnXMLConstants.ELEMENT_DATA_STORE.Equals(xtr.LocalName))
                    {
                        dataStoreParser.Parse(xtr, model);
                    }
                    else if (BpmnXMLConstants.ELEMENT_INTERFACE.Equals(xtr.LocalName))
                    {
                        interfaceParser.Parse(xtr, model);
                    }
                    else if (BpmnXMLConstants.ELEMENT_IOSPECIFICATION.Equals(xtr.LocalName))
                    {
                        ioSpecificationParser.ParseChildElement(xtr, activeProcess, model);
                    }
                    else if (BpmnXMLConstants.ELEMENT_PARTICIPANT.Equals(xtr.LocalName))
                    {
                        participantParser.Parse(xtr, model);
                    }
                    else if (BpmnXMLConstants.ELEMENT_MESSAGE_FLOW.Equals(xtr.LocalName))
                    {
                        messageFlowParser.Parse(xtr, model);
                    }
                    else if (BpmnXMLConstants.ELEMENT_PROCESS.Equals(xtr.LocalName))
                    {
                        Process process = processParser.Parse(xtr, model);
                        if (process != null)
                        {
                            activeProcess = process;
                        }
                    }
                    else if (BpmnXMLConstants.ELEMENT_POTENTIAL_STARTER.Equals(xtr.LocalName))
                    {
                        potentialStarterParser.Parse(xtr, activeProcess);
                    }
                    else if (BpmnXMLConstants.ELEMENT_LANE.Equals(xtr.LocalName))
                    {
                        laneParser.Parse(xtr, activeProcess, model);
                    }
                    else if (BpmnXMLConstants.ELEMENT_DOCUMENTATION.Equals(xtr.LocalName))
                    {
                        BaseElement parentElement = null;
                        if (activeSubProcessList.Count > 0)
                        {
                            parentElement = activeSubProcessList[activeSubProcessList.Count - 1];
                        }
                        else if (activeProcess != null)
                        {
                            parentElement = activeProcess;
                        }
                        documentationParser.ParseChildElement(xtr, parentElement, model);
                    }
                    else if (activeProcess == null && BpmnXMLConstants.ELEMENT_TEXT_ANNOTATION.Equals(xtr.LocalName))
                    {
                        string         elementId      = xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_ID);
                        TextAnnotation textAnnotation = (TextAnnotation)(new TextAnnotationXMLConverter()).ConvertXMLToElement(xtr, model);
                        textAnnotation.Id = elementId;
                        model.GlobalArtifacts.Add(textAnnotation);
                    }
                    else if (activeProcess == null && BpmnXMLConstants.ELEMENT_ASSOCIATION.Equals(xtr.LocalName))
                    {
                        string      elementId   = xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_ID);
                        Association association = (Association)(new AssociationXMLConverter()).ConvertXMLToElement(xtr, model);
                        association.Id = elementId;
                        model.GlobalArtifacts.Add(association);
                    }
                    else if (BpmnXMLConstants.ELEMENT_EXTENSIONS.Equals(xtr.LocalName))
                    {
                        extensionElementsParser.Parse(xtr, activeSubProcessList, activeProcess, model);
                    }
                    else if (BpmnXMLConstants.ELEMENT_SUBPROCESS.Equals(xtr.LocalName) || BpmnXMLConstants.ELEMENT_TRANSACTION.Equals(xtr.LocalName) || BpmnXMLConstants.ELEMENT_ADHOC_SUBPROCESS.Equals(xtr.LocalName))
                    {
                        subProcessParser.Parse(xtr, activeSubProcessList, activeProcess);
                    }
                    else if (BpmnXMLConstants.ELEMENT_COMPLETION_CONDITION.Equals(xtr.LocalName))
                    {
                        if (activeSubProcessList.Count > 0)
                        {
                            SubProcess subProcess = activeSubProcessList[activeSubProcessList.Count - 1];
                            if (subProcess is AdhocSubProcess adhocSubProcess)
                            {
                                adhocSubProcess.CompletionCondition = xtr.ElementText;
                            }
                        }
                    }
                    else if (BpmnXMLConstants.ELEMENT_DI_SHAPE.Equals(xtr.LocalName))
                    {
                        bpmnShapeParser.Parse(xtr, model);
                    }
                    else if (BpmnXMLConstants.ELEMENT_DI_EDGE.Equals(xtr.LocalName))
                    {
                        bpmnEdgeParser.Parse(xtr, model);
                    }
                    else
                    {
                        if (activeSubProcessList.Count > 0 && BpmnXMLConstants.ELEMENT_MULTIINSTANCE.Equals(xtr.LocalName, StringComparison.CurrentCultureIgnoreCase))
                        {
                            multiInstanceParser.ParseChildElement(xtr, activeSubProcessList[activeSubProcessList.Count - 1], model);
                        }
                        else if (convertersToBpmnMap.ContainsKey(xtr.LocalName))
                        {
                            if (activeProcess != null)
                            {
                                BaseBpmnXMLConverter converter = convertersToBpmnMap[xtr.LocalName];
                                converter.ConvertToBpmnModel(xtr, model, activeProcess, activeSubProcessList);
                            }
                        }
                    }
                    //try
                    //{
                    //    xtr.next();
                    //}
                    //catch (Exception e)
                    //{
                    //    //LOGGER.debug("Error reading XML document", e);
                    //    throw new XMLException("Error reading XML", e);
                    //}
                }

                foreach (Process process in model.Processes)
                {
                    foreach (Pool pool in model.Pools)
                    {
                        if (process.Id.Equals(pool.ProcessRef))
                        {
                            pool.Executable = process.Executable;
                        }
                    }
                    ProcessFlowElements(process.FlowElements, process);
                }
            }
            catch (Exception e)
            {
                log.LogError(e, "Error processing BPMN document");
                throw new XMLException("Error processing BPMN document", e);
            }
            return(model);
        }