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


C# XmlNodeReader.GetAttribute方法代碼示例

本文整理匯總了C#中System.Xml.XmlNodeReader.GetAttribute方法的典型用法代碼示例。如果您正苦於以下問題:C# XmlNodeReader.GetAttribute方法的具體用法?C# XmlNodeReader.GetAttribute怎麽用?C# XmlNodeReader.GetAttribute使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Xml.XmlNodeReader的用法示例。


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

示例1: 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

示例2: 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

示例3: GetXml

        /// <summary>
        /// 獲取XML
        /// </summary>
        /// <param name="xmlFile"></param>
        /// <returns></returns>
        // xmlFile = HttpContext.Server.MapPath("~/Student.xml")
        public string GetXml(string xmlFile)
        {
            string id = "";
            string Info = "";

            if (XmlDoc == null)
            {
                lock (DocLock)
                {
                    if (XmlDoc == null)
                    {
                        XmlDoc = new XmlDocument();
                        XmlDoc.Load(xmlFile);
                    }
                }
            }

            string Name = string.Empty;
            string _id = string.Empty;
            XmlElement root = XmlDoc.DocumentElement;
            XmlNodeList personNodes = root.GetElementsByTagName("person");
            foreach (XmlNode node in personNodes)
            {
                if (((XmlElement)node).GetAttribute("id") == "2" || ((XmlElement)node).GetAttribute("id") == "4")
                {
                    Name += ((XmlElement)node).InnerText;
                    _id += ((XmlElement)node).GetAttribute("id");
                    var str = node.GetEnumerator();
                }
            }

            XmlNodeReader ParaReader = new XmlNodeReader(XmlDoc);
            while (ParaReader.Read())
            {
                if (ParaReader.NodeType == XmlNodeType.Element && ParaReader.Name == "person")
                {
                    if (!string.IsNullOrEmpty(ParaReader.GetAttribute("id")))
                    {
                        id += ParaReader.GetAttribute("id") + "+";
                        Info += ParaReader.ReadInnerXml() + "+";

                    }
                    //if (f == "PaymentDate" && f == ParaReader.GetAttribute(0)) Info = ParaReader.GetAttribute(1);//Info = ParaReader.GetAttribute(1).Replace("{2}", Member.ValidBeginDate + "");//繳費
                    //if (f == "ReplacementDate" && f == ParaReader.GetAttribute(0)) Info = ParaReader.GetAttribute("value");//Info = ParaReader.GetAttribute("value").Replace("{2}", Member.ValidBeginDate + "").Replace("{3}", Member.ReplacementDate + "");  //換證 
                    //if (f == "ContributionsDate" && f == ParaReader.GetAttribute(0)) Info = ParaReader.GetAttribute("value"); //體檢 
                }
                string str = ParaReader.GetAttribute("id") + ParaReader.GetAttribute("sex") + ParaReader.ReadInnerXml();
            }
            ParaReader.Close();
            return System.Text.Encoding.GetEncoding("gb2312").GetString(System.Text.Encoding.Default.GetBytes(id + "\n" + Info));
        }
開發者ID:qinfengwangyi,項目名稱:Qin.Blog,代碼行數:57,代碼來源:XmlHelper.cs

示例4: 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

示例5: mergeChildNodes

 public static void mergeChildNodes(XmlDocument nolisExtDoc, XmlNode extNode, XmlNode rootNode, String uniqueIdAttribute)
 {
     IList itemList = new ArrayList();
     foreach (XmlNode itemNode in rootNode.ChildNodes)
     {
         if (itemNode.NodeType == XmlNodeType.Element)
         {
             XmlNodeReader reader = new XmlNodeReader(itemNode);
             reader.Read();
             String idAttributeValue = reader.GetAttribute(uniqueIdAttribute);
             //Console.WriteLine("idAttributeValue = " + idAttributeValue);
             reader.Close();
             Boolean isIdExist = false;
             foreach (XmlNode extItemNode in extNode.ChildNodes)
             {
                 if (extItemNode.NodeType == XmlNodeType.Element)
                 {
                     XmlNodeReader localReader = new XmlNodeReader(extItemNode);
                     localReader.Read();
                     String extIdAttributeValue = localReader.GetAttribute(uniqueIdAttribute);
                     Console.WriteLine("extIdAttributeValue = " + extIdAttributeValue);
                     localReader.Close();
                     if (extIdAttributeValue.Equals(idAttributeValue))
                     {
                         isIdExist = true;
                         break;
                     }
                 }
             }
             if (isIdExist)
             {
                 continue;
             }
             else
             {
                 itemList.Add(itemNode);
             }
         }
     }
     Console.WriteLine("size of itemList  = " + itemList.Count);
     foreach (Object objXmlNode in itemList)
     {
         XmlNode newNode = nolisExtDoc.ImportNode((XmlNode)objXmlNode, true);
         extNode.AppendChild(newNode);
     }
 }
開發者ID:harpreetoxyent,項目名稱:pnl,代碼行數:46,代碼來源:RenderUtil.cs

示例6: getIncludeList

 //�ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ��б��������
 public static string[] getIncludeList(ArrayList obList, ArrayList fileList, FileInfo obInfo, ClassFinder obFinder, ClassInfoFinder infoFinder)
 {
     if (File.Exists(obInfo.FullName))
     {
         XmlDocument xml = new XmlDocument();
         xml.Load(obInfo.FullName);
         XmlNodeReader reader = new XmlNodeReader(xml);
         while (reader.Read())
         {
             if (reader.NodeType == XmlNodeType.Element)
             {
                 if (reader.Name == "item")
                 {
                     string className = reader.GetAttribute("name");
                     string SkinClass_sign = reader.GetAttribute("skin");
                     if (SkinClass_sign == null)
                     {
                         string classPath = obFinder.getClassPath(className);
                         if (!File.Exists(classPath))
                             ErrorBox.Show(className + " cont find ", "ClassNameFinderError");
                         string infoPath = infoFinder.getClassPath(className);
                         if (File.Exists(infoPath))
                         {
                             if (fileList.IndexOf(infoPath) < 0)
                             {
                                 fileList.Add(infoPath);
                                 FileInfo subInfo = new FileInfo(infoPath);
                                 getIncludeList(obList, fileList, subInfo, obFinder, infoFinder);
                             }
                         }
                         else
                         {
                             ErrorBox.Show("className:" + className + "\r\nfileMissed:" + infoPath, "ClassNameFinderError");
                         }
                         ClassRelationsFinder ClassRelation = new ClassRelationsFinder(infoFinder);
                         for (int i = 0; i < obList.Count; i++)
                         {
                             if (obList.IndexOf(classPath) < 0)
                             {
                                 string testClass = obList[i] as string;
                                 FileInfo obTest = new FileInfo(testClass);
                                 FileInfo obFile = new FileInfo(classPath);
                                 if (ClassRelation.isSuper(obFile, obTest))
                                 {
                                     obList.Insert(i, classPath);
                                     break;
                                 }
                                 //else if (ClassRelation.isSuper(obTest, obFile))
                                 //{
                                 //    obList.Insert(i + 1, classPath);
                                 //    break;
                                 //}
                             }
                         }
                         if (obList.IndexOf(classPath) < 0)
                             obList.Add(classPath);
                     }
                     //�ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ���Դ�жϺ���
                 }
             }
             //�ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡνڵ��жϺ���
         }
     }
     return obList.ToArray(typeof(string)) as string[];
 }
開發者ID:r1ng0to3tour,項目名稱:swsplayer,代碼行數:66,代碼來源:ClassNameFinder.cs

示例7: readScheme

 //�ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡη�����ȡ����
 private void readScheme(string name)
 {
     ArrayList m_arrDataCollect = new ArrayList();
     XmlDocument xml = new XmlDocument();
     xml.Load(name);
     XmlNodeReader reader = new XmlNodeReader(xml);
     while (reader.Read())
     {
         switch (reader.NodeType)
         {
             case XmlNodeType.Element:
                 switch (reader.Name)
                 {
                     case "baseInfo":
                         m_nLetterDigit = int.Parse(reader.GetAttribute("length"));
                         m_nSafeCount = int.Parse(reader.GetAttribute("safeCount"));
                         break;
                     case "item":
                         string used = reader.GetAttribute("used");
                         bool blUsed = false;
                         if (used != null)
                         {
                             blUsed = (bool)used.Equals("true", StringComparison.OrdinalIgnoreCase);
                         }
                         if (blUsed)
                         {
                             m_arrDataCollect.Add(reader.GetAttribute("data"));
                         }
                         break;
                     case "exClude":
                         m_arrExclude.Add(reader.GetAttribute("name"));
                         break;
                 }
                 break;
         }
     }
     if (reader != null)
     {
         reader.Close();
     }
     for (int i = 0; i < m_arrDataCollect.Count; i++)
     {
         string data = m_arrDataCollect[i].ToString();
         for (int j = 0; j < data.Length; j++)
         {
             m_arrData.Add(data[j].ToString());
         }
     }
 }
開發者ID:r1ng0to3tour,項目名稱:swsplayer,代碼行數:50,代碼來源:MixerSchemeDescribe.cs

示例8: getList

 //�ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡνڵ��ȡ����
 private static ArrayList getList(XmlNode subX)
 {
     ArrayList arr = new ArrayList();
     XmlNodeReader reader = new XmlNodeReader(subX);
     while (reader.Read())
     {
         if (reader.NodeType == XmlNodeType.Element)
         {
             ArrayList subArr = null;
             if (reader.Name == "item")
             {
                 subArr = new ArrayList();
                 string stName = reader.GetAttribute("name");
                 subArr.Add(stName);
                 arr.Add(subArr);
             }
             if (reader.Name == "str")
             {
                 subArr = arr[arr.Count - 1] as ArrayList;
                 string stName = reader.GetAttribute("name");
                 subArr.Add(stName);
             }
             if (reader.Name == "chat")
             {
                 subArr = arr[arr.Count - 1] as ArrayList;
                 string stName = reader.GetAttribute("name");
                 string stPrefix = reader.GetAttribute("prefix");
                 ArrayList arrLink = new ArrayList();
                 arrLink.Add(stPrefix);
                 arrLink.Add(stName);
                 subArr.Add(arrLink);
             }
         }
     }
     reader.Close();
     return arr;
 }
開發者ID:r1ng0to3tour,項目名稱:swsplayer,代碼行數:38,代碼來源:ChatSender.cs

示例9: convertFromXml

        /// <summary>
        /// Removing this from the IXmlSerializable Implementation because engineers keep exposing the SerialzableDictionary object
        /// and that cannot be allowed because nobody else can deserialize.  It is for persistance only so the logic was moved here.
        /// </summary>
        /// <param name="doc">The doc.</param>
        /// <returns></returns>
        private IList<string> convertFromXml(XmlDocument doc)
        {
            XmlReader reader = new XmlNodeReader(doc);

            //First check empty element and return if found
            bool wasEmpty = reader.IsEmptyElement;
            reader.Read();
            if (wasEmpty)
                return null;

            IList<string> result = new List<string>();
            reader.ReadStartElement(DocumentElement);

            if (reader.NodeType != XmlNodeType.Element)
                return result;

            //Loop through the nodes representing this object in the reader
            while (reader.NodeType != XmlNodeType.EndElement)
            {
                //First try the optimized format
                //string key = reader.GetAttribute(KEY_ATTRIBUTE);
                string typeName = reader.GetAttribute(TYPE_ATTRIBUTE);

                //Read the Xml element representing a new key & value pair
                reader.ReadStartElement(ITEM_ELEMENT);

                //if (String.IsNullOrEmpty(key))
                //{
                //    //Key is not being stoed as an attribute - this must be xml in the old format
                //    //KEEP THIS CODE FOR BACKWARDS COMPATIBILITY

                //    //First we need to get the type of the object written to the Xml during serialization so that
                //    //we can create a new serializer that understands how to deserialize this type.
                //    typeName = reader.GetAttribute(TYPE_ATTRIBUTE);

                //    //Read the Xml element representing the key in this key & value pair
                //    reader.ReadStartElement(KEY_ELEMENT);

                //    //Allright now create the serializer and deserialize the defined object type
                //    XmlSerializer keySerializer = new XmlSerializer(typeof(string));
                //    //key = (string)keySerializer.Deserialize(reader);

                //    if (key == null)
                //        throw new ApplicationException(String.Format("Null key encountered on line {0}",
                //                                                       reader.Depth));

                //    //Read the end of the key element
                //    reader.ReadEndElement();
                //}

                Type valuetype = (typeName != null ? Type.GetType(typeName) : typeof(object)) ?? typeof(object);

                //Read the Xml element representing the value in this key & value pair
                reader.ReadStartElement(VALUE_ELEMENT);

                //Now create the serialize and deserialize the object type defined from the type attribute
                XmlSerializer valueSerializer = new XmlSerializer(valuetype);

                //HACK!!!
                //Make sure you catch any errors caused by invalid types cannot be deserialized. For example this whole process
                //kept blowing up because the type ould not be serialized.
                string value;// = (TValue) valueSerializer.Deserialize(reader);
                try { value = (string)valueSerializer.Deserialize(reader); }
                catch (Exception)
                {
                    value = default(string);
                    //skip top the end of the current element
                    reader.Skip();
                }

                //Read the end of the value element
                reader.ReadEndElement();

                //Now add the deserialized objects to the hashtable.
                result.Add(value);

                //Read the end of the element holding the key and value elements
                if (reader.NodeType == XmlNodeType.EndElement && reader.LocalName == ITEM_ELEMENT)
                    reader.ReadEndElement();
                reader.MoveToContent();
            }

            //All done - read the ending element
            reader.ReadEndElement();

            return result;
        }
開發者ID:jd-pantheon,項目名稱:Titan-Framework-v2,代碼行數:93,代碼來源:SerializableStringListType.cs

示例10: read_browse

        private static void read_browse(bool Browse, XmlNodeReader NodeReader, Complete_Item_Aggregation HierarchyObject)
        {
            // Create a new browse/info object
            Complete_Item_Aggregation_Child_Page newBrowse = new Complete_Item_Aggregation_Child_Page
                                {
                                    Browse_Type = Item_Aggregation_Child_Visibility_Enum.Main_Menu,
                                    Source_Data_Type = Item_Aggregation_Child_Source_Data_Enum.Static_HTML
                                };

            bool isDefault = false;

            // Determine which XML node name to look for and set browse v. info
            string lastName = "HI:BROWSE";
            if (!Browse)
            {
                lastName = "HI:INFO";
                newBrowse.Browse_Type = Item_Aggregation_Child_Visibility_Enum.None;
            }

            // Check for the attributes
            if (NodeReader.HasAttributes)
            {
                if (NodeReader.MoveToAttribute("location"))
                {
                    if (NodeReader.Value == "BROWSEBY")
                        newBrowse.Browse_Type = Item_Aggregation_Child_Visibility_Enum.Metadata_Browse_By;
                }
                if (NodeReader.MoveToAttribute("default"))
                {
                    if (NodeReader.Value == "DEFAULT")
                        isDefault = true;
                }
                if (NodeReader.MoveToAttribute("visibility"))
                {
                    switch (NodeReader.Value)
                    {
                        case "NONE":
                            newBrowse.Browse_Type = Item_Aggregation_Child_Visibility_Enum.None;
                            break;

                        case "MAIN_MENU":
                            newBrowse.Browse_Type = Item_Aggregation_Child_Visibility_Enum.Main_Menu;
                            break;

                        case "BROWSEBY":
                            newBrowse.Browse_Type = Item_Aggregation_Child_Visibility_Enum.Metadata_Browse_By;
                            break;
                    }
                }
                if (NodeReader.MoveToAttribute("parent"))
                {
                    newBrowse.Parent_Code = NodeReader.Value;
                }
            }

            // Step through the XML and build this browse/info object
            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:METADATA":
                            NodeReader.Read();
                            newBrowse.Code = NodeReader.Value.ToLower();
                            newBrowse.Source_Data_Type = Item_Aggregation_Child_Source_Data_Enum.Database_Table;
                            break;

                        case "HI:CODE":
                            NodeReader.Read();
                            newBrowse.Code = NodeReader.Value.ToLower();
                            break;

                        case "HI:TITLE":
                            // Look for a language attached to this title
                            string titleLanguage = String.Empty;
                            if ((NodeReader.HasAttributes) && ( NodeReader.MoveToAttribute("lang")))
                            {
                                titleLanguage = NodeReader.GetAttribute("lang");
                            }

                            // read and save the title
                            NodeReader.Read();
                            newBrowse.Add_Label( NodeReader.Value, Web_Language_Enum_Converter.Code_To_Enum(titleLanguage));
                            break;

                        case "HI:BODY":
                            // Look for a language attached to this title
                            string bodyLanguage = String.Empty;
                            if ((NodeReader.HasAttributes) && (NodeReader.MoveToAttribute("lang")))
                            {
                                bodyLanguage = NodeReader.GetAttribute("lang");
                            }

                            // read and save the title
//.........這裏部分代碼省略.........
開發者ID:Elkolt,項目名稱:SobekCM-Web-Application,代碼行數:101,代碼來源:Item_Aggregation_XML_Reader.cs

示例11: read_settings

        private static void read_settings(XmlNodeReader NodeReader, Complete_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:WEBSKINS":
                            NodeReader.Read();
                            string webskins = NodeReader.Value;
                            string[] splitter = webskins.Split(",".ToCharArray());
                            foreach (string thisSplitter in splitter)
                            {
                                if ( thisSplitter.Length > 0 )
                                    HierarchyObject.Add_Web_Skin(thisSplitter.ToLower());
                            }
                            break;

                        case "HI:CSS":
                            NodeReader.Read();
                            HierarchyObject.CSS_File = NodeReader.Value.Trim();
                            break;

                        case "HI:CUSTOMHOME":
                            NodeReader.Read();
                            // No longer do anything with this tag
                            // HierarchyObject.Custom_Home_Page_Source_File = NodeReader.Value.Trim();
                            break;

                        case "HI:FACETS":
                            NodeReader.Read();
                            string facets = NodeReader.Value;
                            string[] splitter2 = facets.Split(",".ToCharArray());
                            HierarchyObject.Clear_Facets();
                            foreach (string thisSplitter2 in splitter2)
                            {
                                    HierarchyObject.Add_Facet(Convert.ToInt16(thisSplitter2));
                            }
                            break;

                        case "HI:MAPSEARCH":
                            if (NodeReader.MoveToAttribute("type"))
                            {
                                switch (NodeReader.GetAttribute("type").ToLower())
                                {
                                    case "extent":
                                    case "computed":
                                        // This should already be set, assuming there were values to be added
                                        if (HierarchyObject.Map_Search_Display == null)
                                        {
                                            HierarchyObject.Map_Search_Display = new Item_Aggregation_Map_Coverage_Info(Item_Aggregation_Map_Coverage_Type_Enum.COMPUTED);
                                        }
                                        break;

                                    case "fixed":
                                        decimal latitude = 999;
                                        decimal longitude = 999;
                                        int zoom = 999;

                                        if (NodeReader.MoveToAttribute("latitude"))
                                        {
                                            Decimal.TryParse(NodeReader.GetAttribute("latitude"), out latitude);
                                        }
                                        if (NodeReader.MoveToAttribute("longitude"))
                                        {
                                            Decimal.TryParse(NodeReader.GetAttribute("longitude"), out longitude);
                                        }
                                        if (NodeReader.MoveToAttribute("zoom"))
                                        {
                                            Int32.TryParse(NodeReader.GetAttribute("zoom"), out zoom);
                                        }

                                        if ((latitude != 999) && (longitude != 999))
                                        {
                                            HierarchyObject.Map_Search_Display = new Item_Aggregation_Map_Coverage_Info(Item_Aggregation_Map_Coverage_Type_Enum.FIXED, zoom, longitude, latitude );
                                        }
                                        break;
                                }
                            }
                            break;

                        case "HI:MAPBROWSE":
                            if (NodeReader.MoveToAttribute("type"))
                            {
                                switch (NodeReader.GetAttribute("type").ToLower())
                                {
                                    case "extent":
                                        HierarchyObject.Map_Browse_Display = new Item_Aggregation_Map_Coverage_Info(Item_Aggregation_Map_Coverage_Type_Enum.EXTENT);
                                        break;

                                    case "computed":
                                        HierarchyObject.Map_Browse_Display = new Item_Aggregation_Map_Coverage_Info(Item_Aggregation_Map_Coverage_Type_Enum.COMPUTED);
                                        break;

//.........這裏部分代碼省略.........
開發者ID:Elkolt,項目名稱:SobekCM-Web-Application,代碼行數:101,代碼來源:Item_Aggregation_XML_Reader.cs

示例12: readMapList

 //�ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡζ˿ڶ�ȡ����
 private static void readMapList()
 {
     XmlDocument xml = new XmlDocument();
     string filePath = RootConfig.DriverMapConfig;
     if (m_arrDriver == null)
     {
         m_arrDriver = new ArrayList();
         m_arrFolder = new ArrayList();
         m_arrLabel = new ArrayList();
     }
     if (File.Exists(filePath))
     {
         FileStream fs = new FileStream(filePath, FileMode.Open);
         try
         {
             xml.Load(fs);
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.ToString());
         }
         XmlNode subXml = HxmlReader.getData(xml);
         if (subXml != null)
         {
             XmlNodeReader reader = new XmlNodeReader(subXml);
             while (reader.Read())
             {
                 if (reader.NodeType == XmlNodeType.Element)
                 {
                     if (reader.Name == "item")
                     {
                         string stDriverName = reader.GetAttribute("name");
                         string stPath = reader.GetAttribute("path");
                         string stLabel = reader.GetAttribute("label");
                         DirectoryInfo di = new DirectoryInfo(stPath);
                         if (stDriverName != null && di.Exists)
                         {
                             m_arrDriver.Add(stDriverName.ToUpper());
                             m_arrFolder.Add(stPath);
                             m_arrLabel.Add(stLabel);
                         }
                     }
                 }
             }
             fs.Close();
         }
     }
 }
開發者ID:r1ng0to3tour,項目名稱:swsplayer,代碼行數:49,代碼來源:DiskMap.cs

示例13: ReadFromXml

        public ReadFromXml(string instr)
        {
            string sOID = ""; //start object id
            string sPID = ""; //start point id
            string eOID = ""; //end object id
            string ePID = ""; //end point id

            cdList = new ArrayList();
            cnList = new ArrayList();
            ccList = new ArrayList();

            Node a = new Node("123","789"); //dummy
            cnList.Add(a);

            //Create XML DOM instance
            XmlDocument document = new XmlDocument();
            document.LoadXml(instr);
            //Select all graphic object elements and connections
            XmlNodeList objList1 = document.SelectNodes("//graphicObject");
            XmlNodeList objList2 = document.SelectNodes("//connection");

            int countDevice=0;

            int countResistor=1;
            int countCapacitor=1;
            int countInductor=1;
            int countTransitor=1;
            int countVDC=1;
            int countVAC=1;
            int countCsource=1;
            int countGround =1;
            int countJFET =1;
            int countOpamp=1;
            int countDiode=1;

            foreach(XmlNode objNode in objList1)
            {
                XmlNodeReader objNodeReader = new XmlNodeReader(objNode);

                while(objNodeReader.Read())	//read thru all child nodes of this node
                {
                    if(objNodeReader.NodeType == XmlNodeType.Element)	//	***READING NODES AND DEVICE***
                    {
                        if(objNodeReader.Name == "graphicObject")
                        {
                            objID = objNodeReader.GetAttribute("id");	// to read the id attribute of the element
                            template = objNodeReader.GetAttribute("template");	// to read the template attribute of the element, test if it is Capacitor, Resistor or others
                            type = objNodeReader.GetAttribute("type");	// to read the type attribute of the element, test if it is a link node.

                            switch ( template )	// typecast to specific type of device.
                            {
                                case "Resistor" :
                                    device = (Resistor)new Resistor(objID, "" + countDevice);    //chester
                                    countDevice++;
                                    countResistor++;
                                    break;

                                case "VsourceDC" :
                                    device = (VsourceDC)new VsourceDC(objID, ""+countDevice);       //chester
                                    countDevice++;
                                    countVDC++;
                                    break;

                                case "Inductor" :
                                    //device = (Inductor) new Inductor(objID,""+countDevice);
                                    device = (Inductor) new Inductor(objID,""+countInductor);
                                    countInductor++;
                                    //countDevice++;
                                    break;
                                case "Capacitor" :
                                    //device = (Capacitor) new Capacitor(objID,""+countDevice);
                                    device = (Capacitor)new Capacitor(objID, "" + countCapacitor);
                                    countCapacitor++;
                                    //countDevice++;
                                    break;
                                case "VsourceAC" :
                                    //device = (VsourceAC) new VsourceAC(objID,""+countDevice);
                                    device = (VsourceAC) new VsourceAC(objID,""+countVAC);
                                    countVAC++;
                                    //countDevice++;
                                    break;
                                case "Csource" :
                                    //device = (Csource) new Csource(objID,""+countDevice);
                                    device = (Csource) new Csource(objID,""+countCsource);
                                    countCsource++;
                                    break;
                                case "Diode" :
                                    device = (Diode) new Diode(objID,""+countDiode);
                                    countDiode++;
                                    break;
                                case "Transitor" :
                                    //device = (Transitor) new Transitor(objID,""+countDevice);
                                    device = (Transitor)new Transitor(objID, "" + countTransitor);
                                    countTransitor++;
                                    //countDevice++;
                                    break;
                                case "Ground" :
                                    device = (Ground) new Ground(objID,""+countGround);
                                    countGround++;
                                    break;
//.........這裏部分代碼省略.........
開發者ID:sanyaade-g2g-repos,項目名稱:quickdiagram,代碼行數:101,代碼來源:Structure.cs

示例14: read_browse

        private static void read_browse(bool browse, XmlNodeReader nodeReader, Item_Aggregation hierarchyObject )
        {
            // Create a new browse/info object
            Item_Aggregation_Browse_Info newBrowse = new Item_Aggregation_Browse_Info
                                {
                                    Browse_Type = Item_Aggregation_Browse_Info.Browse_Info_Type.Browse_Home,
                                    Source = Item_Aggregation_Browse_Info.Source_Type.Static_HTML,
                                    Data_Type = Item_Aggregation_Browse_Info.Result_Data_Type.Text
                                };

            bool isDefault = false;

            string code = String.Empty;

            // Determine which XML node name to look for and set browse v. info
            string lastName = "HI:BROWSE";
            if (!browse)
            {
                lastName = "HI:INFO";
                newBrowse.Browse_Type = Item_Aggregation_Browse_Info.Browse_Info_Type.Info;
            }

            // Check for the attributes
            if (nodeReader.HasAttributes)
            {
                if (nodeReader.MoveToAttribute("location"))
                {
                    if (nodeReader.Value == "BROWSEBY")
                        newBrowse.Browse_Type = Item_Aggregation_Browse_Info.Browse_Info_Type.Browse_By;
                }
                if (nodeReader.MoveToAttribute("default"))
                {
                    if (nodeReader.Value == "DEFAULT")
                        isDefault = true;
                }
            }

            // Step through the XML and build this browse/info object
            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:METADATA":
                            nodeReader.Read();
                            newBrowse.Code = nodeReader.Value.ToLower();
                            newBrowse.Source = Item_Aggregation_Browse_Info.Source_Type.Database;
                            newBrowse.Data_Type = Item_Aggregation_Browse_Info.Result_Data_Type.Table;
                            break;

                        case "HI:CODE":
                            nodeReader.Read();
                            newBrowse.Code = nodeReader.Value.ToLower();
                            break;

                        case "HI:TITLE":
                            // Look for a language attached to this title
                            string titleLanguage = String.Empty;
                            if ((nodeReader.HasAttributes) && ( nodeReader.MoveToAttribute("lang")))
                            {
                                titleLanguage = nodeReader.GetAttribute("lang");
                            }

                            // read and save the title
                            nodeReader.Read();
                            newBrowse.Add_Label( nodeReader.Value, Web_Language_Enum_Converter.Code_To_Enum(titleLanguage));
                            break;

                        case "HI:BODY":
                            // Look for a language attached to this title
                            string bodyLanguage = String.Empty;
                            if ((nodeReader.HasAttributes) && (nodeReader.MoveToAttribute("lang")))
                            {
                                bodyLanguage = nodeReader.GetAttribute("lang");
                            }

                            // read and save the title
                            nodeReader.Read();
                            string bodySource = nodeReader.Value;
                            newBrowse.Add_Static_HTML_Source(bodySource, Web_Language_Enum_Converter.Code_To_Enum(bodyLanguage));
                            break;
                    }
                }

                if (nodeReader.NodeType == XmlNodeType.EndElement)
                {
                    if (nodeReader.Name.Trim().ToUpper() == lastName )
                    {
                        hierarchyObject.Add_Browse_Info(newBrowse);

                        // If this set the default browse by save that information
                        if ((newBrowse.Browse_Type == Item_Aggregation_Browse_Info.Browse_Info_Type.Browse_By) && (isDefault))
                        {
                            hierarchyObject.Default_BrowseBy = newBrowse.Code;
//.........這裏部分代碼省略.........
開發者ID:randomyed,項目名稱:SobekCM-Web-Application,代碼行數:101,代碼來源:Item_Aggregation_XML_Reader.cs

示例15: Suggest

        //******************  添加智能提示的列表  ******************************
        public void Suggest()
        {
            AutoCompleteStringCollection acsc = new AutoCompleteStringCollection();
            ComboBoxItem cbi1 = new ComboBoxItem();
            string s = "";
            XmlDocument doc = new XmlDocument();

            try
            {
                doc.Load(AppSetting.xmlPath);
            }
            catch
            {
                if (System.IO.File.Exists(AppSetting.xmlPath))
                {
                    MessageBox.Show("消息內容", "讀取文件" + AppSetting.xmlPath + "錯誤!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    DoXml.CreateExec();
                }

            }

            XmlNodeReader reader = new XmlNodeReader(doc);
            // 讀取XML文件中的數據,並顯示出來
            while (reader.Read())
            {
                //判斷當前讀取得節點類型
                switch (reader.NodeType)
                {
                    case XmlNodeType.Element:
                        s = reader.Name;
                        if (s.Equals(AppSetting.keyWord))
                        {

                            cbi1.Text = reader.GetAttribute(0);
                            cbi1.Value = reader.GetAttribute(1);

                            acsc.Add(cbi1.Text);
                        }
                        break;

                }
            }
            this.comboBox1.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
            this.comboBox1.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.CustomSource;
            this.comboBox1.AutoCompleteCustomSource = acsc;
        }
開發者ID:chusiping,項目名稱:fasta,代碼行數:50,代碼來源:Main.cs


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