Ejemplo n.º 1
0
 private EnumerableExpansionDirective LoadEnumerableExpansionDirective(System.Xml.XmlNode directive, int index)
 {
     using (base.StackFrame(directive, index))
     {
         EnumerableExpansionDirective directive2 = new EnumerableExpansionDirective();
         bool flag = false;
         bool flag2 = false;
         foreach (System.Xml.XmlNode node in directive.ChildNodes)
         {
             if (base.MatchNodeName(node, "EntrySelectedBy"))
             {
                 if (flag)
                 {
                     base.ProcessDuplicateNode(node);
                     return null;
                 }
                 flag = true;
                 directive2.appliesTo = this.LoadAppliesToSection(node, true);
             }
             else if (base.MatchNodeName(node, "Expand"))
             {
                 if (flag2)
                 {
                     base.ProcessDuplicateNode(node);
                     return null;
                 }
                 flag2 = true;
                 string mandatoryInnerText = base.GetMandatoryInnerText(node);
                 if (mandatoryInnerText == null)
                 {
                     return null;
                 }
                 if (!EnumerableExpansionConversion.Convert(mandatoryInnerText, out directive2.enumerableExpansion))
                 {
                     base.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.InvalidNodeValue, new object[] { base.ComputeCurrentXPath(), base.FilePath, "Expand" }));
                     return null;
                 }
             }
             else
             {
                 base.ProcessUnknownNode(node);
             }
         }
         return directive2;
     }
 }
Ejemplo n.º 2
0
        private EnumerableExpansionDirective LoadEnumerableExpansionDirective(XmlNode directive, int index)
        {
            using (this.StackFrame(directive, index))
            {
                EnumerableExpansionDirective eed = new EnumerableExpansionDirective();

                bool appliesToNodeFound = false;    // cardinality 1
                bool expandNodeFound = false;    // cardinality 1

                foreach (XmlNode n in directive.ChildNodes)
                {
                    if (MatchNodeName(n, XmlTags.EntrySelectedByNode))
                    {
                        if (appliesToNodeFound)
                        {
                            this.ProcessDuplicateNode(n);
                            return null; //fatal
                        }

                        appliesToNodeFound = true;
                        eed.appliesTo = LoadAppliesToSection(n, true);
                    }
                    else if (MatchNodeName(n, XmlTags.ExpandNode))
                    {
                        if (expandNodeFound)
                        {
                            this.ProcessDuplicateNode(n);
                            return null; //fatal
                        }

                        expandNodeFound = true;
                        string s = GetMandatoryInnerText(n);
                        if (s == null)
                        {
                            return null; //fatal
                        }
                        bool success = EnumerableExpansionConversion.Convert(s, out eed.enumerableExpansion);
                        if (!success)
                        {
                            //Error at XPath {0} in file {1}: Invalid {2} value.
                            this.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.InvalidNodeValue, ComputeCurrentXPath(), FilePath, XmlTags.ExpandNode));
                            return null; //fatal
                        }
                    }
                    else
                    {
                        this.ProcessUnknownNode(n);
                    }
                }
                return eed;
            }
        }