コード例 #1
0
        private bool LoadPropertyBaseHelper(XmlNode propertyBaseNode, PropertyTokenBase ptb, List <XmlNode> unprocessedNodes)
        {
            ExpressionNodeMatch expressionMatch = new ExpressionNodeMatch(this);

            bool expressionNodeFound             = false; // cardinality 0..1
            bool collectionNodeFound             = false; // cardinality 0..1
            bool itemSelectionConditionNodeFound = false; // cardinality 0..1

            ExpressionToken condition = null;

            foreach (XmlNode n in propertyBaseNode.ChildNodes)
            {
                if (expressionMatch.MatchNode(n))
                {
                    if (expressionNodeFound)
                    {
                        this.ProcessDuplicateNode(n);
                        return(false); // fatal error
                    }
                    expressionNodeFound = true;
                    if (!expressionMatch.ProcessNode(n))
                    {
                        return(false); // fatal error
                    }
                }
                else if (MatchNodeName(n, XmlTags.EnumerateCollectionNode))
                {
                    if (collectionNodeFound)
                    {
                        this.ProcessDuplicateNode(n);
                        return(false);
                    }

                    collectionNodeFound = true;
                    if (!ReadBooleanNode(n, out ptb.enumerateCollection))
                    {
                        return(false);
                    }
                }
                else if (MatchNodeName(n, XmlTags.ItemSelectionConditionNode))
                {
                    if (itemSelectionConditionNodeFound)
                    {
                        this.ProcessDuplicateNode(n);
                        return(false);
                    }
                    itemSelectionConditionNodeFound = true;
                    condition = LoadItemSelectionCondition(n);
                    if (condition == null)
                    {
                        return(false);
                    }
                }
                else
                {
                    if (!IsFilteredOutNode(n))
                    {
                        unprocessedNodes.Add(n);
                    }
                }
            } // foreach


            if (expressionNodeFound)
            {
                // we add only if we encountered one, since it's not mandatory
                ExpressionToken expression = expressionMatch.GenerateExpressionToken();
                if (expression == null)
                {
                    return(false); // fatal error
                }

                ptb.expression     = expression;
                ptb.conditionToken = condition;
            }

            return(true);
        }
コード例 #2
0
 private bool LoadPropertyBaseHelper(System.Xml.XmlNode propertyBaseNode, PropertyTokenBase ptb, List<System.Xml.XmlNode> unprocessedNodes)
 {
     ExpressionNodeMatch match = new ExpressionNodeMatch(this);
     bool flag = false;
     bool flag2 = false;
     bool flag3 = false;
     ExpressionToken token = null;
     foreach (System.Xml.XmlNode node in propertyBaseNode.ChildNodes)
     {
         if (match.MatchNode(node))
         {
             if (flag)
             {
                 base.ProcessDuplicateNode(node);
                 return false;
             }
             flag = true;
             if (!match.ProcessNode(node))
             {
                 return false;
             }
         }
         else if (base.MatchNodeName(node, "EnumerateCollection"))
         {
             if (flag2)
             {
                 base.ProcessDuplicateNode(node);
                 return false;
             }
             flag2 = true;
             if (!this.ReadBooleanNode(node, out ptb.enumerateCollection))
             {
                 return false;
             }
         }
         else if (base.MatchNodeName(node, "ItemSelectionCondition"))
         {
             if (flag3)
             {
                 base.ProcessDuplicateNode(node);
                 return false;
             }
             flag3 = true;
             token = this.LoadItemSelectionCondition(node);
             if (token == null)
             {
                 return false;
             }
         }
         else if (!XmlLoaderBase.IsFilteredOutNode(node))
         {
             unprocessedNodes.Add(node);
         }
     }
     if (flag)
     {
         ExpressionToken token2 = match.GenerateExpressionToken();
         if (token2 == null)
         {
             return false;
         }
         ptb.expression = token2;
         ptb.conditionToken = token;
     }
     return true;
 }
コード例 #3
0
        private bool LoadPropertyBaseHelper(XmlNode propertyBaseNode, PropertyTokenBase ptb, List<XmlNode> unprocessedNodes)
        {
            ExpressionNodeMatch expressionMatch = new ExpressionNodeMatch(this);

            bool expressionNodeFound = false;     // cardinality 0..1
            bool collectionNodeFound = false;       // cardinality 0..1
            bool itemSelectionConditionNodeFound = false; // cardinality 0..1

            ExpressionToken condition = null;

            foreach (XmlNode n in propertyBaseNode.ChildNodes)
            {
                if (expressionMatch.MatchNode(n))
                {
                    if (expressionNodeFound)
                    {
                        this.ProcessDuplicateNode(n);
                        return false; // fatal error
                    }
                    expressionNodeFound = true;
                    if (!expressionMatch.ProcessNode(n))
                        return false; // fatal error
                }
                else if (MatchNodeName(n, XmlTags.EnumerateCollectionNode))
                {
                    if (collectionNodeFound)
                    {
                        this.ProcessDuplicateNode(n);
                        return false;
                    }

                    collectionNodeFound = true;
                    if (!ReadBooleanNode(n, out ptb.enumerateCollection))
                        return false;
                }
                else if (MatchNodeName(n, XmlTags.ItemSelectionConditionNode))
                {
                    if (itemSelectionConditionNodeFound)
                    {
                        this.ProcessDuplicateNode(n);
                        return false;
                    }
                    itemSelectionConditionNodeFound = true;
                    condition = LoadItemSelectionCondition(n);
                    if (condition == null)
                    {
                        return false;
                    }
                }
                else
                {
                    if (!IsFilteredOutNode(n))
                        unprocessedNodes.Add(n);
                }
            } // foreach


            if (expressionNodeFound)
            {
                // we add only if we encountered one, since it's not mandatory
                ExpressionToken expression = expressionMatch.GenerateExpressionToken();
                if (expression == null)
                {
                    return false; // fatal error
                }

                ptb.expression = expression;
                ptb.conditionToken = condition;
            }

            return true;
        }