Пример #1
0
 ///<summary>
 ///When overridden in a derived class, moves the <see cref="T:System.Xml.XPath.XPathNavigator"></see> to the same position as the specified <see cref="T:System.Xml.XPath.XPathNavigator"></see>.
 ///</summary>
 ///
 ///<returns>
 ///Returns true if the <see cref="T:System.Xml.XPath.XPathNavigator"></see> is successful moving to the same position as the specified <see cref="T:System.Xml.XPath.XPathNavigator"></see>; otherwise, false. If false, the position of the <see cref="T:System.Xml.XPath.XPathNavigator"></see> is unchanged.
 ///</returns>
 ///
 ///<param name="other">The <see cref="T:System.Xml.XPath.XPathNavigator"></see> positioned on the node that you want to move to. </param>
 public override bool MoveTo(XPathNavigator other)
 {
     if (other is SifXPathNavigator)
     {
         SifXPathNavigator sxn = (SifXPathNavigator)other;
         fCursor = sxn.fCursor.Clone();
         return(true);
     }
     return(false);
 }
Пример #2
0
        /// <summary>
        /// Creates a new SifXPathContext
        /// </summary>
        /// <param name="parent"></param>
        /// <param name="context"></param>
        private SifXPathContext(SifXPathContext parent, SifElement context)
        {
            if (parent != null)
            {
                fContext = parent.fContext;
            }
            else
            {
                fContext = new SifXsltContext();
                fContext.AddFunctions("adk", new ClassFunctions(typeof(AdkFunctions), null));
            }

            SifVersion version = context.SifVersion;

            if (version == null)
            {
                version = SifVersion.LATEST;
            }

            fContextElement   = context;
            fContextPointer   = new SifElementPointer(null, fContextElement, version);
            fDefaultNavigator = new SifXPathNavigator(fContext, fContextPointer);
        }
Пример #3
0
        /// <summary>
        ///  Evaluates the current step in the path. If the path represented by the step does not
        ///  exist, NULL is returned. Otherwise, the node found is returned unless the special adk:X()
        ///  marker function is contained in the predicate expression, which signals that the specified
        /// repeatable element should always be created
        /// </summary>
        /// <param name="navigator"></param>
        /// <param name="parentPath"></param>
        /// <param name="currentStep"></param>
        /// <returns></returns>
        private INodePointer FindChild(XPathNavigator navigator, StringBuilder parentPath, AdkXPathStep currentStep)
        {
            String currentStepxPath = currentStep.ToString();

            if (currentStep.IsContextDependent())
            {
                // If the special 'adk:x()' function is present, that means to always
                // create the element, therefore, return null as if it were not found
                if (currentStepxPath.IndexOf("adk:x") > -1)
                {
                    return(null);
                }
            }

            navigator.MoveToRoot();
            SifXPathNavigator sifNav =
                (SifXPathNavigator)navigator.SelectSingleNode(parentPath + "/" + currentStepxPath);

            if (sifNav != null)
            {
                return(sifNav.UnderlyingPointer);
            }
            return(null);
        }
Пример #4
0
        ///<summary>
        ///When overridden in a derived class, creates a new <see cref="T:System.Xml.XPath.XPathNavigator"></see> positioned at the same node as this <see cref="T:System.Xml.XPath.XPathNavigator"></see>.
        ///</summary>
        ///
        ///<returns>
        ///A new <see cref="T:System.Xml.XPath.XPathNavigator"></see> positioned at the same node as this <see cref="T:System.Xml.XPath.XPathNavigator"></see>.
        ///</returns>
        ///
        public override XPathNavigator Clone()
        {
            SifXPathNavigator navigator = new SifXPathNavigator(fParentContext, fNameTable, fCursor.Clone());

            return(navigator);
        }