// -------------------------------------------------------------------- static private string FlowXMLParse(FlowParseType eType, string ApproveLineXML, bool bGenNext) { string _xml = ApproveLineXML.Replace("[[", "<").Replace("]]", ">"); XmlDocument doc = new XmlDocument(); doc.LoadXml(_xml); XmlElement el = doc.DocumentElement; XmlNamespaceManager xMgr = new XmlNamespaceManager(doc.NameTable); XmlNodeList nl = el.SelectNodes("//APP", xMgr); foreach (XmlNode no in nl) { string ID = ""; if (no.Attributes["ID"] != null) { ID = no.Attributes["ID"].Value.ToString(); } if (no.Attributes["PASS"] == null) { if (bGenNext) { // ADD PASS TO ATTRIBUTE XmlAttribute newAttr = doc.CreateAttribute("PASS"); newAttr.Value = "True"; no.Attributes.Append(newAttr); return(doc.InnerXml.Replace("<", "[[").Replace(">", "]]"));; } if (eType == FlowParseType.CurrentApprover) { return(ID); // ** CurrentApprover } if (eType == FlowParseType.CurrentStep) { XmlNode noStep = no.ParentNode; //string TITLE = noStep.Attributes["Title"].Value.ToString(); string TITLE = no.Attributes["Title"].Value.ToString(); return(TITLE); // ** CurrentStep } if (eType == FlowParseType.NextApprover) { eType = FlowParseType.CurrentApprover; // ** NextApprover } else if (eType == FlowParseType.NextStep) { eType = FlowParseType.CurrentStep; // ** NextStep } } } if (bGenNext) { return(doc.InnerXml.Replace("<", "[[").Replace(">", "]]")); } else { return("*"); // END } }
/* ********** Approve Line XML Format Sample ********** * strApproverXML = string.Format(@" * [[STEPS]] * [[STEP ID='A1' TITLE='Sales Head' TYPE='Users' GETBY='Role+Product' GETVALUE='Sales Head+{0}' /]] * [[STEP ID='A2' TITLE='PM' TYPE='Line' GETBY='Role+Product' GETVALUE='PM+{0}' /]] * [[STEP ID='A3' TITLE='PM Manager' TYPE='Users' GETBY='Role+Site' GETVALUE='PM Manager+{1}'/]] * [[STEP ID='A4' TITLE='SM Head' TYPE='Users' GETBY='Role+Product+Site' GETVALUE='SM Head+{0}+{1}' /]] * [[STEP ID='A5' TITLE='PD Head' TYPE='Users' GETBY='Role+Product' GETVALUE='PD Head+{0}' /]] * [[STEP ID='A6' TITLE='PD' TYPE='Line' GETBY='Role+Product' GETVALUE='PD+{0}' /]] * [[/STEPS]]", strProductCode, strIssuerSite); */ // -------------------------------------------------------------------- static private string FlowXMLParse(FlowParseType eType, string ApproveLineXML) { return(FlowXMLParse(eType, ApproveLineXML, false)); }