|
|
Home » U++ Library support » U++ Core » Problem with XML
Problem with XML [message #39926] |
Sat, 11 May 2013 17:56 |
|
koldo
Messages: 3394 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
|
|
|
|
|
|
|
|
|
|
Goto Forum:
Current Time: Fri Sep 20 03:30:14 CEST 2024
Total time taken to generate the page: 0.03287 seconds
|
|
|