當前位置: 首頁>>代碼示例>>C#>>正文


C# XPath.XPathNavigator類代碼示例

本文整理匯總了C#中System.Xml.XPath.XPathNavigator的典型用法代碼示例。如果您正苦於以下問題:C# XPathNavigator類的具體用法?C# XPathNavigator怎麽用?C# XPathNavigator使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


XPathNavigator類屬於System.Xml.XPath命名空間,在下文中一共展示了XPathNavigator類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: XPathAxisIterator

        public XPathAxisIterator(XPathNavigator nav, string name, string namespaceURI, bool matchSelf) : this(nav, matchSelf) {
            if (name == null) throw new ArgumentNullException("name");
            if (namespaceURI == null) throw new ArgumentNullException("namespaceURI");

            this.name      = name;
            this.uri       = namespaceURI;
        }
開發者ID:iskiselev,項目名稱:JSIL.NetFramework,代碼行數:7,代碼來源:XPathAxisIterator.cs

示例2: SchematronValidationEventArgs

        /// <summary>
        ///   Creates a new instance of the <see cref="SchematronValidationEventArgs"/>.
        /// </summary>
        /// <param name="schematron">The <see cref="SchematronDocument"/> that detected the event.</param>
        /// <param name="queryEngine">The <see cref="IQueryLanguage"/> that detected the event.</param>
        /// <param name="pattern">The active <see cref="Pattern"/>.</param>
        /// <param name="rule">The <see cref="Sepia.Schematron.Rule"/> that caused the event to be raised.</param>
        /// <param name="assertion">The <see cref="Sepia.Schematron.Assertion"/> that caused the event to be raised.</param>
        /// <param name="context">An <see cref="object"/> that provides the context for the <paramref name="rule"/> and <paramref name="assertion"/>.</param>
        /// <param name="instance">An <see cref="XPathNavigator"/> to the document node that cause the event to be raised.</param>
        public SchematronValidationEventArgs(SchematronDocument schematron, IQueryLanguage queryEngine, Pattern pattern, Rule rule, Assertion assertion, object context, XPathNavigator instance)
        {
            this.schematron = schematron;
             this.queryEngine = queryEngine;
             this.pattern = pattern;
             this.rule = rule;
             this.assertion = assertion;
             this.instance = instance.Clone();

             if (assertion == null)
             {
            message = "A schematron validation event occured.";
             }
             else
             {
            message = assertion.Message.ToString(instance, context);
             }

             List<string> diagnostics = new List<string>();
             if (assertion != null && !string.IsNullOrEmpty(assertion.Diagnostics))
             {
            foreach (string id in assertion.Diagnostics.Split(' '))
            {
               Diagnostic diagnostic = schematron.Diagnostics[id];
               diagnostics.Add(diagnostic.Message.ToString(instance, context));
            }
             }
             this.diagnostics = diagnostics.ToArray();
        }
開發者ID:richardschneider,項目名稱:sepia,代碼行數:39,代碼來源:ValidationFramework.cs

示例3: GenericSeekableNavigator

 internal GenericSeekableNavigator(XPathNavigator navigator)
 {
     this.navigator = navigator;
     this.nodes = new QueryBuffer<XPathNavigator>(4);
     this.currentPosition = -1L;
     this.dom = this;
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:7,代碼來源:GenericSeekableNavigator.cs

示例4: XPathSingletonIterator

 public XPathSingletonIterator(XPathNavigator nav, bool moved) : this(nav)
 {
     if (moved)
     {
         _position = 1;
     }
 }
開發者ID:ChuangYang,項目名稱:corefx,代碼行數:7,代碼來源:XPathSingletonIterator.cs

示例5: Atom03SyndicationResourceAdapter

 /// <summary>
 /// Initializes a new instance of the <see cref="Atom03SyndicationResourceAdapter"/> class using the supplied <see cref="XPathNavigator"/> and <see cref="SyndicationResourceLoadSettings"/>.
 /// </summary>
 /// <param name="navigator">A read-only <see cref="XPathNavigator"/> object for navigating through the syndication feed information.</param>
 /// <param name="settings">The <see cref="SyndicationResourceLoadSettings"/> object used to configure the load operation of the <see cref="AtomFeed"/>.</param>
 /// <remarks>
 ///     This class expects the supplied <paramref name="navigator"/> to be positioned on the XML element that represents a <see cref="AtomFeed"/>.
 /// </remarks>
 /// <exception cref="ArgumentNullException">The <paramref name="navigator"/> is a null reference (Nothing in Visual Basic).</exception>
 /// <exception cref="ArgumentNullException">The <paramref name="settings"/> is a null reference (Nothing in Visual Basic).</exception>
 public Atom03SyndicationResourceAdapter(XPathNavigator navigator, SyndicationResourceLoadSettings settings)
     : base(navigator, settings)
 {
     //------------------------------------------------------------
     //	Initialization and argument validation handled by base class
     //------------------------------------------------------------
 }
開發者ID:Jiyuu,項目名稱:Argotic,代碼行數:17,代碼來源:Atom03SyndicationResourceAdapter.cs

示例6: AxisElement

        internal AxisElement(GanttView view, XPathNavigator node)
            : base(view, node)
        {
            _scale = (ScaleLevel)Enum.Parse(typeof(ScaleLevel), Attributes[ScaleName].Value);
            _interval = int.Parse(Attributes[IntervalName].Value, CultureInfo.InvariantCulture);
            _format = Attributes[FormatName].Value;
            if(_scale == ScaleLevel.Week)
                _firstDay = (DayOfWeek)Enum.Parse(typeof(DayOfWeek), Attributes[FirstDayName].Value);

            if (Attributes.ContainsKey(TitleTypeName))
            {
                string titleTypeValue = Attributes[TitleTypeName].Value;
                if (!string.IsNullOrEmpty(titleTypeValue))
                {
                    _titleType = (TitleType)Enum.Parse(typeof(TitleType), titleTypeValue);
                }
            }

            if (Attributes.ContainsKey(WidthName))
            {
                string widthValue = Attributes[WidthName].Value;
                if (!string.IsNullOrEmpty(widthValue))
                {
                    this.Width = int.Parse(widthValue, NumberStyles.Integer, CultureInfo.InvariantCulture);
                }
            }
        }
開發者ID:0anion0,項目名稱:IBN,代碼行數:27,代碼來源:AxisElement.cs

示例7: AssertSequencePoints

        protected override void AssertSequencePoints(XPathNavigator navigator)
        {
            var entries = navigator.Select(
                "./symbols/methods/method[@name=\"MethodThatCreatesSwitch.SimpleClass.GenerateSwitch\"]/sequencepoints/entry");
            Assert.Equal(8, entries.Count);

            int visitedCount = 0;

            foreach (XPathNavigator entry in entries)
            {
                if (entry.GetAttribute("il_offset", string.Empty) == "0x0")
                {
                    Assert.Equal("16", entry.GetAttribute("start_row", string.Empty));
                    Assert.Equal("16", entry.GetAttribute("end_row", string.Empty));
                    Assert.Equal("4", entry.GetAttribute("start_column", string.Empty));
                    Assert.Equal("21", entry.GetAttribute("end_column", string.Empty));
                    visitedCount++;
                }
                else if (entry.GetAttribute("il_offset", string.Empty) == "0x23")
                {
                    Assert.Equal("24", entry.GetAttribute("start_row", string.Empty));
                    Assert.Equal("24", entry.GetAttribute("end_row", string.Empty));
                    Assert.Equal("4", entry.GetAttribute("start_column", string.Empty));
                    Assert.Equal("17", entry.GetAttribute("end_column", string.Empty));
                    visitedCount++;
                }
            }

            Assert.Equal(2, visitedCount);
        }
開發者ID:JasonBock,項目名稱:EmitDebugging,代碼行數:30,代碼來源:DebuggingWithMethodThatCreatesSwitchTests.cs

示例8: LoadFromXPathNavigator

        public static MaterialDefinition LoadFromXPathNavigator(XPathNavigator navigator)
        {
            if (navigator == null)
            {
                return null;
            }

            MaterialDefinition materialDefinition = new MaterialDefinition();

            //name
            materialDefinition.Name = navigator.GetAttribute("Name", string.Empty);
            materialDefinition.NameHash = Cryptography.JenkinsOneAtATime(materialDefinition.Name);

            //type
            materialDefinition.Type = navigator.GetAttribute("Type", string.Empty);
            materialDefinition.TypeHash = Cryptography.JenkinsOneAtATime(materialDefinition.Type);

            //draw styles
            XPathNodeIterator entries = navigator.Select("./Array[@Name='DrawStyles']/Object[@Class='DrawStyle']");

            while (entries.MoveNext())
            {
                DrawStyle drawStyle = DrawStyle.LoadFromXPathNavigator(entries.Current);

                if (drawStyle != null)
                {
                    materialDefinition.DrawStyles.Add(drawStyle);
                }
            }

            return materialDefinition;
        }
開發者ID:SlyvanGames,項目名稱:ps2ls,代碼行數:32,代碼來源:MaterialDefinition.cs

示例9: XmlNodeTaskItem

        /// <summary>
        /// Initializes a new instance of an XmlNodeTaskItem
        /// </summary>
        /// <param name="xpathNavigator">The selected XmlNode</param>
        /// <param name="reservedMetaDataPrefix">The prefix to attach to the reserved metadata properties.</param>
        public XmlNodeTaskItem(XPathNavigator xpathNavigator, string reservedMetaDataPrefix)
        {
            this.ReservedMetaDataPrefix = reservedMetaDataPrefix;

            switch (xpathNavigator.NodeType)
            {
                case XPathNodeType.Attribute:
                    itemSpec = xpathNavigator.Value;
                    break;
                default:
                    itemSpec = xpathNavigator.Name;
                    break;
            }
            metaData.Add(ReservedMetaDataPrefix + "value", xpathNavigator.Value);
            metaData.Add(ReservedMetaDataPrefix + "innerXml", xpathNavigator.InnerXml);
            metaData.Add(ReservedMetaDataPrefix + "outerXml", xpathNavigator.OuterXml);

            if (xpathNavigator.MoveToFirstAttribute())
            {
                do
                {
                    metaData.Add(xpathNavigator.Name, xpathNavigator.Value);
                } while (xpathNavigator.MoveToNextAttribute());
            }
        }
開發者ID:trippleflux,項目名稱:jezatools,代碼行數:30,代碼來源:XmlNodeTaskItem.cs

示例10: AssertSequencePointsInFirstType

        private static void AssertSequencePointsInFirstType(XPathNavigator navigator)
        {
            var entries = navigator.Select(
                "./symbols/methods/method[@name=\"AssemblyWithTwoTypes.FirstClass.ReflectArgument\"]/sequencepoints/entry");
            Assert.Equal(2, entries.Count);

            int visitedCount = 0;

            foreach (XPathNavigator entry in entries)
            {
                if (entry.GetAttribute("il_offset", string.Empty) == "0x0")
                {
                    Assert.Equal("16", entry.GetAttribute("start_row", string.Empty));
                    Assert.Equal("16", entry.GetAttribute("end_row", string.Empty));
                    Assert.Equal("4", entry.GetAttribute("start_column", string.Empty));
                    Assert.Equal("21", entry.GetAttribute("end_column", string.Empty));
                    visitedCount++;
                }
                else if (entry.GetAttribute("il_offset", string.Empty) == "0x1")
                {
                    Assert.Equal("17", entry.GetAttribute("start_row", string.Empty));
                    Assert.Equal("17", entry.GetAttribute("end_row", string.Empty));
                    Assert.Equal("4", entry.GetAttribute("start_column", string.Empty));
                    Assert.Equal("17", entry.GetAttribute("end_column", string.Empty));
                    visitedCount++;
                }
            }

            Assert.Equal(2, visitedCount);
        }
開發者ID:JasonBock,項目名稱:EmitDebugging,代碼行數:30,代碼來源:DebuggingWithTwoTypesTests.cs

示例11: ApplyTransformPipeline

        public static CardViewModel ApplyTransformPipeline(XPathNavigator powerElement,
			IEnumerable<Func<PowerPipelineState, PowerPipelineState>> pipeline, XmlDocument character)
        {
            var state = new PowerPipelineState(powerElement, character.CreateNavigator());
            state = pipeline.Aggregate(state, (current, op) => op(current));
            return state.ViewModel;
        }
開發者ID:arlobelshee,項目名稱:BlogExamples,代碼行數:7,代碼來源:_5_code_becomes_data.cs

示例12: Parse

 public static ChannelLink Parse(XPathNavigator navigator)
 {
     ChannelLink result = null;
     Guid channelId = Guid.Empty;
     string id = navigator.GetAttribute("id", String.Empty);
     if (!String.IsNullOrEmpty(id))
     {
         channelId = new Guid(id);
     }
     int mpChannelId = -1;
     string mpId = navigator.GetAttribute("mpId", String.Empty);
     if (!String.IsNullOrEmpty(id))
     {
         mpChannelId = Int32.Parse(mpId);
     }
     if (channelId != Guid.Empty
         && mpChannelId >= 0)
     {
         string channelName = navigator.GetAttribute("name", String.Empty);
         ChannelType channelType;
         string type = navigator.GetAttribute("type", String.Empty);
         if (String.IsNullOrEmpty(type))
         {
             channelType = ChannelType.Television;
         }
         else
         {
             channelType = (ChannelType)Enum.Parse(typeof(ChannelType), type);
         }
         string mpChannelName = navigator.GetAttribute("mpName", String.Empty);
         result = new ChannelLink(channelType, channelId, channelName, mpChannelId, mpChannelName);
     }
     return result;
 }
開發者ID:Christoph21x,項目名稱:ARGUS-TV,代碼行數:34,代碼來源:ChannelLink.cs

示例13: Initialize

        //=====================================================================

        /// <inheritdoc />
        /// <remarks>Multiple <c>branch</c> elements are specified as the configuration.  Each <c>branch</c>
        /// element can contain one or more <c>component</c> definitions that will be created and executed when
        /// this component is applied.  Each branch receives a clone of the document.  This may be useful for
        /// generating multiple help output formats in one build configuration.</remarks>
        public override void Initialize(XPathNavigator configuration)
        {
            XPathNodeIterator branchNodes = configuration.Select("branch");

            foreach(XPathNavigator branchNode in branchNodes)
                branches.Add(this.BuildAssembler.LoadComponents(branchNode));
        }
開發者ID:modulexcite,項目名稱:SHFB-1,代碼行數:14,代碼來源:CloneComponent.cs

示例14: LoadTheme

        public bool LoadTheme(string XmlPath, string ElementName, XPathNavigator navigator, int SkinIndex)
        {
            string item = XmlPath + "/" + ElementName;
            _ThemeLoaded = true;

            _ThemeLoaded &= CHelper.TryGetEnumValueFromXML<EBackgroundTypes>(item + "/Type", navigator, ref _Theme.Type);
            
            bool vid = CHelper.GetValueFromXML(item + "/Video", navigator, ref _Theme.VideoName, String.Empty);
            bool tex = CHelper.GetValueFromXML(item + "/Skin", navigator, ref _Theme.TextureName, String.Empty);
            _ThemeLoaded &= vid || tex || _Theme.Type == EBackgroundTypes.None;
                
            if (CHelper.GetValueFromXML(item + "/Color", navigator, ref _Theme.ColorName, String.Empty))
            {
                _ThemeLoaded &= CTheme.GetColor(_Theme.ColorName, SkinIndex, ref Color);
            }
            else
            {
                bool success = true;
                success &= CHelper.TryGetFloatValueFromXML(item + "/R", navigator, ref Color.R);
                success &= CHelper.TryGetFloatValueFromXML(item + "/G", navigator, ref Color.G);
                success &= CHelper.TryGetFloatValueFromXML(item + "/B", navigator, ref Color.B);
                success &= CHelper.TryGetFloatValueFromXML(item + "/A", navigator, ref Color.A);

                if (_Theme.Type != EBackgroundTypes.None)
                    _ThemeLoaded &= success;
            }

            if (_ThemeLoaded)
            {
                _Theme.Name = ElementName;
                LoadTextures();
            }            
            return _ThemeLoaded;
        }
開發者ID:HansMaiser,項目名稱:Vocaluxe,代碼行數:34,代碼來源:CBackground.cs

示例15: Create

        static public XPathNavigatorReader Create(XPathNavigator navToRead)
        {
            XPathNavigator nav = navToRead.Clone();
            IXmlLineInfo xli = nav as IXmlLineInfo;
            IXmlSchemaInfo xsi = nav as IXmlSchemaInfo;
#if NAVREADER_SUPPORTSLINEINFO
            if (null == xsi) {
                if (null == xli) {
                    return new XPathNavigatorReader(nav, xli, xsi);
                }
                else {
                    return new XPathNavigatorReaderWithLI(nav, xli, xsi);
                }
            }
            else {
                if (null == xli) {
                    return new XPathNavigatorReaderWithSI(nav, xli, xsi);
                }
                else {
                    return new XPathNavigatorReaderWithLIAndSI(nav, xli, xsi);
                }
            }
#else
            if (null == xsi)
            {
                return new XPathNavigatorReader(nav, xli, xsi);
            }
            else
            {
                return new XPathNavigatorReaderWithSI(nav, xli, xsi);
            }
#endif
        }
開發者ID:Corillian,項目名稱:corefx,代碼行數:33,代碼來源:XPathNavigatorReader.cs


注:本文中的System.Xml.XPath.XPathNavigator類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。