当前位置: 首页>>代码示例>>C#>>正文


C# XmlNodeReader.Read方法代码示例

本文整理汇总了C#中System.Xml.XmlNodeReader.Read方法的典型用法代码示例。如果您正苦于以下问题:C# XmlNodeReader.Read方法的具体用法?C# XmlNodeReader.Read怎么用?C# XmlNodeReader.Read使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Xml.XmlNodeReader的用法示例。


在下文中一共展示了XmlNodeReader.Read方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: move_to_node

 private static void move_to_node( XmlNodeReader nodeReader, string nodeName )
 {
     while (( nodeReader.Read() ) && ( nodeReader.Name.Trim() != nodeName ))
     {
         // Do nothing here...
     }
 }
开发者ID:Elkolt,项目名称:SobekCM-Web-Application,代码行数:7,代码来源:Template_XML_Reader.cs

示例2: process_constants

        private void process_constants( XmlNodeReader nodeReader, CompleteTemplate ThisCompleteTemplate )
        {
            // Read all the nodes
            while ( nodeReader.Read() )
            {
                // Get the node name, trimmed and to upper
                string nodeName = nodeReader.Name.Trim().ToUpper();

                // If this is the inputs or constant start tag, return
                if (( nodeReader.NodeType == XmlNodeType.EndElement ) && ( nodeName == "CONSTANTS" ))
                {
                    return;
                }

                // If this is the beginning tag for an element, assign the next values accordingly
                if (( nodeReader.NodeType == XmlNodeType.Element ) && ( nodeName == "ELEMENT" ) && ( nodeReader.HasAttributes ))
                {
                    abstract_Element newConstant = process_element( nodeReader, -1 );
                    if (newConstant != null)
                    {
                        newConstant.isConstant = true;
                        ThisCompleteTemplate.Add_Constant(newConstant);
                    }
                }
            }
        }
开发者ID:Elkolt,项目名称:SobekCM-Web-Application,代码行数:26,代码来源:Template_XML_Reader.cs

示例3: ValidateNodeAttribute

        public bool ValidateNodeAttribute()
        {
            string propertyValue;
            XmlNodeReader reader;
            bool match = true;

            XmlNode node = Common.GetXmlNode(FileNameWithPath, XPath);

            if (node == null)
            {
                match = false;
            }
            else
            {
                foreach (string propertyKey in ClassProperty.Keys)
                {
                    reader = new XmlNodeReader(node);
                    reader.Read();
                    propertyValue = reader.GetAttribute(propertyKey);
                    if (propertyValue != null && propertyValue != ClassProperty[propertyKey])
                    {
                        match = false;
                    }
                }
            }
            reader = null;
            ClassProperty.Clear();
            return match;
        }
开发者ID:neilmayhew,项目名称:pathway,代码行数:29,代码来源:ValidateXMLFile.cs

示例4: isSuper

 //�ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ�
 public bool isSuper(FileInfo obFile, FileInfo obExtends)
 {
     string infoPath = m_obFinder.getClassPath(obExtends.Name.Replace(".as", ""));
     if (File.Exists(infoPath))
     {
         XmlDocument xml = new XmlDocument();
         xml.Load(infoPath);
         XmlNodeReader reader = new XmlNodeReader(xml);
         while (reader.Read())
         {
             if (reader.NodeType == XmlNodeType.Element)
             {
                 if (reader.Name == "item")
                 {
                     string className = reader.GetAttribute("name");
                     string superSign = reader.GetAttribute("super");
                     if (className == obFile.Name.Replace(".as", ""))
                     {
                         if (superSign != null)
                         {
                             reader.Close();
                             //ErrorBox.Show(obExtends.Name + " extends " + obFile.Name,"ClassRelationsFinderError");
                             return true;
                         }
                     }
                 }
             }
         }
     }
     return false;
 }
开发者ID:r1ng0to3tour,项目名称:swsplayer,代码行数:32,代码来源:ClassRelationsFinder.cs

示例5: Add_Info_From_XML_File

        /// <summary> Reads the item aggregation configuration file and populates the new data into the
        /// item aggregation object </summary>
        /// <param name="HierarchyObject"> Item aggregation object to populate</param>
        /// <param name="FileLocation"> Full name of the item aggregation configuration XML file </param>
        public void Add_Info_From_XML_File(Complete_Item_Aggregation HierarchyObject, string FileLocation )
        {
            // Get the directory from the file location
            string directory = (new FileInfo(FileLocation)).DirectoryName;

            // Load this XML file
            XmlDocument hierarchyXml = new XmlDocument();
            hierarchyXml.Load(FileLocation);

            // create the node reader
            XmlNodeReader nodeReader = new XmlNodeReader(hierarchyXml);

            // Read all the nodes
            while (nodeReader.Read())
            {
                // If this is the beginning tag for an element, assign the next values accordingly
                if (nodeReader.NodeType == XmlNodeType.Element)
                {
                    // Get the node name, trimmed and to upper
                    string nodeName = nodeReader.Name.Trim().ToUpper();

                    // switch the rest based on the tag name
                    switch (nodeName)
                    {
                        case "HI:SETTINGS":
                            read_settings(nodeReader, HierarchyObject);
                            break;

                        case "HI:HOME":
                            read_home(nodeReader, HierarchyObject);
                            break;

                        case "HI:BANNER":
                            read_banners(nodeReader, HierarchyObject);
                            break;

                        case "HI:DIRECTIVES":
                            read_directives(nodeReader, HierarchyObject, directory);
                            break;

                        case "HI:HIGHLIGHTS":
                            read_highlights(nodeReader, HierarchyObject);
                            break;

                        case "HI:BROWSE":
                            read_browse(true, nodeReader, HierarchyObject);
                            break;

                        case "HI:INFO":
                            read_browse(false, nodeReader, HierarchyObject);
                            break;

                        case "HI:RESULTS":
                            read_results_specs(nodeReader, HierarchyObject);
                            break;
                    }
                }
            }
        }
开发者ID:Elkolt,项目名称:SobekCM-Web-Application,代码行数:63,代码来源:Item_Aggregation_XML_Reader.cs

示例6: Decode

        public object Decode(XmlNodeReader reader)
        {
            if (reader == null) return null;
            _reader = reader;

            if (!_reader.Read()) return null;
            return VisitElement(null, null);
        }
开发者ID:mayatforest,项目名称:Refractor,代码行数:8,代码来源:Decoder.cs

示例7: read_text_node

 private static string read_text_node( XmlNodeReader nodeReader )
 {
     if (( nodeReader.Read() ) && ( nodeReader.NodeType == XmlNodeType.Text ))
     {
         return nodeReader.Value.Trim();
     }
     return String.Empty;
 }
开发者ID:Elkolt,项目名称:SobekCM-Web-Application,代码行数:8,代码来源:Template_XML_Reader.cs

示例8: ReadResult

	Result ReadResult (XmlNode item)
	{
	    string ignored;

	    XmlNodeReader xnr = new XmlNodeReader (item["result"]);
	    xnr.Read (); // no idea why this is needed
			       
	    return Result.ImportXml (xnr, out ignored, log);
	}
开发者ID:emtees,项目名称:old-code,代码行数:9,代码来源:XmlBackedGraph.cs

示例9: ReadFromElement

		public void ReadFromElement ()
		{
			XmlNodeReader nrdr = new XmlNodeReader (document.DocumentElement);
			nrdr.Read ();
			AssertEquals ("<root>.NodeType", XmlNodeType.Element, nrdr.NodeType);
			AssertEquals ("<root>.Name", "root", nrdr.Name);
			AssertEquals ("<root>.ReadState", ReadState.Interactive, nrdr.ReadState);
			AssertEquals ("<root>.Depth", 0, nrdr.Depth);
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:9,代码来源:XmlNodeReaderTests.cs

示例10: ReadFromElement

		public void ReadFromElement ()
		{
			XmlNodeReader nrdr = new XmlNodeReader (document.DocumentElement);
			nrdr.Read ();
			Assert.AreEqual (XmlNodeType.Element, nrdr.NodeType, "<root>.NodeType");
			Assert.AreEqual ("root", nrdr.Name, "<root>.Name");
			Assert.AreEqual (ReadState.Interactive, nrdr.ReadState, "<root>.ReadState");
			Assert.AreEqual (0, nrdr.Depth, "<root>.Depth");
		}
开发者ID:Profit0004,项目名称:mono,代码行数:9,代码来源:XmlNodeReaderTests.cs

示例11: Farm4ProphetFromFile

 /// <summary>Factory method for creating a Farm4Prophet object from a file.</summary>
 /// <param name="fileName">The filename of the xml file</param>
 /// <returns>The newly created object.</returns>
 public static Farm4Prophet Farm4ProphetFromFile(string fileName)
 {
     XmlDocument doc = new XmlDocument();
     doc.Load(fileName);
     XmlReader reader = new XmlNodeReader(doc.DocumentElement);
     reader.Read();
     XmlSerializer serial = new XmlSerializer(typeof(Farm4Prophet));
     return (Farm4Prophet)serial.Deserialize(reader);
 }
开发者ID:APSIMInitiative,项目名称:APSIM.Cloud,代码行数:12,代码来源:Farm4ProphetUtility.cs

示例12: Create

 public object Create(object parent, object configContext, System.Xml.XmlNode section)
 {
     XmlSerializer ser = new XmlSerializer(typeof(TypeResolver));
     TypeResolver config = null;
     using (XmlNodeReader rd = new XmlNodeReader(section.SelectSingleNode("TypeResolver")))
     {
         rd.Read();
         config = (TypeResolver)ser.Deserialize(rd);
     }
     return config;
 }
开发者ID:Joelone,项目名称:FFWD,代码行数:11,代码来源:ConfigurationSectionHandler.cs

示例13: read_banners

        private static void read_banners(XmlNodeReader nodeReader, Item_Aggregation hierarchyObject )
        {
            while (nodeReader.Read())
            {
                // If this is the beginning tag for an element, assign the next values accordingly
                if (nodeReader.NodeType == XmlNodeType.Element)
                {
                    // Get the node name, trimmed and to upper
                    string nodeName = nodeReader.Name.Trim().ToUpper();

                    // switch the rest based on the tag name
                    switch (nodeName)
                    {
                        case "HI:SOURCE":
                            // Check for any attributes to this banner node
                            string lang = String.Empty;
                            bool special = false;

                            if (nodeReader.HasAttributes)
                            {

                                if (nodeReader.MoveToAttribute("lang"))
                                {
                                    lang = nodeReader.Value.Trim().ToUpper();
                                }
                                if (nodeReader.MoveToAttribute("type"))
                                {
                                    if (nodeReader.Value.Trim().ToUpper() == "HIGHLIGHT")
                                        special = true;
                                }
                            }

                            // Now read the banner information and add to the aggregation object
                            nodeReader.Read();
                            if (special)
                            {
                                hierarchyObject.Add_Front_Banner_Image(nodeReader.Value, Web_Language_Enum_Converter.Code_To_Enum( lang));
                            }
                            else
                            {
                                hierarchyObject.Add_Banner_Image(nodeReader.Value, Web_Language_Enum_Converter.Code_To_Enum(lang));
                            }

                            break;
                    }
                }

                if ((nodeReader.NodeType == XmlNodeType.EndElement) && (nodeReader.Name.Trim().ToUpper() == "HI:BANNER"))
                {
                    return;
                }
            }
        }
开发者ID:randomyed,项目名称:SobekCM-Web-Application,代码行数:53,代码来源:Item_Aggregation_XML_Reader.cs

示例14: GetAppxSignature

        /*
         * get appx unique flag from Manifest file
         * not completed
        */
        public string GetAppxSignature(string appx)
        {
            string xmlFilePath = this.srcPath + appx + @"\AppxManifest.xml";
            XmlDocument xmldoc = new XmlDocument();
            XmlNodeReader reader = null;

            //string appId = null;
            string platform = null;
            string publisher = null;
            string version = null;
            string name = null;

            try
            {
                xmldoc.Load(xmlFilePath);
                XmlElement root = xmldoc.DocumentElement;
                root = xmldoc.DocumentElement;

                // using Node Reader
                reader = new XmlNodeReader(xmldoc);
                while (reader.Read())
                {
                    if (reader.NodeType.Equals(XmlNodeType.Element)
                        && reader.Name.Equals("Identity"))
                    {
                        platform = reader.GetAttribute("ProcessorArchitecture");
                        publisher = reader.GetAttribute("Publisher");
                        version = reader.GetAttribute("Version");
                        name = reader.GetAttribute("Name");
                        break;
                    }
                    //if (reader.NodeType.Equals(XmlNodeType.Element)
                    //    && reader.Name.Equals("Application"))
                    //{
                    //    appId = reader.GetAttribute("Id");
                    //}
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
            finally
            {
                if (null != reader)
                {
                    reader.Close();
                }
            }

            return string.Join("<br>", platform, publisher, version, name);
        }
开发者ID:jackaduma,项目名称:WindowsStoreCrawler,代码行数:56,代码来源:AppxPacker.cs

示例15: StartsWithElement

        /// <summary>
        /// Checks if the specified <see cref="node"/> starts with the specified <see cref="rootElementTagName"/>
        /// </summary>
        /// <param name="node">The node.</param>
        /// <param name="rootElementTagName">Name of the root element tag.</param>
        /// <returns><c>true</c> if the specified <see cref="node"/> starts with the specified <see cref="rootElementTagName"/>, <c>false</c> otherwise.</returns>
        public static bool StartsWithElement(this XmlNode node, string rootElementTagName)
        {
            var xmlReader = new XmlNodeReader(node);
            while (xmlReader.Read())
            {
                if (xmlReader.NodeType == XmlNodeType.Element)
                {
                    return xmlReader.LocalName.Equals(rootElementTagName);
                }
            }

            return false;
        }
开发者ID:SDMXISTATFRAMEWORK,项目名称:ISTAT_ENHANCED_SDMXRI_WS,代码行数:19,代码来源:InputExtension.cs


注:本文中的System.Xml.XmlNodeReader.Read方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。