Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » A couple of issues with a test app
Re: A couple of issues with a test app [message #13425 is a reply to message #13424] Sat, 05 January 2008 11:20 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 14267
Registered: November 2005
Ultimate Member
Like this:

void KanjiFlash::Open()
{
	if(!fs.ExecuteOpen()) return;
	filename = fs;
	lstKanji.Clear();
	try {
		String s = LoadFile(filename);
		XmlParser p(s);
		while(!p.IsTag())
			p.Skip();
		p.PassTag("kanjidic2");
		while(!p.End())
			if(p.Tag("header"))
				while(!p.End()) {
					if(p.Tag("file_version"))
						lblVer = p.ReadTextE();
					else
					if(p.Tag("database_version"))
						lblDBVer = p.ReadTextE();
					else
					if(p.Tag("database_version"))
						lblDBDate = p.ReadTextE();
					else
						p.Skip();
				}
			else
			if(p.Tag("character")) {
				Kanji kanji;
				while(!p.End())
					if(p.Tag("literal"))
						kanji.Literal(p.ReadTextE());
					else
					if(p.Tag("misc"))
						while(!p.End()) {
							if(p.Tag("grade"))
								kanji.Grade(StrInt(p.ReadTextE()));
							else
							if(p.Tag("stroke_count"))
								kanji.StrokeCount(StrInt(p.ReadTextE()));
							else
								p.Skip();
						}
					else
						p.Skip();
				lstKanji.Add(RawToValue(kanji));
			}
			else
				p.Skip();
	}
	catch(XmlError) {
		Exclamation("Error reading the input file!");
	}
}


Memory consumption VP 6MB, and a bit faster too (obviously, you do not need to create XmlNode structure).

Mirek

[Updated on: Sat, 05 January 2008 11:24]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: operator< for container sorting (small confusion)
Next Topic: Rect_ operators overloading suggestion
Goto Forum:
  


Current Time: Mon Aug 04 02:18:30 CEST 2025

Total time taken to generate the page: 0.07284 seconds