Hoppa till innehållet

Wikipedia:Projekt DotNetWikiBot Framework/GameOnBot/XMLreader

Från Wikipedia
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using System.Xml;

namespace xmltest
{
	public partial class MainForm : Form
	{
		public MainForm()
		{
			InitializeComponent();
			String rcid;
			String user;
			String patroltoken;
			XmlTextReader reader;

			reader = new XmlTextReader ("c:\\xmltest.xml");
          	while (reader.Read())
           	{
                switch (reader.NodeType) 
                {
                	case XmlNodeType.Element :
                		if(reader.Name == "rc")
                		{
							user        = reader.GetAttribute("user");
							if(user == userToCheck)
							{
								rcid        = reader.GetAttribute("rcid");
								patroltoken = reader.GetAttribute("patroltoken");
								myBot.GetWebResource("http://sv.wikipedia.org/w/api.php?action=patrol&token=" + patroltoken + "&rcid=" + rcid, null);
							}
                		}
					break;
				}
			}
          	reader.Close();
		}
	}
}