MoveToNextAttribute() public method

public MoveToNextAttribute ( ) : bool
return bool
Exemplo n.º 1
0
Arquivo: Hall.cs Projeto: ffblk/epam
 public static void ListPlaces()
 {
     string siteDir = HttpContext.Current.Server.MapPath(@"\");
     XmlTextReader reader = new XmlTextReader(siteDir + InputFile);
     Hall pList = new Hall();
     Places p = null;
     int category = 0;
     int series = 0;
     int place = 0;
     while (reader.Read())
     {
         if (reader.NodeType == XmlNodeType.Element)
         {
             switch (reader.Name)
             {
                 case "category":
                     reader.MoveToNextAttribute();
                     category = Int32.Parse(reader.Value);
                     break;
                 case "row":
                     reader.MoveToNextAttribute();
                     series = Int32.Parse(reader.Value);
                     break;
                 case "seat":
                     reader.Read();
                     place = Int32.Parse(reader.Value);
                     p = new Places(series, place, category);
                     pList.Add(p);
                     break;
             }
         }
     }
 }
Exemplo n.º 2
0
 public List<string> LoadVideoFile(string file)
 {
     List<string> videos = new List<string>();
     using (XmlReader reader = new XmlTextReader(file))
     {
         do
         {
             switch (reader.NodeType)
             {
                 case XmlNodeType.Element:
                     reader.MoveToFirstAttribute();
                     title.Add(reader.Value);
                     reader.MoveToNextAttribute();
                     author.Add(reader.Value);
                     reader.MoveToNextAttribute();
                     videos.Add(reader.Value);
                     WriteXNBVideoData(reader.Value);
                     break;
             }
         } while (reader.Read());
     }
     title.RemoveAt(0);
     author.RemoveAt(0);
     videos.RemoveAt(0);
     return videos;
 }
Exemplo n.º 3
0
        public void readXml()
        {
            using (XmlTextReader reader = new XmlTextReader("dump.xml"))
            {
                reader.ReadToFollowing("range");
                while (reader.EOF == false)
                {

                    reader.MoveToFirstAttribute();
                    rangeNameList.Add(reader.Value);
                    reader.MoveToNextAttribute();
                    string temp = (reader.Value);
                    rangeNameList.Add(temp);
                    rangeStartList.Add(Int32.Parse(reader.Value, System.Globalization.NumberStyles.HexNumber));
                    reader.MoveToNextAttribute();
                    temp = (reader.Value);
                    rangeNameList.Add(temp);
                    int temp1 = (Int32.Parse(reader.Value, System.Globalization.NumberStyles.HexNumber));
                    int temp2 = rangeStartList[rangeStartList.Count-1];
                    rangeLengthList.Add(temp1-temp2);

                    reader.ReadToFollowing("range");
                }

            }
        }
Exemplo n.º 4
0
 public string GetJumpUrlToNextPage(System.Web.HttpServerUtility server,string url, string valueKey)
 {
     if (!url.ToLower().Contains(".xml"))
     {
         url += ".xml";
     }
     XmlTextReader objXMLReader = new XmlTextReader(server.MapPath(url));
     string strNodeResult = "";
     while (objXMLReader.Read())
     {
         if (objXMLReader.NodeType.Equals(XmlNodeType.Element))
         {
             if (objXMLReader.AttributeCount > 0)
             {
                 while (objXMLReader.MoveToNextAttribute())
                 {
                     if ("id".Equals(objXMLReader.Name) && valueKey.Equals(objXMLReader.Value))
                     {
                         if (objXMLReader.MoveToNextAttribute())
                         {
                             strNodeResult = objXMLReader.Value;
                         }
                     }
                 }
             }
         }
     }
     return strNodeResult;
 }
Exemplo n.º 5
0
		/**
		 *  Instantiate the sprites variable using SCMLPath in S2USettings
		 * */
		public void Build ()
		{
			string pathScml = S2USettings.Settings.ScmlPath;
			string folderPath = pathScml.Substring (0, pathScml.LastIndexOf ("/") + 1);

			if (!File.Exists (pathScml)) {
				Debug.LogErrorFormat ("Unable to open SCML Follower File '{0}'. Reason: File does not exist", pathScml);
				return;
			}


			int id = 0;
			int folderId = 0;
	
			XmlTextReader reader = new XmlTextReader (pathScml);

			while (reader.Read()) {
				switch (reader.NodeType) {
				case XmlNodeType.Element: // The node is an element.
					if (reader.Name == "folder") {
						
						while (reader.MoveToNextAttribute()) { // Read the attributes.
							if (reader.Name == "id") {
								folderId = Int32.Parse (reader.Value);
								sprites.Add (folderId, new List<Sprite> ());
							}
						}
					}
					if (reader.Name == "file") {
						while (reader.MoveToNextAttribute()) { // Read the attributes.
							if (reader.Name == "id") {
								id = Int32.Parse (reader.Value);
							}
							if (reader.Name == "name") {
								sprites [folderId].Insert (id, (Sprite)AssetDatabase.LoadAssetAtPath (folderPath + reader.Value, typeof(Sprite)));

								if (sprites [folderId] [id] == null) {
									Debug.LogErrorFormat ("Sprite {0} is missing from ressources, this might cause issues", reader.Value);
								}
							}
							
						}
					}

					break;
				}
			}
			reader.Close ();
		}
Exemplo n.º 6
0
        public override void Cargar(XmlTextReader reader, ETLConfig configuracion)
        {
            if ((reader.NodeType != XmlNodeType.Element) ||
                (reader.Name != entidad))
            {
                ErrorEntidad(entidad);
            }

            string id    = null;
            string val   = null;

            // carga los atributos
            while (reader.MoveToNextAttribute())
            {
                switch (reader.Name)
                {
                    case "id"   : id    = reader.Value; break;
                    case "val"  : val   = reader.Value; break;
                    default     : ErrorAtributo(entidad,
                        reader.Name, reader.Value, reader.LineNumber);
                        break;
                }
            }
            // carga el id
            if (id != null) this.id = id;
            // carga el valor
            if (val != null) this.valor = val;
        }
Exemplo n.º 7
0
        ///// <summary>
        ///// Listener for data Binding
        ///// </summary>
        //private void ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
        //{
        //    uperBorder = (float)uper.Value;
        //}
        ///// <summary>
        ///// Sets the Slider of the Properties Views
        ///// </summary>
        //public void changeValue(double noise){
        //    uper.Value =noise;
        //    this.ValueChanged(this,null);
        //}
        ///// <summary>
        ///// Gets the Slider of the Properties Views
        ///// </summary>
        //public float getValue(){
        //    return uperBorder;
        //}
        /// <summary>
        /// Sets the Language Content and reads it from an XML File.
        /// </summary>
        public void local(String s)
        {
            try{
                String sFilename = Directory.GetCurrentDirectory() + "/" + s;
                XmlTextReader reader = new XmlTextReader(sFilename);
                reader.Read();
                reader.Read();
                String[] t = new String[1];
                String[] t2 = new String[1];

                    reader.Read();
                    reader.Read();
                    t[0] = reader.Name;
                    reader.MoveToNextAttribute();
                    t2[0] = reader.Value;
                    if (t2[0] == "")
                    {
                        throw new XmlException("datei nicht lang genug");
                    }

                label1.Content = t2[0];
               }
               catch (IndexOutOfRangeException) { }
               catch (FileNotFoundException) { }
               catch (XmlException) { }
        }
Exemplo n.º 8
0
        /// <summary>
        /// Liest die Werte von einem Attributs eines Datenquellen-verknüpften Feldes aus einer OpenDocument 1.2-basierter Datei aus
        /// mögliche Attribute: text:table-name, text:column-name, text:database-name, text:table-type
        /// </summary>
        /// <param name="filePath">auszulesende Datei</param>
        /// <param name="attribute">auszulesendes Attribut</param>
        /// <returns>Liste von Strings</returns>
        public static IEnumerable<string> GetDatabaseFieldAttributeFromODT(string filePath, string attribute)
        {
            IList<string> attributeValues = new List<string>();

            try
            {
                using (ZipFile zip = ZipFile.Read(filePath))
                {
                    using (var stream = zip["content.xml"].OpenReader())
                    {
                        using (var content = new StreamReader(stream))
                        {
                            using (var xmlReader = new XmlTextReader(content))
                            {
                                while (xmlReader.Read())
                                {
                                    if (xmlReader.NodeType == XmlNodeType.Element)             // check for XML node
                                        if (xmlReader.Name == "text:database-display")         // this is the tag indicating a link to an db/csv value
                                            while (xmlReader.MoveToNextAttribute())            // read its attributes
                                                if (xmlReader.Name == attribute)               // check if it is the attribute we are looking for
                                                    attributeValues.Add(xmlReader.Value);
                                }

                                return attributeValues;
                            }
                        }
                    }
                }
            }
            catch
            {
                return attributeValues;
            }
        }
Exemplo n.º 9
0
 public void HandleFurnidata(string[] items)
 {
     int count = 0;
     int error = 0;
     XmlTextReader reader = new XmlTextReader("figuremap.xml");
     WebClient webClient = new WebClient();
     string production = "";
     Console.WriteLine("Name the SWF Build (for example: PRODUCTION-201507062205-18729)");
     production = Console.ReadLine();
     while(reader.Read())
     {
         if (reader.Name == "lib" && reader.NodeType == XmlNodeType.Element)
         {
             while (reader.MoveToNextAttribute())
             {
                 int idk = 0;
                 if (reader.Name == "id" && !int.TryParse(reader.Value, out idk))
                 {
                     try
                     {
                         Console.Write("Downloading cloth " + reader.Value + "                  ");
                         Console.SetCursorPosition(0, Console.CursorTop);
                         webClient.DownloadFile("http://images-eussl.habbo.com/dcr/gordon/" + production + "/" + reader.Value + ".swf", "swfs/clothes/" + reader.Value + ".swf");
                         count++;
                     }
                     catch
                     {
                         error++;
                     }
                 }
             }
         }
     }
     Console.WriteLine("Finished (" + count + " successful, " + error + " errors)! Press the any key for the main menu.");
 }
 protected void Button1_Click(object sender, EventArgs e)
 {
     XmlTextReader reader = null;                             //Creating the XML Text Reader for traversing the XML document
     try
     {
         reader = new XmlTextReader(TextBox1.Text);            //entering the xml url in the Textbox
         reader.WhitespaceHandling = WhitespaceHandling.None;  //removing the whitespaces
         while(reader.Read())
         {
             rs += "TYPE = " + reader.NodeType + "\t";
             rs += "NAME = " + reader.Name + "\t";
             rs += "VALUE = " + reader.Value + "\t";
             rs += " <br/>";
         }
         if(reader.AttributeCount > 0)
         {
             while(reader.MoveToNextAttribute())                //traversing the nodes and attributes
             {
                 rs += "TYPE = " + reader.NodeType + "\t";
                 rs += "NAME = " + reader.Name + "\t";
                 rs += "VALUE = " + reader.Value + "\t";
                 rs += "<br/>";
             }
         }
     }
     finally
     {
         if (reader != null)
             reader.Close();
     }
     Label2.Text = rs;                                      //displaying the output in the label
     Label2.Visible = true;
 }
Exemplo n.º 11
0
        private void local(string s)
        {
            try
            {
                String sFilename = Directory.GetCurrentDirectory() + "/" + s;
                XmlTextReader reader = new XmlTextReader(sFilename);
                reader.Read();
                reader.Read();
                String[] t = new String[6];
                String[] t2 = new String[6];
                for (int i = 0; i < 6; i++)
                {
                    reader.Read();
                    reader.Read();
                    t[i] = reader.Name;
                    reader.MoveToNextAttribute();
                    t2[i] = reader.Value;
                }
                gb1.Header = t2[5];

            }
            catch (IndexOutOfRangeException) { }
            catch (FileNotFoundException) { }
            catch (XmlException) { }
        }
Exemplo n.º 12
0
        public List<ProgramElement> Parse(string filename)
        {
            var programElements = new List<ProgramElement>();

            XmlTextReader reader = new XmlTextReader(filename);

            while (reader.Read())
            {
                string text = String.Empty;

                if (reader.NodeType == XmlNodeType.Text)
                {
                    text = reader.Value;
                }
                else if (reader.NodeType == XmlNodeType.Element)
                {
                    while (reader.MoveToNextAttribute())
                    {
                        text += reader.Value + " ";
                    }
                }

                if (!String.IsNullOrWhiteSpace(text))
                {
                    var cleanedText = text.TrimStart(' ', '\n', '\r', '\t');
                    cleanedText = cleanedText.TrimEnd(' ', '\n', '\r', '\t');
                    var linenum = reader.LineNumber;
                    var snippet = SrcMLParsingUtils.RetrieveSource(cleanedText);
                    var pe = new TextFileElement(filename, snippet, cleanedText);
                    programElements.Add(pe);
                }
            }

            return programElements;
        }
Exemplo n.º 13
0
        public static void Main(string[] args)
        {
            XmlTextReader xmlReader = new XmlTextReader ("Book.xml");

            while(xmlReader.Read()){
                switch (xmlReader.NodeType) {

                case XmlNodeType.Element:
                    Console.WriteLine ("This is XmlNodeType.Element");
                    Console.Write ("<" + xmlReader.Name);

                    //Reading Attributes of XML Element
                    while (xmlReader.MoveToNextAttribute()) // Read the attributes.
                        Console.Write(" " + xmlReader.Name + "='" + xmlReader.Value + "'");
                    //
                    Console.WriteLine (">");
                    break;

                case XmlNodeType.Text: //Display the text in each element.
                    Console.WriteLine("This is xmlNodeType.Text");
                    Console.WriteLine (xmlReader.Value);
                    break;

                case XmlNodeType.EndElement: //Display the end of the element.
                    Console.WriteLine("This is xmlNodeType.EndElement");
                    Console.Write("</" + xmlReader.Name);
                    Console.WriteLine(">");
                    break;
                }
            }
            Console.WriteLine ("XMl Reading Has Completed");
        }
        public void LoadSettings()
        {
            if (!File.Exists("settings.xml")) return;

            var reader = new XmlTextReader("settings.xml");

            while (reader.Read())
            {
                switch (reader.NodeType)
                {
                    case XmlNodeType.Element: // The node is an element.
                        Console.Write("<" + reader.Name);

                        while (reader.MoveToNextAttribute()) // Read the attributes.
                            Console.Write(" " + reader.Name + "='" + reader.Value + "'");
                        Console.WriteLine(">");
                        break;
                    case XmlNodeType.Text: //Display the text in each element.
                        Console.WriteLine(reader.Value);
                        break;
                    case XmlNodeType.EndElement: //Display the end of the element.
                        Console.Write("</" + reader.Name);
                        Console.WriteLine(">");
                        break;
                }
            }
        }
        private int EnumerateAttributes(string elementStartTag, Action<int, int, string> onAttributeSpotted)
        {
            bool selfClosed = (elementStartTag.EndsWith("/>", StringComparison.Ordinal));
            string xmlDocString = elementStartTag;
            if (!selfClosed)
            {
                xmlDocString = elementStartTag.Substring(0, elementStartTag.Length-1) + "/>" ;
            }

            XmlTextReader xmlReader = new XmlTextReader(new StringReader(xmlDocString));

            xmlReader.Namespaces = false;
            xmlReader.Read();

            bool hasMoreAttributes = xmlReader.MoveToFirstAttribute();
            while (hasMoreAttributes)
            {
                onAttributeSpotted(xmlReader.LineNumber, xmlReader.LinePosition, xmlReader.Name);
                hasMoreAttributes = xmlReader.MoveToNextAttribute();
            }

            int lastCharacter = elementStartTag.Length;
            if (selfClosed)
            {
                lastCharacter--;
            }
            return lastCharacter;
        }
Exemplo n.º 16
0
        /// <summary>
        /// TODO: Multiple spawns please.
        /// </summary>
        /// <param name="world"></param>
        public static void Load(GameWorld world)
        {
            string path = Config.GetDataPath() + "world/spawns.xml";
            XmlTextReader reader = new XmlTextReader(path);
            Respawn currentRespawn = null;
            while (reader.Read()) {
                switch (reader.NodeType) {
                    case XmlNodeType.Element:
                        while (reader.MoveToNextAttribute()) // Read attributes
                            {
                            if (reader.Name == "centerx") {
                                currentRespawn = new Respawn(world);
                                currentRespawn.CenterX = ushort.Parse(reader.Value);
                            } else if (reader.Name == "centery") {
                                currentRespawn.CenterY = ushort.Parse(reader.Value);
                            } else if (reader.Name == "centerz") {
                                currentRespawn.CenterZ = byte.Parse(reader.Value);
                            } else if (reader.Name == "radius") {
                                currentRespawn.Radius = int.Parse(reader.Value);
                            } else if (reader.Name == "name") {
                                currentRespawn.MonsterName = reader.Value;
                            } else if (reader.Name == "spawntime") {
                                if (currentRespawn.CanSpawn()) {
                                    currentRespawn.Spawn();
                                }
                                //currentRespawn.SpawnTime = 100 * int.Parse(reader.Value);
                            }
                        }
                        break;
                }
            }

            reader.Close();
        }
Exemplo n.º 17
0
        private void button1_Click(object sender, EventArgs e)
        {
            XmlTextReader tr =
                new XmlTextReader(@"D:\MS.Net\CSharp\XMLParser\XMLParser\Emp.xml");
            while (tr.Read())
            {
                //Check if it is a start tag
                if (tr.NodeType == XmlNodeType.Element)
                {
                    listBox1.Items.Add(tr.Name);
                    if (tr.HasAttributes)
                    {
                        tr.MoveToFirstAttribute();
                        string str = tr.Name;
                        str += " = ";
                        str += tr.Value;
                        listBox1.Items.Add(str);
                    }
                    if (tr.MoveToNextAttribute())
                    {

                        string str = tr.Name;
                        str += " = ";
                        str += tr.Value;
                        listBox1.Items.Add(str);
                    }
                }
                if (tr.NodeType == XmlNodeType.Text)
                {
                    listBox1.Items.Add(tr.Value);
                }

            }
        }
Exemplo n.º 18
0
        /// <summary>Loads the map from the XML file</summary>
        /// <param name="name">File name of the map</param>
        public void loadXMLMap()
        {
            
            XmlTextReader reader = new XmlTextReader("maps/xml/" + id + ".tmx");

            int i = 0;
            int j = 0;
            while (reader.Read())
            {
                // http://msdn.microsoft.com/fr-fr/library/9b9dty7d(VS.80).aspx

                if (reader.NodeType == XmlNodeType.Element) // The node is an element.
                {
                    while (reader.MoveToNextAttribute())
                    { // Read the attributes.
                        if (reader.Name == "gid")
                        {
                            TabMap[i, j] = Convert.ToInt32(reader.Value);
                            if (i == 19)
                            {
                                i = 0;
                                j++;
                            }
                            else
                            {
                                i++;
                            }
                        }
                    }
                }

            }
        }
Exemplo n.º 19
0
        public void read(string absfilepath)
        {
            XmlTextReader reader = new XmlTextReader(absfilepath);

            try
            {
                while (reader.Read())
                {
                    switch (reader.NodeType)
                    {
                        case XmlNodeType.Element: // The node is an element.
                            Console.Write("<" + reader.Name);

                            while (reader.MoveToNextAttribute()) // Read the attributes.
                                Console.Write(" " + reader.Name + "='" + reader.Value + "'");
                            Console.WriteLine(">");
                            break;
                        case XmlNodeType.Text: //Display the text in each element.
                            Console.WriteLine(reader.Value);
                            break;
                        case XmlNodeType.EndElement: //Display the end of the element.
                            Console.Write("</" + reader.Name);
                            Console.WriteLine(">");
                            break;
                    }
                }
            }

            catch (Exception e)
            {
                Console.WriteLine("Exception in XmlReader");
            }
        }
Exemplo n.º 20
0
        //
        public RemoteXMLReader()
        {
            String URLString = "http://www.filmsepeti.net/sitemap.xml";
            XmlTextReader reader = new XmlTextReader(URLString);

            while (reader.Read())
            {
                switch (reader.NodeType)
                {
                    case XmlNodeType.Element: // The node is an element.
                        Console.Write("<" + reader.Name);

                        while (reader.MoveToNextAttribute()) // Read the attributes.
                            Console.Write(" " + reader.Name + "='" + reader.Value + "'");
                        Console.Write(">");
                        Console.WriteLine(">");
                        break;
                    case XmlNodeType.Text: //Display the text in each element.
                        Console.WriteLine(reader.Value);
                        break;
                    case XmlNodeType.EndElement: //Display the end of the element.
                        Console.Write("</" + reader.Name);
                        Console.WriteLine(">");
                        break;
                }
            }
        }
Exemplo n.º 21
0
 /// <summary>
 /// Sets the Language Content and reads it from an XML File.
 /// </summary>
 public void local(String s)
 {
     try
     {
         String sFilename = Directory.GetCurrentDirectory() + "/" + s;
         XmlTextReader reader = new XmlTextReader(sFilename);
         reader.Read();
         reader.Read();
         int count = 4;
         String[] t = new String[count];
         String[] t2 = new String[count];
         for (int i = 0; i < count; i++)
         {
             reader.Read();
             reader.Read();
             t[i] = reader.Name;
             reader.MoveToNextAttribute();
             t2[i] = reader.Value;
             if (t2[i] == "")
             {
                 throw new XmlException("datei nicht lang genug");
             }
         }
         label1.Content = t2[0];
         label2.Content = t2[1];
         label3.Content = t2[2];
         tb1.Text = t2[3];
     }
     catch (IndexOutOfRangeException) { }
     catch (FileNotFoundException) { }
     catch (XmlException) { }
 }
Exemplo n.º 22
0
        public String[] GetVersion(List<String> application)
        {
            String[] versionList = new String[5];
            String URLString = "http://www.gamerzzheaven.be/applications.xml";
            
            XmlTextReader reader = new XmlTextReader(URLString);

            while (reader.Read())
            {
                if (reader.NodeType.Equals(XmlNodeType.Element))
                {
                    if (reader.Name.Equals("Application"))
                    {
                        while (reader.MoveToNextAttribute()) // Read the attributes.
                            if (reader.Name == "name")
                            {
                                if (reader.Value.Equals("x264")) //change the z264 string value to the enum once tested
                                {
                                    reader.Read();
                                    if(reader.Name.Equals("Version"))
                                    {
                                        versionList[0] = reader.ReadString();
                                    }
                                }
                            }
                    }
                }
            }
            return versionList; //return curerent application version
        }
Exemplo n.º 23
0
        public SimpleElement parse(XmlTextReader reader)
        {
            SimpleElement se = null;
             this.Reader = reader;
             while (!Reader.EOF)
             {
            Reader.Read();
            switch (Reader.NodeType)
            {
               case XmlNodeType.Element :
                  // create a new SimpleElement
                  se = new SimpleElement(Reader.LocalName);
                  currentElement = se;
                  if (elements.Count == 0)
                  {
                     rootElement = se;
                     elements.Push(se);
                  }
                  else
                  {
                     SimpleElement parent = (SimpleElement) elements.Peek();
                     parent.ChildElements.Add(se);

                     // don['t push empty elements onto the stack
                     if (Reader.IsEmptyElement) // ends with "/>"
                     {
                        break;
                     }
                     else {
                        elements.Push(se);
                     }
                  }
                  if (Reader.HasAttributes)
                  {
                     while(Reader.MoveToNextAttribute())
                     {
                        currentElement.setAttribute(Reader.Name,Reader.Value);
                     }
                  }
                  break;
               case XmlNodeType.Attribute :
                  se.setAttribute(Reader.Name,Reader.Value);
                  break;
               case XmlNodeType.EndElement :
                  //pop the top element
                  elements.Pop();
                  break;
               case XmlNodeType.Text :
                  currentElement.Text=Reader.Value;
                  break;
               case XmlNodeType.CDATA :
                  currentElement.Text=Reader.Value;
                  break;
               default :
                  // ignore
                  break;
            }
             }
             return rootElement;
        }
        public SelectionWindow(MainWindow window, int offset)
        {
            InitializeComponent();
            mWindow = window;
            mOffset = offset;
            XmlTextReader reader = new XmlTextReader("../../Content/Types.xml");
            items = new Hashtable();
            hasText = new Hashtable();

            StackPanel stack = new StackPanel();

            cbox = new ComboBox();
            cbox.Background = Brushes.LightBlue;

            reader.Read();

            while (reader.Read())
            {
                switch (reader.NodeType)
                {
                    case XmlNodeType.Element:
                        var cboxitem = new ComboBoxItem();
                        cboxitem.Content = reader.Name;
                        cbox.Items.Add(cboxitem);
                        name = reader.Name;
                        //hasText[name] = false;
                        List<Tuple<string, string>> list = new List<Tuple<string, string>>();
                        items[name] = list;

                        if (reader.HasAttributes)
                        {
                            List<Tuple<string, string>> templist = items[name] as List<Tuple<string, string>>;
                            while (reader.MoveToNextAttribute())
                            {
                                Tuple<string, string> tuple = new Tuple<string, string>(reader.Name, reader.Value);
                                templist.Add(tuple);
                            }
                        }
                        break;
                    case XmlNodeType.Text:
                        hasText[name] = reader.Value;
                        break;
                    case XmlNodeType.EndElement:
                        break;
                }
            }

            stack.Children.Add(cbox);

            Button AddButton = new Button();
            AddButton.Content = "Add";
            AddButton.Click += AddButton_Click;

            stack.Children.Add(AddButton);

            this.AddChild(stack);
        }
Exemplo n.º 25
0
 public Section(string xmlFile)
 {
     fixedId = new List<int>();
     selectField = new List<string>();
     selectId = new List<List<int>>();
     selectDim = new List<string>();
     XmlTextReader reader = new XmlTextReader(xmlFile);
     while (reader.Read())
     {
         if (reader.NodeType == XmlNodeType.Element)
         {
             if (reader.Name == "Applebd")
             {
                 reader.MoveToNextAttribute();
                 path = reader.Value;
             }
             else if (reader.Name == "DimensionByColumn")
             {
                 reader.Read();
                 dimByColumn = reader.Value;
             }
             else if (reader.Name == "DimensionByRow")
             {
                 reader.Read();
                 dimByRow = reader.Value;
             }
             else if (reader.Name == "FixedDimension")
             {
                 skip(ref reader);
                 fixedDim = reader.Name;
                 skip(ref reader);
                 fixedField = reader.Name;
                 reader.Read();
                 string [] split = reader.Value.Split(new Char[] { ' ' });
                 foreach (string s in split)
                     fixedId.Add(Convert.ToInt32(s));
             }
             else if (reader.Name == "Selection")
             {
                 reader.Read();
                 int i = 0;
                 for (; i<2; i++)
                 {
                     skip(ref reader);
                     selectDim.Add(reader.Name);
                     skip(ref reader);
                     selectField.Add(reader.Name);
                     reader.Read();
                     string[] split = reader.Value.Split(new Char[] { ' ' });
                     selectId.Add(new List<int>());
                     foreach (string s in split)
                         selectId[i].Add(Convert.ToInt32(s));
                 }
             }
         }
     }
 }
Exemplo n.º 26
0
 public void ReadFromFile(string text1)
 {
     XmlReader reader = null;
     try
     {
         this._objManualMatchedList.Clear();
         reader = new XmlTextReader(text1);
         while (reader.Read())
         {
             if (((reader.NodeType != XmlNodeType.Element) || (reader.Name.ToUpper() != "ManualMatching".ToUpper())) || (reader.AttributeCount <= 0))
             {
                 continue;
             }
             ManualMatchContainer item = new ManualMatchContainer();
             while (reader.MoveToNextAttribute())
             {
                 string str2 = reader.Name.ToUpper();
                 if (str2 == "strLeague".ToUpper())
                 {
                     item.strLeague = reader.Value;
                 }
                 else
                 {
                     if (str2 == "strHomeNameSource".ToUpper())
                     {
                         item.strHomeNameSource = reader.Value;
                         continue;
                     }
                     if (str2 == "strHomeAwaySource".ToUpper())
                     {
                         item.strAwayNameSource = reader.Value;
                         continue;
                     }
                     if (str2 == "strHomeNameTarget".ToUpper())
                     {
                         item.strHomeNameTarget = reader.Value;
                         continue;
                     }
                     if (str2 == "strHomeAwayTarget".ToUpper())
                     {
                         item.strAwayNameTarget = reader.Value;
                     }
                 }
             }
             this._objManualMatchedList.Add(item);
         }
         reader.Close();
         this.UpdateMatchListByManualMatchingList();
         this.UpdateManualMatchingAvailableList();
     }
     catch (Exception exception1)
     {
         ProjectData.SetProjectError(exception1);
         Exception exception = exception1;
         ProjectData.ClearProjectError();
     }
 }
Exemplo n.º 27
0
        public override bool Execute()
        {
            XmlTextReader reader = new XmlTextReader(_filename);
            StreamWriter writer = new StreamWriter(_filename + ".log");
            string name;
            string success;
            string message;
            string stackTrace;

            writer.WriteLine("NUnit Failures for Build Performed on: " + DateTime.Now.ToString());
            writer.WriteLine();

            while (reader.Read())
            {
                if (reader.Name.EndsWith("test-case"))
                {

                    reader.MoveToNextAttribute();  //Name
                    name = reader.Value;
                    reader.MoveToNextAttribute(); //Executed
                    reader.MoveToNextAttribute(); //Success
                    success = reader.Value;

                    if (success == "False")
                    {
                        advanceToElement(ref reader, "message");
                        message = reader.ReadElementContentAsString();

                        advanceToElement(ref reader, "stack-trace");
                        stackTrace = reader.ReadElementContentAsString();

                        writer.Write(_failCount.ToString() + ") " + name);
                        _failCount++;
                        writer.WriteLine(" - " + message);
                        writer.WriteLine(stackTrace);
                        writer.WriteLine();
                    }
                }
            }

            writer.Close();
            reader.Close();
            return true;
        }
 internal void Read(XmlTextReader reader)
 {
     ArrayList list = new ArrayList();
     if (this.bindingRedirects != null)
     {
         list.AddRange(this.bindingRedirects);
     }
     while (reader.Read())
     {
         if ((reader.NodeType == XmlNodeType.EndElement) && AppConfig.StringEquals(reader.Name, "dependentassembly"))
         {
             break;
         }
         if ((reader.NodeType == XmlNodeType.Element) && AppConfig.StringEquals(reader.Name, "assemblyIdentity"))
         {
             string str = null;
             string str2 = "null";
             string str3 = "neutral";
             while (reader.MoveToNextAttribute())
             {
                 if (AppConfig.StringEquals(reader.Name, "name"))
                 {
                     str = reader.Value;
                 }
                 else
                 {
                     if (AppConfig.StringEquals(reader.Name, "publicKeyToken"))
                     {
                         str2 = reader.Value;
                         continue;
                     }
                     if (AppConfig.StringEquals(reader.Name, "culture"))
                     {
                         str3 = reader.Value;
                     }
                 }
             }
             string assemblyName = string.Format(CultureInfo.InvariantCulture, "{0}, Version=0.0.0.0, Culture={1}, PublicKeyToken={2}", new object[] { str, str3, str2 });
             try
             {
                 this.partialAssemblyName = new AssemblyNameExtension(assemblyName).AssemblyName;
             }
             catch (FileLoadException exception)
             {
                 Microsoft.Build.Shared.ErrorUtilities.VerifyThrowArgument(false, exception, "AppConfig.InvalidAssemblyIdentityFields");
             }
         }
         if ((reader.NodeType == XmlNodeType.Element) && AppConfig.StringEquals(reader.Name, "bindingRedirect"))
         {
             BindingRedirect redirect = new BindingRedirect();
             redirect.Read(reader);
             list.Add(redirect);
         }
     }
     this.bindingRedirects = (BindingRedirect[]) list.ToArray(typeof(BindingRedirect));
 }
Exemplo n.º 29
0
        // ----- Загрузка --------
        public static Settings Load(string settingsFilePath)
        {
            XmlTextReader reader = null;
            Settings settings = new Settings();

            try
            {
                Parameter parameter = null;
                reader = new XmlTextReader(settingsFilePath);

                while (reader.Read())
                {
                    switch (reader.NodeType)
                    {
                        case XmlNodeType.Element:

                            parameter = new Parameter(reader.Name);
                            while (reader.MoveToNextAttribute())
                            {
                                Property property = new Property(reader.Name, reader.Value);
                                parameter.Insert(property);
                            }
                            break;

                        case XmlNodeType.Text:

                            if (parameter != null)
                                parameter.Value = reader.Value;

                            break;

                        case XmlNodeType.EndElement:

                            if (settings != null)
                            {
                                if (parameter != null)
                                {
                                    settings.Insert(parameter);
                                    parameter = null;
                                }
                            }
                            break;
                    }
                }
                settings.SettingsFilePath = settingsFilePath;
                return settings;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex.InnerException);
            }
            finally
            {
                if (reader != null) reader.Close();
            }
        }
Exemplo n.º 30
0
        /// <summary>
        /// Extracts workspace settings from an XML Fragment and puts them into a hashtable:
        /// </summary>
        /// <param name="xmlFrag">The XML frag.</param>
        /// <returns>
        /// hashtable of the geodatabase workspace parameters
        /// </returns>
        private Hashtable WrkspcXMLFrag2Hash(string xmlFrag)
        {
            Trace.WriteLine("Start WrkspcXMLFrag2Hash");
            Hashtable hash = new Hashtable();

            try
            {
                NameTable           nameTable        = new NameTable();
                XmlNamespaceManager namespaceManager = new XmlNamespaceManager(new NameTable());
                namespaceManager.AddNamespace("rk", "urn:store-items");

                XmlParserContext     parserContext = new XmlParserContext(null, namespaceManager, null, XmlSpace.None);
                System.Xml.XmlReader xmlReader     = new System.Xml.XmlTextReader(xmlFrag, XmlNodeType.Element, parserContext);

                // iterate through the attributes of the <WORKSPACE> XML fragment and load into hashtable:
                try
                {
                    while (xmlReader.Read())
                    {
                        if (xmlReader.NodeType == XmlNodeType.Element)
                        {
                            if (xmlReader.HasAttributes == true)
                            {
                                try
                                {
                                    while (xmlReader.MoveToNextAttribute())
                                    {
                                        hash.Add(xmlReader.Name.ToUpper(), xmlReader.Value);
                                    }
                                }
                                catch (Exception ex)
                                {
                                    Trace.WriteLine("ArcZonaWorkspace.WrkspcXMLFrag2Hash Exception  Inside While: " + ex.Message + "\n\nStackTrace: " + ex.StackTrace);
                                    throw;
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    Trace.WriteLine("ArcZonaWorkspace.WrkspcXMLFrag2Hash Exception: " + ex.Message + "\n\nStackTrace: " + ex.StackTrace);
                }
            }
            catch (Exception ex)
            {
                Trace.WriteLine("ArcZonaWorkspace.WrkspcXMLFrag2Hash Exception: " + ex.Message + "\n\nStackTrace: " + ex.StackTrace);
                throw;
            }

            Trace.WriteLine("End WrkspcXMLFrag2Hash");

            return(hash);
        }
Exemplo n.º 31
0
 public void ReadFromFile(string text1)
 {
     XmlReader reader = null;
     this._objList.Clear();
     reader = new XmlTextReader(text1);
     while (reader.Read())
     {
         if (reader.NodeType == XmlNodeType.Element)
         {
             if ((reader.Name.ToUpper() == "GeneralSetting".ToUpper()) && (reader.AttributeCount > 0))
             {
                 while (reader.MoveToNextAttribute())
                 {
                     if (reader.Name.ToUpper() == "IsSelectAll".ToUpper())
                     {
                         this._isSelectAll = Conversion.Val(reader.Value) != 0.0;
                     }
                 }
             }
             if ((reader.Name.ToUpper() == "League".ToUpper()) && (reader.AttributeCount > 0))
             {
                 League item = new League();
                 while (reader.MoveToNextAttribute())
                 {
                     string str5 = reader.Name.ToUpper();
                     if (str5 == "ID".ToUpper())
                     {
                         item.set_ID(reader.Value);
                     }
                     else if (str5 == "Name".ToUpper())
                     {
                         item.set_Name(reader.Value);
                     }
                 }
                 this._objList.Add(item);
             }
         }
     }
     reader.Close();
 }
Exemplo n.º 32
0
        /// <summary>
        /// Reads the substrate list out of the xml file
        /// </summary>
        /// <param name="XMLfile">a xml file</param>
        public substrates(string XMLfile)
        {
            XmlTextReader reader = new System.Xml.XmlTextReader(XMLfile);

            string xml_tag      = "";
            string substrate_id = "";

            // go through the file
            while (reader.Read())
            {
                switch (reader.NodeType)
                {
                case System.Xml.XmlNodeType.Element: // this knot is an element
                    xml_tag = reader.Name;

                    while (reader.MoveToNextAttribute())
                    { // read the attributes, here only the attribute of digester
                      // is of interest, all other attributes are ignored,
                      // actually there usally are no other attributes
                        if (xml_tag == "substrate" && reader.Name == "id")
                        {
                            // found a new substrate
                            substrate_id = reader.Value;

                            addSubstrate(new biogas.substrate(ref reader, substrate_id));

                            break;
                        }
                    }
                    break;
                } // switch
            }     // while

            //

            reader.Close();
        }
Exemplo n.º 33
0
        /// <summary>
        /// Constructor creating the plant by reading from the given xml file.
        /// </summary>
        /// <param name="XMLfile"></param>
        public plant(string XMLfile)
        {
            XmlTextReader reader = new System.Xml.XmlTextReader(XMLfile);

            string xml_tag = "";
            string param   = "";

            set_params_of();

            string plant_id = "";

            //bool finances_tag= false;      // true after finances xml tag was found <finances>

            while (reader.Read())
            {
                switch (reader.NodeType)
                {
                case System.Xml.XmlNodeType.Element: // this knot is an element
                    xml_tag = reader.Name;

                    while (reader.MoveToNextAttribute())
                    { // read the attributes, here only the attribute of plant, digester and chp
                      // are of interest, all other attributes are ignored,
                      // actually there usally are no other attributes
                        if (xml_tag == "plant" && reader.Name == "id")
                        {
                            _id      = reader.Value;
                            plant_id = _id;

                            break;
                        }
                        else if (xml_tag == "physValue" && reader.Name == "symbol")
                        {
                            // found a new parameter
                            param = reader.Value;

                            switch (param)
                            {
                            case "g":
                                g.getParamsFromXMLReader(ref reader, param);
                                break;

                            case "Tout":
                                Tout.getParamsFromXMLReader(ref reader, param);
                                break;
                            }
                            break;
                        }
                    }

                    if (xml_tag == "digesters")
                    {
                        myDigesters.getParamsFromXMLReader(ref reader);
                        plant_id = "";
                    }
                    else if (xml_tag == "chps")
                    {
                        myCHPs.getParamsFromXMLReader(ref reader);
                        plant_id = "";
                    }
                    else if (xml_tag == "transportation")
                    {
                        myTransportation.getParamsFromXMLReader(ref reader);
                        plant_id = "";
                    }
                    else if (xml_tag == "finances")// && !finances_tag)
                    {
                        myFinances.getParamsFromXMLReader(ref reader);
                        plant_id = "";
                        //finances_tag= true;
                    }

                    break;

                case System.Xml.XmlNodeType.Text: // text, thus value, of each element

                    if (plant_id != "")           // ignore the text before the plant is found
                    {
                        switch (xml_tag)
                        {
                        case "name":
                            _name = reader.Value;
                            break;

                        case "construct_year": // construction year
                            _construct_year = System.Xml.XmlConvert.ToInt32(reader.Value);
                            break;
                        }
                    }
                    // löschen
                    //else if (finances_tag)
                    //{
                    //  double value = System.Xml.XmlConvert.ToDouble(reader.Value);//Convert.ToDouble(reader.Value);

                    //  myFinances.set_params_of(xml_tag, value);
                    //}
                    break;
                } // switch
            }     // while

            //

            reader.Close();
        }
Exemplo n.º 34
0
 // Move to the next attribute owned by the current element.
 public override bool MoveToNextAttribute()
 {
     return(reader.MoveToNextAttribute());
 }