private CompoundPropertyToken LoadCompoundProperty(System.Xml.XmlNode compoundPropertyNode, int index) { using (base.StackFrame(compoundPropertyNode, index)) { CompoundPropertyToken ptb = new CompoundPropertyToken(); List<System.Xml.XmlNode> unprocessedNodes = new List<System.Xml.XmlNode>(); if (!this.LoadPropertyBaseHelper(compoundPropertyNode, ptb, unprocessedNodes)) { return null; } ptb.control = null; bool flag2 = false; bool flag3 = false; ComplexControlMatch match = new ComplexControlMatch(this); FieldControlBody body = null; foreach (System.Xml.XmlNode node in unprocessedNodes) { if (match.MatchNode(node)) { if (flag2) { base.ProcessDuplicateAlternateNode(node, "CustomControl", "CustomControlName"); return null; } flag2 = true; if (!match.ProcessNode(node)) { return null; } } else if (base.MatchNodeName(node, "FieldControl")) { if (flag3) { base.ProcessDuplicateAlternateNode(node, "CustomControl", "CustomControlName"); return null; } flag3 = true; body = new FieldControlBody { fieldFormattingDirective = { formatString = base.GetMandatoryInnerText(node) } }; if (body.fieldFormattingDirective.formatString == null) { return null; } } else { base.ProcessUnknownNode(node); } } if (flag3 && flag2) { base.ProcessDuplicateAlternateNode("CustomControl", "CustomControlName"); return null; } if (flag3) { ptb.control = body; } else { ptb.control = match.Control; } return ptb; } }
private GroupBy LoadGroupBySection(System.Xml.XmlNode groupByNode) { using (base.StackFrame(groupByNode)) { ExpressionNodeMatch match = new ExpressionNodeMatch(this); ComplexControlMatch match2 = new ComplexControlMatch(this); bool flag = false; bool flag2 = false; bool flag3 = false; GroupBy by = new GroupBy(); TextToken token = null; foreach (System.Xml.XmlNode node in groupByNode) { if (match.MatchNode(node)) { if (flag) { base.ProcessDuplicateNode(node); return null; } flag = true; if (!match.ProcessNode(node)) { return null; } } else if (match2.MatchNode(node)) { if (flag2) { base.ProcessDuplicateAlternateNode(node, "CustomControl", "CustomControlName"); return null; } flag2 = true; if (!match2.ProcessNode(node)) { return null; } } else if (base.MatchNodeNameWithAttributes(node, "Label")) { if (flag3) { base.ProcessDuplicateAlternateNode(node, "CustomControl", "CustomControlName"); return null; } flag3 = true; token = this.LoadLabel(node); if (token == null) { return null; } } else { base.ProcessUnknownNode(node); } } if (flag2 && flag3) { base.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.ControlAndLabel, base.ComputeCurrentXPath(), base.FilePath)); return null; } if (flag2 || flag3) { if (!flag) { base.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.ControlLabelWithoutExpression, base.ComputeCurrentXPath(), base.FilePath)); return null; } if (flag2) { by.startGroup.control = match2.Control; } else if (flag3) { by.startGroup.labelTextToken = token; } } if (flag) { ExpressionToken token2 = match.GenerateExpressionToken(); if (token2 == null) { return null; } by.startGroup.expression = token2; return by; } base.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.ExpectExpression, base.ComputeCurrentXPath(), base.FilePath)); return null; } }
private CompoundPropertyToken LoadCompoundProperty(XmlNode compoundPropertyNode, int index) { using (this.StackFrame(compoundPropertyNode, index)) { CompoundPropertyToken cpt = new CompoundPropertyToken(); List <XmlNode> unprocessedNodes = new List <XmlNode>(); bool success = LoadPropertyBaseHelper(compoundPropertyNode, cpt, unprocessedNodes); if (!success) { return(null); } cpt.control = null; // mutually exclusive bool complexControlFound = false; // cardinality 0..1 bool fieldControlFound = false; // cardinality 0..1 ComplexControlMatch controlMatch = new ComplexControlMatch(this); FieldControlBody fieldControlBody = null; foreach (XmlNode n in unprocessedNodes) { if (controlMatch.MatchNode(n)) { if (complexControlFound) { this.ProcessDuplicateAlternateNode(n, XmlTags.ComplexControlNode, XmlTags.ComplexControlNameNode); return(null); } complexControlFound = true; if (!controlMatch.ProcessNode(n)) { return(null); // fatal error } } else if (MatchNodeName(n, XmlTags.FieldControlNode)) { if (fieldControlFound) { this.ProcessDuplicateAlternateNode(n, XmlTags.ComplexControlNode, XmlTags.ComplexControlNameNode); return(null); // fatal error } fieldControlFound = true; fieldControlBody = new FieldControlBody(); fieldControlBody.fieldFormattingDirective.formatString = GetMandatoryInnerText(n); if (fieldControlBody.fieldFormattingDirective.formatString == null) { return(null); // fatal error } } else { ProcessUnknownNode(n); } } if (fieldControlFound && complexControlFound) { this.ProcessDuplicateAlternateNode(XmlTags.ComplexControlNode, XmlTags.ComplexControlNameNode); return(null); // fatal error } if (fieldControlFound) { cpt.control = fieldControlBody; } else { cpt.control = controlMatch.Control; } /* * if (cpt.control == null) * { * this.ReportMissingNodes ( * new string[] { XmlTags.FieldControlNode, XmlTags.ComplexControlNode, XmlTags.ComplexControlNameNode }); * return null; * } */ return(cpt); } }
private GroupBy LoadGroupBySection(XmlNode groupByNode) { using (this.StackFrame(groupByNode)) { ExpressionNodeMatch expressionMatch = new ExpressionNodeMatch(this); ComplexControlMatch controlMatch = new ComplexControlMatch(this); bool expressionNodeFound = false; // cardinality 0..1 // these two nodes are mutually exclusive bool controlFound = false; // cardinality 0..1 bool labelFound = false; // cardinality 0..1 GroupBy groupBy = new GroupBy(); TextToken labelTextToken = null; foreach (XmlNode n in groupByNode) { if (expressionMatch.MatchNode(n)) { if (expressionNodeFound) { this.ProcessDuplicateNode(n); return null; // fatal error } expressionNodeFound = true; if (!expressionMatch.ProcessNode(n)) return null; // fatal error } else if (controlMatch.MatchNode(n)) { if (controlFound) { this.ProcessDuplicateAlternateNode(n, XmlTags.ComplexControlNode, XmlTags.ComplexControlNameNode); return null; } controlFound = true; if (!controlMatch.ProcessNode(n)) return null; // fatal error } else if (MatchNodeNameWithAttributes(n, XmlTags.LabelNode)) { if (labelFound) { this.ProcessDuplicateAlternateNode(n, XmlTags.ComplexControlNode, XmlTags.ComplexControlNameNode); return null; } labelFound = true; labelTextToken = LoadLabel(n); if (labelTextToken == null) { return null; // fatal error } } else { this.ProcessUnknownNode(n); } } if (controlFound && labelFound) { //Error at XPath {0} in file {1}: Cannot have control and label at the same time. this.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.ControlAndLabel, ComputeCurrentXPath(), FilePath)); return null; // fatal error } if (controlFound || labelFound) { if (!expressionNodeFound) { //Error at XPath {0} in file {1}: Cannot have control or label without an expression. this.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.ControlLabelWithoutExpression, ComputeCurrentXPath(), FilePath)); return null; // fatal error } if (controlFound) { groupBy.startGroup.control = controlMatch.Control; } else if (labelFound) { groupBy.startGroup.labelTextToken = labelTextToken; } } if (expressionNodeFound) { // we add only if we encountered one, since it's not mandatory ExpressionToken expression = expressionMatch.GenerateExpressionToken(); if (expression == null) { return null; // fatal error } groupBy.startGroup.expression = expression; return groupBy; } // failure: expression is mandatory //Error at XPath {0} in file {1}: An expression is expected. this.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.ExpectExpression, ComputeCurrentXPath(), FilePath)); return null; } }
private CompoundPropertyToken LoadCompoundProperty(XmlNode compoundPropertyNode, int index) { using (this.StackFrame(compoundPropertyNode, index)) { CompoundPropertyToken cpt = new CompoundPropertyToken(); List<XmlNode> unprocessedNodes = new List<XmlNode>(); bool success = LoadPropertyBaseHelper(compoundPropertyNode, cpt, unprocessedNodes); if (!success) { return null; } cpt.control = null; // mutually exclusive bool complexControlFound = false; // cardinality 0..1 bool fieldControlFound = false; // cardinality 0..1 ComplexControlMatch controlMatch = new ComplexControlMatch(this); FieldControlBody fieldControlBody = null; foreach (XmlNode n in unprocessedNodes) { if (controlMatch.MatchNode(n)) { if (complexControlFound) { this.ProcessDuplicateAlternateNode(n, XmlTags.ComplexControlNode, XmlTags.ComplexControlNameNode); return null; } complexControlFound = true; if (!controlMatch.ProcessNode(n)) return null; // fatal error } else if (MatchNodeName(n, XmlTags.FieldControlNode)) { if (fieldControlFound) { this.ProcessDuplicateAlternateNode(n, XmlTags.ComplexControlNode, XmlTags.ComplexControlNameNode); return null; // fatal error } fieldControlFound = true; fieldControlBody = new FieldControlBody(); fieldControlBody.fieldFormattingDirective.formatString = GetMandatoryInnerText(n); if (fieldControlBody.fieldFormattingDirective.formatString == null) { return null; // fatal error } } else { ProcessUnknownNode(n); } } if (fieldControlFound && complexControlFound) { this.ProcessDuplicateAlternateNode(XmlTags.ComplexControlNode, XmlTags.ComplexControlNameNode); return null; // fatal error } if (fieldControlFound) { cpt.control = fieldControlBody; } else { cpt.control = controlMatch.Control; } /* if (cpt.control == null) { this.ReportMissingNodes ( new string[] { XmlTags.FieldControlNode, XmlTags.ComplexControlNode, XmlTags.ComplexControlNameNode }); return null; } */ return cpt; } }