Click here to Skip to main content
15,889,266 members
Home / Discussions / C#
   

C#

 
GeneralRe: Avoid duplicates in adding records in MySQL db Pin
#realJSOP6-Mar-08 6:11
mve#realJSOP6-Mar-08 6:11 
QuestionHow to read a file from Ftp Pin
kibromg5-Mar-08 5:14
kibromg5-Mar-08 5:14 
AnswerRe: How to read a file from Ftp Pin
Anthony Mushrow5-Mar-08 5:59
professionalAnthony Mushrow5-Mar-08 5:59 
GeneralRe: How to read a file from Ftp Pin
kibromg6-Mar-08 1:49
kibromg6-Mar-08 1:49 
GeneralRe: How to read a file from Ftp Pin
Anthony Mushrow6-Mar-08 6:59
professionalAnthony Mushrow6-Mar-08 6:59 
QuestionHow to make control reflect changes was maded on his datasource Pin
El'Cachubrey5-Mar-08 4:54
El'Cachubrey5-Mar-08 4:54 
AnswerRe: How to make control reflect changes was maded on his datasource Pin
led mike5-Mar-08 4:59
led mike5-Mar-08 4:59 
QuestionEfficient Xml reading? Pin
Lutosław5-Mar-08 4:28
Lutosław5-Mar-08 4:28 
I'm looking for more efficient Xml reading. I do not mean performance - I load small files. I'd rather ask about coding style/methods. Now I use the following routine:
public static void FromFile(string path, KorepetytorMenu menu)
{
	XmlDocument xmlDoc = new XmlDocument();
	xmlDoc.Load(path);
	foreach (XmlNode rootNode in xmlDoc.ChildNodes) {
		XmlElement rootEl = rootNode as XmlElement;
		if (rootEl != null && rootEl.Name == "KorepetytorMenu") {
			foreach (XmlNode node in rootEl.ChildNodes) {
				XmlElement el = node as XmlElement;
				if (el != null && el.Name == "RootNode") {
					menu.rootNode = KorepetytorMenuNode.FromXmlElement(el);
					ReadNodeChildsRecursive(menu.rootNode, el);
				}
			}
		}
	}
}

I just have been starting coding this, but I wrote some programs like this in the past and I know that it gets annoying when there are 10 or more nested foreach'es an if's.

A sample Xml file:
<?xml version="1.0" encoding="utf-8" ?>
<KorepetytorMenu>
  <RootNode Header="" Image="">
    <Node Header="Fizyka">
      <Node Header="Równania Rózniczkowe" Image="Gwiazdka.png" />
      <Node Header="Kinematyka 1" File="Matma\Równania Rózniczkowe.xml" />
      (...)
    </Node>
  </RootNode>
</KorepetytorMenu>


Any ideas?
Thanks in advance.

Greetings - Gajatko

Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.

AnswerNo Reflection Pin
Lutosław5-Mar-08 4:46
Lutosław5-Mar-08 4:46 
AnswerRe: Efficient Xml reading? Pin
led mike5-Mar-08 5:01
led mike5-Mar-08 5:01 
GeneralRe: Efficient Xml reading? Pin
Lutosław5-Mar-08 6:32
Lutosław5-Mar-08 6:32 
GeneralRe: Efficient Xml reading? Pin
led mike5-Mar-08 6:47
led mike5-Mar-08 6:47 
GeneralRe: Efficient Xml reading? Pin
Lutosław5-Mar-08 6:55
Lutosław5-Mar-08 6:55 
AnswerRe: Efficient Xml reading? Pin
#realJSOP6-Mar-08 6:05
mve#realJSOP6-Mar-08 6:05 
GeneralRe: Efficient Xml reading? Pin
Lutosław6-Mar-08 6:43
Lutosław6-Mar-08 6:43 
GeneralRe: Efficient Xml reading? Pin
#realJSOP6-Mar-08 10:33
mve#realJSOP6-Mar-08 10:33 
General.NET standard components Pin
Steve Declerck5-Mar-08 3:46
Steve Declerck5-Mar-08 3:46 
GeneralRe: .NET standard components Pin
Xmen Real 5-Mar-08 4:30
professional Xmen Real 5-Mar-08 4:30 
GeneralRe: .NET standard components Pin
Gareth H5-Mar-08 4:34
Gareth H5-Mar-08 4:34 
GeneralRe: .NET standard components Pin
John_Adams5-Mar-08 5:14
John_Adams5-Mar-08 5:14 
GeneralRe: .NET standard components Pin
Pete O'Hanlon5-Mar-08 8:30
mvePete O'Hanlon5-Mar-08 8:30 
GeneralRe: .NET standard components Pin
Steve Declerck5-Mar-08 23:22
Steve Declerck5-Mar-08 23:22 
QuestionThreads and BeginReceive Pin
Echilon5-Mar-08 3:28
Echilon5-Mar-08 3:28 
GeneralRepost ( new member ) Pin
led mike5-Mar-08 4:52
led mike5-Mar-08 4:52 
GeneralWebcontrol inside a webcontrol Pin
ezazazel5-Mar-08 3:26
ezazazel5-Mar-08 3:26 

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.