public ForwardAxis(DoubleLinkAxis axis, bool isdesorself)
 {
     this.isDss       = isdesorself;
     this.isAttribute = Asttree.IsAttribute(axis);
     this.topNode     = axis;
     this.rootNode    = axis;
     while (this.rootNode.Input != null)
     {
         this.rootNode = (DoubleLinkAxis)this.rootNode.Input;
     }
     this.isSelfAxis = Asttree.IsSelf(this.topNode);
 }
 internal ActiveAxis(Asttree axisTree)
 {
     this.axisTree = axisTree;
     this.currentDepth = -1;
     this.axisStack = new ArrayList(axisTree.SubtreeArray.Count);
     for (int i = 0; i < axisTree.SubtreeArray.Count; i++)
     {
         AxisStack stack = new AxisStack((ForwardAxis) axisTree.SubtreeArray[i], this);
         this.axisStack.Add(stack);
     }
     this.isActive = true;
 }
Example #3
0
 internal ActiveAxis(Asttree axisTree)
 {
     this.axisTree     = axisTree;
     this.currentDepth = -1;
     this.axisStack    = new ArrayList(axisTree.SubtreeArray.Count);
     for (int i = 0; i < axisTree.SubtreeArray.Count; i++)
     {
         AxisStack stack = new AxisStack((ForwardAxis)axisTree.SubtreeArray[i], this);
         this.axisStack.Add(stack);
     }
     this.isActive = true;
 }
Example #4
0
 public ForwardAxis(DoubleLinkAxis axis, bool isdesorself)
 {
     _isDss       = isdesorself;
     _isAttribute = Asttree.IsAttribute(axis);
     _topNode     = axis;
     _rootNode    = axis;
     while (_rootNode.Input != null)
     {
         _rootNode = (DoubleLinkAxis)(_rootNode.Input);
     }
     // better to calculate it out, since it's used so often, and if the top is self then the whole tree is self
     _isSelfAxis = Asttree.IsSelf(_topNode);
 }
Example #5
0
 internal ActiveAxis(Asttree axisTree)
 {
     _axisTree     = axisTree;                                           // only a pointer.  do i need it?
     _currentDepth = -1;                                                 // context depth is 0 -- enforce moveToChild for the context node
                                                                         // otherwise can't deal with "." node
     _axisStack = new ArrayList(axisTree.SubtreeArray.Count);            // defined length
     // new one stack element for each one
     for (int i = 0; i < axisTree.SubtreeArray.Count; ++i)
     {
         AxisStack stack = new AxisStack((ForwardAxis)axisTree.SubtreeArray[i] !, this);
         _axisStack.Add(stack);
     }
     _isActive = true;
 }
 internal ActiveAxis(Asttree axisTree)
 {
     this.axisTree     = axisTree;                                           // only a pointer.  do i need it?
     this.currentDepth = -1;                                                 // context depth is 0 -- enforce moveToChild for the context node
                                                                             // otherwise can't deal with "." node
     this.axisStack = new ArrayList(axisTree.SubtreeArray.Count);            // defined length
     // new one stack element for each one
     foreach (ForwardAxis faxis in axisTree.SubtreeArray)
     {
         AxisStack stack = new AxisStack(faxis, this);
         axisStack.Add(stack);
     }
     this.isActive = true;
 }
Example #7
0
        // equal & ! attribute then move
        // "a/b/c"     pointer from a move to b
        // return true if reach c and c is an element and c is the axis
        internal bool MoveToChild(string name, string?URN, int depth, ForwardAxis parent)
        {
            // an attribute can never be the same as an element
            if (Asttree.IsAttribute(this.curNode))
            {
                return(false);
            }

            // either moveToParent or moveToChild status will have to be changed into unmatch...
            if (this.isMatch)
            {
                this.isMatch = false;
            }

            if (!AxisStack.Equal(this.curNode.Name, this.curNode.Urn, name, URN))
            {
                return(false);
            }

            if (this.curDepth == -1)
            {
                SetDepth(depth);
            }
            else if (depth > this.curDepth)
            {
                return(false);
            }

            // matched ...
            if (this.curNode == parent.TopNode)
            {
                this.isMatch = true;
                return(true);
            }

            // move down this.curNode
            DoubleLinkAxis nowNode = (DoubleLinkAxis)(this.curNode.Next !);

            if (Asttree.IsAttribute(nowNode))
            {
                this.isMatch = true;                    // for attribute
                return(false);
            }

            this.curNode = nowNode;
            this.curDepth++;
            return(false);
        }
Example #8
0
        public CompiledIdentityConstraint(XmlSchemaIdentityConstraint constraint, XmlNamespaceManager nsmgr)
        {
            this.name = constraint.QualifiedName;

            //public Asttree (string xPath, bool isField, XmlNamespaceManager nsmgr)
            try
            {
                _selector = new Asttree(constraint.Selector.XPath, false, nsmgr);
            }
            catch (XmlSchemaException e)
            {
                e.SetSource(constraint.Selector);
                throw;
            }
            XmlSchemaObjectCollection fields = constraint.Fields;

            Debug.Assert(fields.Count > 0);
            _fields = new Asttree[fields.Count];
            for (int idxField = 0; idxField < fields.Count; idxField++)
            {
                try
                {
                    _fields[idxField] = new Asttree(((XmlSchemaXPath)fields[idxField]).XPath, true, nsmgr);
                }
                catch (XmlSchemaException e)
                {
                    e.SetSource(constraint.Fields[idxField]);
                    throw;
                }
            }
            if (constraint is XmlSchemaUnique)
            {
                _role = ConstraintRole.Unique;
            }
            else if (constraint is XmlSchemaKey)
            {
                _role = ConstraintRole.Key;
            }
            else
            {             // XmlSchemaKeyref
                _role      = ConstraintRole.Keyref;
                this.refer = ((XmlSchemaKeyref)constraint).Refer;
            }
        }
 public CompiledIdentityConstraint(XmlSchemaIdentityConstraint constraint, XmlNamespaceManager nsmgr)
 {
     this.name = XmlQualifiedName.Empty;
     this.refer = XmlQualifiedName.Empty;
     this.name = constraint.QualifiedName;
     try
     {
         this.selector = new Asttree(constraint.Selector.XPath, false, nsmgr);
     }
     catch (XmlSchemaException exception)
     {
         exception.SetSource(constraint.Selector);
         throw exception;
     }
     XmlSchemaObjectCollection fields = constraint.Fields;
     this.fields = new Asttree[fields.Count];
     for (int i = 0; i < fields.Count; i++)
     {
         try
         {
             this.fields[i] = new Asttree(((XmlSchemaXPath) fields[i]).XPath, true, nsmgr);
         }
         catch (XmlSchemaException exception2)
         {
             exception2.SetSource(constraint.Fields[i]);
             throw exception2;
         }
     }
     if (constraint is XmlSchemaUnique)
     {
         this.role = ConstraintRole.Unique;
     }
     else if (constraint is XmlSchemaKey)
     {
         this.role = ConstraintRole.Key;
     }
     else
     {
         this.role = ConstraintRole.Keyref;
         this.refer = ((XmlSchemaKeyref) constraint).Refer;
     }
 }
Example #10
0
 internal bool MoveToChild(string name, string URN, int depth, ForwardAxis parent)
 {
     if (!Asttree.IsAttribute(this.curNode))
     {
         if (this.isMatch)
         {
             this.isMatch = false;
         }
         if (!AxisStack.Equal(this.curNode.Name, this.curNode.Urn, name, URN))
         {
             return(false);
         }
         if (this.curDepth == -1)
         {
             this.SetDepth(depth);
         }
         else if (depth > this.curDepth)
         {
             return(false);
         }
         if (this.curNode == parent.TopNode)
         {
             this.isMatch = true;
             return(true);
         }
         DoubleLinkAxis next = (DoubleLinkAxis)this.curNode.Next;
         if (Asttree.IsAttribute(next))
         {
             this.isMatch = true;
             return(false);
         }
         this.curNode = next;
         this.curDepth++;
     }
     return(false);
 }
Example #11
0
 public SelectorActiveAxis(Asttree axisTree, ConstraintStruct cs) : base(axisTree)
 {
     _KSs = new ArrayList();
     _cs  = cs;
 }
Example #12
0
 internal LocatedActiveAxis(Asttree astfield, KeySequence ks, int column) : base(astfield)
 {
     this.Ks        = ks;
     _column        = column;
     this.isMatched = false;
 }
Example #13
0
 internal LocatedActiveAxis(Asttree astfield, int row, int column) : base(astfield)
 {
     this.row       = row;
     this.column    = column;
     this.isMatched = false;
 }
 public SelectorActiveAxis(Asttree axisTree, ConstraintStruct cs) : base(axisTree)
 {
     this.KSs = new ArrayList();
     this.cs = cs;
 }
 internal LocatedActiveAxis(Asttree astfield, KeySequence ks, int column) : base(astfield)
 {
     this.Ks = ks;
     this.column = column;
     this.isMatched = false;
 }