Version: Origin 8
Operating System: Windows XP
Hello everbody!
I am new to this, and have allready many questions.
Here is one of them:
I want to import data from XML-file to origin,
using a function from the Tree class:
syntax: BOOL Load( LPCSTR File, int nType = 0 )
a code example shows:
void Tree_Load_ex1()
{
Tree myTree;
myTree.Load("xyz.xml", 0);
}
I got a bit confused when trying the following:
void test_load_xml() {
Tree myTree;
if( myTree.Load("c:\pojects\data\myData.xml") ) {
out_tree(myTree);
}
else {
out_str("File could not be load!");
}
}
In some cases it works, in some not. But I dont understand for what reasons.
For example I saved the file myData.xml in an other path: c:\myData
and tried it with
myTree.Load("c:\Data.xml")
and it didnt work.
Another wirred example is, I had two XML-files. They had the same content, but different names, but in the same path.
One of them could be load, the other file not. confused?? me too!!
I got more confusing things: I put the file in a folder called XML.
So the path was: c:\projects\data\XML\myData.xml
Now I got a Runtime Error:
Runtime Error!
Program: C:\Programme\OriginLab\Origin8\Origin8.exe
abnormal program termination
But when I use a Labtalk-script to get path and filename like this:
getfile *.xml
filename$ = %A;
filepath$ = %B
and then call OriginC-function:
void test_load_xml(string filename, string filepath) {
Tree myTree;
if( myTree.Load(filepath + filename) ) {
out_tree(myTree);
}
else {
out_str("File could not be load!");
}
}
like this, in Labtalk-script:
test_load_xml(filename$, filepath$)
Everything works fine. But I feel a bit nervous about these errors
which occured by using this function. Because I dont know why and when they occur.
Did anybody make experiences with that? Then tell me please.
Thank you!
greetz
<!-- helping each other
is a good thing..
..like TreeNode holding
the leaves of a Tree -->