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 » Problem with XML
Problem with XML [message #39926] Sat, 11 May 2013 17:56 Go to previous message
koldo is currently offline  koldo
Messages: 3437
Registered: August 2008
Senior Veteran
Hello Mirek

Running this sample a "invalid Value type" exception is thrown:

xmldemo.cpp
#include <Core/Core.h>

using namespace Upp;

struct MyClass {
	Value val;
	void Xmlize(XmlIO& xml) {
		xml
			("Val", val);
	}
};

CONSOLE_APP_MAIN
{
	MyClass demo;
	
	String fileName = AppendFileName(GetDesktopFolder(), "demo.xml");
	
	try {
		LoadFromXMLFile(demo, fileName);
	} catch (XmlError error) {
		Cout() << "\nError: " << error;		
	}
	ReadStdIn();
}


demo.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE Demo>
<Demo>
</Demo>


A possible but ugly solution is to remove lines 405-406 in Value.cpp:

	if(Upp::IsNull(type))
		throw XmlError("invalid Value type");



In addition it would be great if LoadFromXML() would throw the exception to let the program to handle the errors, like this:
	catch(XmlError error) {
		throw error;
	}

Now the XmlErrors do not arrive to the program as LoadFromXML() catch them but do not re-throw them.


Best regards
IƱaki
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: glutBitmapCharacter undefined reference.
Next Topic: Bug in Core/Stream.cpp
Goto Forum:
  


Current Time: Sun Jun 15 19:14:36 CEST 2025

Total time taken to generate the page: 0.03612 seconds