Click here to Skip to main content
16,010,488 members
Home / Discussions / C#
   

C#

 
QuestionHow to Update a row in Datagrid Pin
dwark10611-Aug-05 6:28
dwark10611-Aug-05 6:28 
GeneralDataGrid Column Headers Pin
zaboboa11-Aug-05 6:22
zaboboa11-Aug-05 6:22 
GeneralRe: DataGrid Column Headers Pin
rudy.net11-Aug-05 17:19
rudy.net11-Aug-05 17:19 
GeneralRe: DataGrid Column Headers Pin
zaboboa12-Aug-05 2:03
zaboboa12-Aug-05 2:03 
GeneralRe: DataGrid Column Headers Pin
rudy.net12-Aug-05 4:07
rudy.net12-Aug-05 4:07 
GeneralXML Question Pin
matthias s.11-Aug-05 6:12
matthias s.11-Aug-05 6:12 
GeneralRe: XML Question Pin
ChesterPoindexter11-Aug-05 7:41
professionalChesterPoindexter11-Aug-05 7:41 
GeneralRe: XML Question Pin
LongRange.Shooter11-Aug-05 9:57
LongRange.Shooter11-Aug-05 9:57 
Here is a simple process the goes through an entire XML file regardless of definition.

C#
			XmlTextReader reader = new XmlTextReader(@"..\..\test.xml");
			try
			{
				while (!reader.EOF && reader.NodeType != System.Xml.XmlNodeType.Element)
				{
					BuildLine( reader, reader.NodeType.ToString(), reader.Name,  reader.Value );
					reader.Read();
				}
				if (reader.EOF)
				{
					reader.Close();
					results.Items.Add("End of file process");
					return;
				}
			}
			catch (System.Exception exc)
			{
				results.Items.Add(exc.Message);
				if (exc.InnerException != null)
					results.Items.Add(exc.InnerException.Message);
				return;
			}

			int currentDepth = reader.Depth;
			DoAttributes(reader);

			do
			{
				if (reader.NodeType == System.Xml.XmlNodeType.Element)
				{
					results.Items.Add(BuildLine( reader, "Element", reader.Name,  reader.Value ));
					if (reader.AttributeCount > 0)
					{
						DoAttributes(reader);
					}
					reader.Read();
				}
				else
				{
					results.Items.Add(BuildLine( reader, reader.NodeType.ToString(), reader.Name,  reader.Value ));
					reader.Read();
				}
			} while (!reader.EOF 
				&& !((reader.NodeType == System.Xml.XmlNodeType.EndElement 
				|| reader.NodeType == System.Xml.XmlNodeType.Element) 
				&& reader.Depth <= currentDepth));



...



		private void DoAttributes(XmlTextReader reader)
		{
			results.Items.Add(BuildLine( reader, reader.NodeType.ToString(), reader.Name,  reader.Value ));
			if (reader.MoveToFirstAttribute())
			{
				do
				{
					results.Items.Add(BuildLine( reader, "Attribute", reader.Name, reader.Value ));
				}while(reader.MoveToNextAttribute());
			}
		}


There are 10 kinds of people in the world.

Those that read binary...

...and those who don't.

GeneralRe: XML Question Pin
StoneTheCrows12-Aug-05 1:33
StoneTheCrows12-Aug-05 1:33 
Generalway to connect c# by flash Pin
malak nour11-Aug-05 5:23
malak nour11-Aug-05 5:23 
GeneralRe: way to connect c# by flash Pin
Judah Gabriel Himango11-Aug-05 6:02
sponsorJudah Gabriel Himango11-Aug-05 6:02 
General[STAThreadAttribute] Pin
zaboboa11-Aug-05 5:22
zaboboa11-Aug-05 5:22 
GeneralRe: [STAThreadAttribute] Pin
Judah Gabriel Himango11-Aug-05 7:10
sponsorJudah Gabriel Himango11-Aug-05 7:10 
GeneralKilling WORD in case of failure - but the right version Pin
fracalifa11-Aug-05 5:17
fracalifa11-Aug-05 5:17 
GeneralRe: Killing WORD in case of failure - but the right version Pin
Alomgir Miah11-Aug-05 5:36
Alomgir Miah11-Aug-05 5:36 
GeneralRe: Killing WORD in case of failure - but the right version Pin
fracalifa11-Aug-05 7:29
fracalifa11-Aug-05 7:29 
GeneralCreating standalone exe file Pin
mamtz11-Aug-05 5:00
mamtz11-Aug-05 5:00 
GeneralRe: Creating standalone exe file Pin
Dan Neely11-Aug-05 5:08
Dan Neely11-Aug-05 5:08 
GeneralRe: Creating standalone exe file Pin
Dave Kreskowiak11-Aug-05 6:30
mveDave Kreskowiak11-Aug-05 6:30 
GeneralRe: Creating standalone exe file Pin
S. Senthil Kumar11-Aug-05 7:39
S. Senthil Kumar11-Aug-05 7:39 
GeneralRe: Creating standalone exe file Pin
Dave Kreskowiak11-Aug-05 8:22
mveDave Kreskowiak11-Aug-05 8:22 
GeneralRe: Creating standalone exe file Pin
Steve Maier11-Aug-05 7:08
professionalSteve Maier11-Aug-05 7:08 
GeneralRe: Creating standalone exe file Pin
Dave Kreskowiak11-Aug-05 8:24
mveDave Kreskowiak11-Aug-05 8:24 
QuestionHow can I get the &quot;Interop.QuartzTypeLib.dll&quot;,thankyou! Pin
zhouyinhui11-Aug-05 4:58
zhouyinhui11-Aug-05 4:58 
AnswerRe: How can I get the &quot;Interop.QuartzTypeLib.dll&quot;,thankyou! Pin
Judah Gabriel Himango11-Aug-05 8:54
sponsorJudah Gabriel Himango11-Aug-05 8:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.