Click here to Skip to main content
13,631,100 members
Click here to Skip to main content


49 bookmarked
Posted 23 Sep 2004
Licenced CPOL


, 23 Sep 2004
A Declarative Xml Parser In Less Than 300 Lines Of Code
using System;
using System.Diagnostics;
using System.IO;
using System.Windows.Forms;
using System.Xml;

using MycroXaml.Parser;

namespace Demo
	public class Startup
		protected Parser mp;

		static void Main() 
			new Startup();

		public Startup()
			mp=new Parser();
			StreamReader sr;
			string text;
			XmlDocument doc;
			sr=new StreamReader("ColorPicker.mycroxaml");
			doc=new XmlDocument();
			catch(Exception e)
				Trace.Fail("Malformed xml:\r\n"+e.Message);

			Form form=(Form)mp.Load(doc, "Form", this);

		public void OnScrolled(object sender, EventArgs e)
			TrackBar RedScroll = (TrackBar)mp.GetInstance("RedScroll");
			TrackBar GreenScroll = (TrackBar)mp.GetInstance("GreenScroll");
			TrackBar BlueScroll = (TrackBar)mp.GetInstance("BlueScroll");
			PictureBox ColorPanel = (PictureBox)mp.GetInstance("ColorPanel");
			ColorPanel.BackColor = System.Drawing.Color.FromArgb((byte)RedScroll.Value, (byte)GreenScroll.Value, (byte)BlueScroll.Value);

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Marc Clifton
United States United States
Marc is the creator of two open source projects, MyXaml, a declarative (XML) instantiation engine and the Advanced Unit Testing framework, and Interacx, a commercial n-tier RAD application suite.  Visit his website,, where you will find many of his articles and his blog.

Marc lives in Philmont, NY.

You may also be interested in...

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web01 | 2.8.180712.1 | Last Updated 23 Sep 2004
Article Copyright 2004 by Marc Clifton
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid