public virtual void Parse(XMLStreamReader xtr, BpmnModel model) { string id = xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_DI_BPMNELEMENT); IList <GraphicInfo> wayPointList = new List <GraphicInfo>(); while (xtr.HasNext()) { //xtr.next(); if (xtr.IsStartElement() && BpmnXMLConstants.ELEMENT_DI_LABEL.Equals(xtr.LocalName, StringComparison.CurrentCultureIgnoreCase)) { while (xtr.HasNext()) { //xtr.next(); if (xtr.IsStartElement() && BpmnXMLConstants.ELEMENT_DI_BOUNDS.Equals(xtr.LocalName, StringComparison.CurrentCultureIgnoreCase)) { GraphicInfo graphicInfo = new GraphicInfo(); BpmnXMLUtil.AddXMLLocation(graphicInfo, xtr); graphicInfo.X = Convert.ToDouble(xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_DI_X)); graphicInfo.Y = Convert.ToDouble(xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_DI_Y)); graphicInfo.Width = Convert.ToDouble(xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_DI_WIDTH)); graphicInfo.Height = Convert.ToDouble(xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_DI_HEIGHT)); model.AddLabelGraphicInfo(id, graphicInfo); break; } else if (xtr.EndElement && BpmnXMLConstants.ELEMENT_DI_LABEL.Equals(xtr.LocalName, StringComparison.CurrentCultureIgnoreCase)) { break; } if (xtr.IsEmptyElement && BpmnXMLConstants.ELEMENT_DI_LABEL.Equals(xtr.LocalName, StringComparison.CurrentCultureIgnoreCase)) { break; } } } else if (xtr.IsStartElement() && BpmnXMLConstants.ELEMENT_DI_WAYPOINT.Equals(xtr.LocalName, StringComparison.CurrentCultureIgnoreCase)) { GraphicInfo graphicInfo = new GraphicInfo(); BpmnXMLUtil.AddXMLLocation(graphicInfo, xtr); graphicInfo.X = Convert.ToDouble(xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_DI_X)); graphicInfo.Y = Convert.ToDouble(xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_DI_Y)); wayPointList.Add(graphicInfo); } else if (xtr.EndElement && BpmnXMLConstants.ELEMENT_DI_EDGE.Equals(xtr.LocalName, StringComparison.CurrentCultureIgnoreCase)) { break; } if (xtr.IsEmptyElement && BpmnXMLConstants.ELEMENT_DI_EDGE.Equals(xtr.LocalName, StringComparison.CurrentCultureIgnoreCase)) { break; } } model.AddFlowGraphicInfoList(id, wayPointList); }
protected internal virtual void ParseChildElements(XMLStreamReader xtr, BaseElement parentElement, BpmnModel model, BaseChildElementParser parser) { bool readyWithChildElements = false; while (!readyWithChildElements && xtr.HasNext()) { //xtr.next(); if (xtr.IsStartElement()) { if (parser.ElementName.Equals(xtr.LocalName)) { parser.ParseChildElement(xtr, parentElement, model); } } else if (xtr.EndElement && ElementName.Equals(xtr.LocalName, StringComparison.CurrentCultureIgnoreCase)) { readyWithChildElements = true; } if (xtr.IsEmptyElement && ElementName.Equals(xtr.LocalName, StringComparison.OrdinalIgnoreCase)) { readyWithChildElements = true; } } }
public static void ParseChildElements(string elementName, BaseElement parentElement, XMLStreamReader xtr, IDictionary <string, BaseChildElementParser> childParsers, BpmnModel model) { IDictionary <string, BaseChildElementParser> localParserMap = new Dictionary <string, BaseChildElementParser>(genericChildParserMap); if (childParsers != null) { localParserMap.PutAll(childParsers); } bool inExtensionElements = false; bool readyWithChildElements = false; while (!readyWithChildElements && xtr.HasNext()) { //xtr.next(); if (xtr.IsStartElement()) { if (BpmnXMLConstants.ELEMENT_EXTENSIONS.Equals(xtr.LocalName)) { inExtensionElements = true; } else if (localParserMap.ContainsKey(xtr.LocalName)) { BaseChildElementParser childParser = localParserMap[xtr.LocalName]; //if we're into an extension element but the current element is not accepted by this parentElement then is read as a custom extension element if (inExtensionElements && !childParser.Accepts(parentElement)) { ExtensionElement extensionElement = BpmnXMLUtil.ParseExtensionElement(xtr); parentElement.AddExtensionElement(extensionElement); continue; } localParserMap[xtr.LocalName].ParseChildElement(xtr, parentElement, model); } else if (inExtensionElements) { ExtensionElement extensionElement = BpmnXMLUtil.ParseExtensionElement(xtr); parentElement.AddExtensionElement(extensionElement); } } else if (xtr.EndElement) { if (BpmnXMLConstants.ELEMENT_EXTENSIONS.Equals(xtr.LocalName)) { inExtensionElements = false; } else if (elementName.Equals(xtr.LocalName, StringComparison.CurrentCultureIgnoreCase)) { readyWithChildElements = true; } } if (xtr.IsEmptyElement && elementName.Equals(xtr.LocalName, StringComparison.OrdinalIgnoreCase)) { readyWithChildElements = true; } } }
public virtual void Parse(XMLStreamReader xtr, IList <SubProcess> activeSubProcessList, Process activeProcess, BpmnModel model) { BaseElement parentElement; if (activeSubProcessList.Count > 0) { parentElement = activeSubProcessList[activeSubProcessList.Count - 1]; } else { parentElement = activeProcess; } bool readyWithChildElements = false; while (readyWithChildElements == false && xtr.HasNext()) { //xtr.next(); if (xtr.IsStartElement()) { if (BpmnXMLConstants.ELEMENT_EXECUTION_LISTENER.Equals(xtr.LocalName)) { (new ExecutionListenerParser()).ParseChildElement(xtr, parentElement, model); } else if (BpmnXMLConstants.ELEMENT_EVENT_LISTENER.Equals(xtr.LocalName)) { (new ActivitiEventListenerParser()).ParseChildElement(xtr, parentElement, model); } else if (BpmnXMLConstants.ELEMENT_POTENTIAL_STARTER.Equals(xtr.LocalName)) { (new PotentialStarterParser()).Parse(xtr, activeProcess); } else { ExtensionElement extensionElement = BpmnXMLUtil.ParseExtensionElement(xtr); parentElement.AddExtensionElement(extensionElement); } } else if (xtr.EndElement && BpmnXMLConstants.ELEMENT_EXTENSIONS.Equals(xtr.LocalName)) { readyWithChildElements = true; } if (xtr.IsEmptyElement && string.Compare(xtr.LocalName, BpmnXMLConstants.ELEMENT_EXTENSIONS, true) == 0) { readyWithChildElements = true; } } }
public static ExtensionElement ParseExtensionElement(XMLStreamReader xtr) { ExtensionElement extensionElement = CreateExtensionElement(xtr); bool readyWithExtensionElement = false; while (!readyWithExtensionElement && xtr.HasNext()) { //xtr.next(); if (xtr.NodeType == XmlNodeType.Text || xtr.NodeType == XmlNodeType.CDATA) { if (!string.IsNullOrWhiteSpace(xtr.Value?.Trim())) { extensionElement.ElementText = xtr.Value?.Trim(); } } else if (xtr.IsStartElement()) { if (xtr.IsEmptyElement) { ExtensionElement childExtensionElement = CreateExtensionElement(xtr); extensionElement.AddChildElement(childExtensionElement); xtr.isEmpty = xtr.IsStartElement() && xtr.EndElement; xtr.Next(); return(childExtensionElement); } else { ExtensionElement childExtensionElement = ParseExtensionElement(xtr); extensionElement.AddChildElement(childExtensionElement); } } else if (xtr.EndElement && string.Compare(extensionElement.Name, xtr.LocalName, true) == 0) { readyWithExtensionElement = true; } if (xtr.IsEmptyElement && string.Compare(extensionElement.Name, xtr.LocalName, true) == 0) { readyWithExtensionElement = true; } } return(extensionElement); }
public virtual void Parse(XMLStreamReader xtr, BpmnModel model) { string id = xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_DI_BPMNELEMENT); GraphicInfo graphicInfo = new GraphicInfo(); string strIsExpanded = xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_DI_IS_EXPANDED); if ("true".Equals(strIsExpanded, StringComparison.CurrentCultureIgnoreCase)) { graphicInfo.Expanded = true; } BpmnXMLUtil.AddXMLLocation(graphicInfo, xtr); while (xtr.HasNext()) { //xtr.next(); if (xtr.IsStartElement() && BpmnXMLConstants.ELEMENT_DI_BOUNDS.Equals(xtr.LocalName, StringComparison.CurrentCultureIgnoreCase)) { graphicInfo.X = Convert.ToDouble(xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_DI_X)); graphicInfo.Y = Convert.ToDouble(xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_DI_Y)); graphicInfo.Width = Convert.ToDouble(xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_DI_WIDTH)); graphicInfo.Height = Convert.ToDouble(xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_DI_HEIGHT)); model.AddGraphicInfo(id, graphicInfo); break; } else if (xtr.EndElement && BpmnXMLConstants.ELEMENT_DI_SHAPE.Equals(xtr.LocalName, StringComparison.CurrentCultureIgnoreCase)) { break; } if (xtr.IsEmptyElement && BpmnXMLConstants.ELEMENT_DI_SHAPE.Equals(xtr.LocalName, StringComparison.CurrentCultureIgnoreCase)) { break; } } }
public static void parseDataAssociation(DataAssociation dataAssociation, string elementName, XMLStreamReader xtr) { bool readyWithDataAssociation = false; Assignment assignment = null; try { dataAssociation.Id = xtr.GetAttributeValue("id"); while (!readyWithDataAssociation && xtr.HasNext()) { //xtr.next(); if (xtr.IsStartElement() && BpmnXMLConstants.ELEMENT_SOURCE_REF.Equals(xtr.LocalName)) { string sourceRef = xtr.ElementText; if (!string.IsNullOrWhiteSpace(sourceRef)) { dataAssociation.SourceRef = sourceRef.Trim(); } } else if (xtr.IsStartElement() && BpmnXMLConstants.ELEMENT_TARGET_REF.Equals(xtr.LocalName)) { string targetRef = xtr.ElementText; if (!string.IsNullOrWhiteSpace(targetRef)) { dataAssociation.TargetRef = targetRef.Trim(); } } else if (xtr.IsStartElement() && BpmnXMLConstants.ELEMENT_TRANSFORMATION.Equals(xtr.LocalName)) { string transformation = xtr.ElementText; if (!string.IsNullOrWhiteSpace(transformation)) { dataAssociation.Transformation = transformation.Trim(); } } else if (xtr.IsStartElement() && BpmnXMLConstants.ELEMENT_ASSIGNMENT.Equals(xtr.LocalName)) { assignment = new Assignment(); BpmnXMLUtil.AddXMLLocation(assignment, xtr); } else if (xtr.IsStartElement() && BpmnXMLConstants.ELEMENT_FROM.Equals(xtr.LocalName)) { string from = xtr.ElementText; if (assignment != null && !string.IsNullOrWhiteSpace(from)) { assignment.From = from.Trim(); } } else if (xtr.IsStartElement() && BpmnXMLConstants.ELEMENT_TO.Equals(xtr.LocalName)) { string to = xtr.ElementText; if (assignment != null && !string.IsNullOrWhiteSpace(to)) { assignment.To = to.Trim(); } } else if (xtr.EndElement && BpmnXMLConstants.ELEMENT_ASSIGNMENT.Equals(xtr.LocalName)) { if (!string.IsNullOrWhiteSpace(assignment.From) && !string.IsNullOrWhiteSpace(assignment.To)) { dataAssociation.Assignments.Add(assignment); } } else if (xtr.EndElement && elementName.Equals(xtr.LocalName)) { readyWithDataAssociation = true; } if (xtr.IsEmptyElement && elementName.Equals(xtr.LocalName, StringComparison.OrdinalIgnoreCase)) { readyWithDataAssociation = true; } } } catch (Exception e) { log.LogWarning(e, "Error parsing data association child elements"); } }
public override void ParseChildElement(XMLStreamReader xtr, BaseElement parentElement, BpmnModel model) { if (!Accepts(parentElement)) { return; } FormProperty property = new FormProperty(); BpmnXMLUtil.AddXMLLocation(property, xtr); property.Id = xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_FORM_ID); property.Name = xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_FORM_NAME); property.Type = xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_FORM_TYPE); property.Variable = xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_FORM_VARIABLE); property.Expression = xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_FORM_EXPRESSION); property.DefaultExpression = xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_FORM_DEFAULT); property.DatePattern = xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_FORM_DATEPATTERN); if (!string.IsNullOrWhiteSpace(xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_FORM_REQUIRED))) { property.Required = Convert.ToBoolean(xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_FORM_REQUIRED)); } if (!string.IsNullOrWhiteSpace(xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_FORM_READABLE))) { property.Readable = Convert.ToBoolean(xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_FORM_READABLE)); } if (!string.IsNullOrWhiteSpace(xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_FORM_WRITABLE))) { property.Writeable = Convert.ToBoolean(xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_FORM_WRITABLE)); } bool readyWithFormProperty = false; try { while (!readyWithFormProperty && xtr.HasNext()) { //xtr.next(); if (xtr.IsStartElement() && BpmnXMLConstants.ELEMENT_VALUE.Equals(xtr.LocalName, StringComparison.CurrentCultureIgnoreCase)) { FormValue value = new FormValue(); BpmnXMLUtil.AddXMLLocation(value, xtr); value.Id = xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_ID); value.Name = xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_NAME); property.FormValues.Add(value); } else if (xtr.EndElement && ElementName.Equals(xtr.LocalName, StringComparison.CurrentCultureIgnoreCase)) { readyWithFormProperty = true; } if (xtr.IsEmptyElement && ElementName.Equals(xtr.LocalName, StringComparison.OrdinalIgnoreCase)) { readyWithFormProperty = true; } } } catch (Exception e) { log.LogWarning(e, "Error parsing form properties child elements"); } if (parentElement is UserTask) { ((UserTask)parentElement).FormProperties.Add(property); } else { ((StartEvent)parentElement).FormProperties.Add(property); } }
public override void ParseChildElement(XMLStreamReader xtr, BaseElement parentElement, BpmnModel model) { if (!Accepts(parentElement)) { return; } FieldExtension extension = new FieldExtension(); BpmnXMLUtil.AddXMLLocation(extension, xtr); extension.FieldName = xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_FIELD_NAME); if (!string.IsNullOrWhiteSpace(xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_FIELD_STRING))) { extension.StringValue = xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_FIELD_STRING); } else if (!string.IsNullOrWhiteSpace(xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_FIELD_EXPRESSION))) { extension.Expression = xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_FIELD_EXPRESSION); } else { bool readyWithFieldExtension = false; try { while (readyWithFieldExtension == false && xtr.HasNext()) { //xtr.next(); if (xtr.IsStartElement() && BpmnXMLConstants.ELEMENT_FIELD_STRING.Equals(xtr.LocalName, StringComparison.CurrentCultureIgnoreCase)) { extension.StringValue = xtr.ElementText.Trim(); } else if (xtr.IsStartElement() && BpmnXMLConstants.ATTRIBUTE_FIELD_EXPRESSION.Equals(xtr.LocalName, StringComparison.CurrentCultureIgnoreCase)) { extension.Expression = xtr.ElementText.Trim(); } else if (xtr.EndElement && ElementName.Equals(xtr.LocalName, StringComparison.CurrentCultureIgnoreCase)) { readyWithFieldExtension = true; } if (xtr.IsEmptyElement && ElementName.Equals(xtr.LocalName, StringComparison.OrdinalIgnoreCase)) { readyWithFieldExtension = true; } } } catch (Exception e) { log.LogWarning(e, "Error parsing field extension child elements"); } } if (parentElement is ActivitiListener) { ((ActivitiListener)parentElement).FieldExtensions.Add(extension); } else if (parentElement is ServiceTask) { ((ServiceTask)parentElement).FieldExtensions.Add(extension); } else { ((SendTask)parentElement).FieldExtensions.Add(extension); } }
public virtual void Parse(XMLStreamReader xtr, BpmnModel model) { Interface interfaceObject = new Interface(); BpmnXMLUtil.AddXMLLocation(interfaceObject, xtr); interfaceObject.Id = model.TargetNamespace + ":" + xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_ID); interfaceObject.Name = xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_NAME); interfaceObject.ImplementationRef = ParseMessageRef(xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_IMPLEMENTATION_REF), model); bool readyWithInterface = false; Operation operation = null; try { while (!readyWithInterface && xtr.HasNext()) { //xtr.next(); if (xtr.IsStartElement() && BpmnXMLConstants.ELEMENT_OPERATION.Equals(xtr.LocalName)) { operation = new Operation(); BpmnXMLUtil.AddXMLLocation(operation, xtr); operation.Id = model.TargetNamespace + ":" + xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_ID); operation.Name = xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_NAME); operation.ImplementationRef = ParseMessageRef(xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_IMPLEMENTATION_REF), model); } else if (xtr.IsStartElement() && BpmnXMLConstants.ELEMENT_IN_MESSAGE.Equals(xtr.LocalName)) { string inMessageRef = xtr.ElementText; if (operation != null && !string.IsNullOrWhiteSpace(inMessageRef)) { operation.InMessageRef = ParseMessageRef(inMessageRef.Trim(), model); } } else if (xtr.IsStartElement() && BpmnXMLConstants.ELEMENT_OUT_MESSAGE.Equals(xtr.LocalName)) { string outMessageRef = xtr.ElementText; if (operation != null && !string.IsNullOrWhiteSpace(outMessageRef)) { operation.OutMessageRef = ParseMessageRef(outMessageRef.Trim(), model); } } else if (xtr.EndElement && BpmnXMLConstants.ELEMENT_OPERATION.Equals(xtr.LocalName, StringComparison.CurrentCultureIgnoreCase)) { if (operation != null && !string.IsNullOrWhiteSpace(operation.ImplementationRef)) { interfaceObject.Operations.Add(operation); } } else if (xtr.EndElement && BpmnXMLConstants.ELEMENT_INTERFACE.Equals(xtr.LocalName)) { readyWithInterface = true; } if (xtr.IsEmptyElement && BpmnXMLConstants.ELEMENT_INTERFACE.Equals(xtr.LocalName)) { readyWithInterface = true; } } } catch (Exception e) { log.LogWarning(e, "Error parsing interface child elements"); } model.Interfaces.Add(interfaceObject); }
public override void ParseChildElement(XMLStreamReader xtr, BaseElement parentElement, BpmnModel model) { if (!(parentElement is Activity) && !(parentElement is Process)) { return; } IOSpecification ioSpecification = new IOSpecification(); BpmnXMLUtil.AddXMLLocation(ioSpecification, xtr); bool readyWithIOSpecification = false; try { while (!readyWithIOSpecification && xtr.HasNext()) { //xtr.next(); if (xtr.IsStartElement() && BpmnXMLConstants.ELEMENT_DATA_INPUT.Equals(xtr.LocalName, StringComparison.CurrentCultureIgnoreCase)) { DataSpec dataSpec = new DataSpec(); BpmnXMLUtil.AddXMLLocation(dataSpec, xtr); dataSpec.Id = xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_ID); dataSpec.Name = xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_NAME); dataSpec.ItemSubjectRef = ParseItemSubjectRef(xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_ITEM_SUBJECT_REF), model); ioSpecification.DataInputs.Add(dataSpec); } else if (xtr.IsStartElement() && BpmnXMLConstants.ELEMENT_DATA_OUTPUT.Equals(xtr.LocalName, StringComparison.CurrentCultureIgnoreCase)) { DataSpec dataSpec = new DataSpec(); BpmnXMLUtil.AddXMLLocation(dataSpec, xtr); dataSpec.Id = xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_ID); dataSpec.Name = xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_NAME); dataSpec.ItemSubjectRef = ParseItemSubjectRef(xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_ITEM_SUBJECT_REF), model); ioSpecification.DataOutputs.Add(dataSpec); } else if (xtr.IsStartElement() && BpmnXMLConstants.ELEMENT_DATA_INPUT_REFS.Equals(xtr.LocalName, StringComparison.CurrentCultureIgnoreCase)) { string dataInputRefs = xtr.ElementText; if (!string.IsNullOrWhiteSpace(dataInputRefs)) { ioSpecification.DataInputRefs.Add(dataInputRefs.Trim()); } } else if (xtr.IsStartElement() && BpmnXMLConstants.ELEMENT_DATA_OUTPUT_REFS.Equals(xtr.LocalName, StringComparison.CurrentCultureIgnoreCase)) { string dataOutputRefs = xtr.ElementText; if (!string.IsNullOrWhiteSpace(dataOutputRefs)) { ioSpecification.DataOutputRefs.Add(dataOutputRefs.Trim()); } } else if (xtr.EndElement && ElementName.Equals(xtr.LocalName, StringComparison.CurrentCultureIgnoreCase)) { readyWithIOSpecification = true; } if (xtr.IsEmptyElement && ElementName.Equals(xtr.LocalName, StringComparison.OrdinalIgnoreCase)) { readyWithIOSpecification = true; } } } catch (Exception e) { log.LogWarning(e, "Error parsing ioSpecification child elements"); } if (parentElement is Process) { ((Process)parentElement).IoSpecification = ioSpecification; } else { ((Activity)parentElement).IoSpecification = ioSpecification; } }
public override void ParseChildElement(XMLStreamReader xtr, BaseElement parentElement, BpmnModel model) { if (!(parentElement is Activity)) { return; } MultiInstanceLoopCharacteristics multiInstanceDef = new MultiInstanceLoopCharacteristics(); BpmnXMLUtil.AddXMLLocation(multiInstanceDef, xtr); if (xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_MULTIINSTANCE_SEQUENTIAL) != null) { multiInstanceDef.Sequential = Convert.ToBoolean(xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_MULTIINSTANCE_SEQUENTIAL)); } multiInstanceDef.InputDataItem = xtr.GetAttributeValue(BpmnXMLConstants.ACTIVITI_EXTENSIONS_NAMESPACE, BpmnXMLConstants.ATTRIBUTE_MULTIINSTANCE_COLLECTION); multiInstanceDef.ElementVariable = xtr.GetAttributeValue(BpmnXMLConstants.ACTIVITI_EXTENSIONS_NAMESPACE, BpmnXMLConstants.ATTRIBUTE_MULTIINSTANCE_VARIABLE); multiInstanceDef.ElementIndexVariable = xtr.GetAttributeValue(BpmnXMLConstants.ACTIVITI_EXTENSIONS_NAMESPACE, BpmnXMLConstants.ATTRIBUTE_MULTIINSTANCE_INDEX_VARIABLE); bool readyWithMultiInstance = false; try { while (!readyWithMultiInstance && xtr.HasNext()) { //xtr.next(); if (xtr.IsStartElement() && BpmnXMLConstants.ELEMENT_MULTIINSTANCE_CARDINALITY.Equals(xtr.LocalName, StringComparison.CurrentCultureIgnoreCase)) { multiInstanceDef.LoopCardinality = xtr.ElementText; } else if (xtr.IsStartElement() && BpmnXMLConstants.ELEMENT_MULTIINSTANCE_DATAINPUT.Equals(xtr.LocalName, StringComparison.CurrentCultureIgnoreCase)) { multiInstanceDef.InputDataItem = xtr.ElementText; } else if (xtr.IsStartElement() && BpmnXMLConstants.ELEMENT_MULTIINSTANCE_DATAITEM.Equals(xtr.LocalName, StringComparison.CurrentCultureIgnoreCase)) { if (xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_NAME) != null) { multiInstanceDef.ElementVariable = xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_NAME); } } else if (xtr.IsStartElement() && BpmnXMLConstants.ELEMENT_MULTIINSTANCE_CONDITION.Equals(xtr.LocalName, StringComparison.CurrentCultureIgnoreCase)) { multiInstanceDef.CompletionCondition = xtr.ElementText; } else if (xtr.EndElement && ElementName.Equals(xtr.LocalName, StringComparison.CurrentCultureIgnoreCase)) { readyWithMultiInstance = true; } if (xtr.IsEmptyElement && ElementName.Equals(xtr.LocalName, StringComparison.OrdinalIgnoreCase)) { readyWithMultiInstance = true; } } } catch (Exception e) { log.LogWarning(e, "Error parsing multi instance definition"); } ((Activity)parentElement).LoopCharacteristics = multiInstanceDef; }