示例#1
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);
 }
示例#2
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;
 }
        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 e;
            }
            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 e;
                }
            }
            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;
            }
        }
示例#4
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);
        }
示例#5
0
 public SelectorActiveAxis(Asttree axisTree, ConstraintStruct cs) : base(axisTree)
 {
     _KSs = new ArrayList();
     _cs  = cs;
 }
示例#6
0
 internal LocatedActiveAxis(Asttree astfield, KeySequence ks, int column) : base(astfield)
 {
     this.Ks        = ks;
     _column        = column;
     this.isMatched = false;
 }