【お知らせ】この部分は英語原文のみでの提供となります。何卒ご了承ください。
2.2.3.16.2 Tree::Load
Contents
Description
Gets a tree from an XML file.
Only support the XML file saved in Origin, see Tree::Save.
Syntax
BOOL Load( LPCSTR File, int nType = 0 )
Parameters
- File
- [input] file name
- nType
- [input] unuseful argument.
Return
TRUE if the tree can be created; FALSE otherwise
Examples
EX1
void Tree_Load_ex1() { Tree tr; //Create a tree TreeNode tn1 = tr.AddNode("Root"); tn1.AddTextNode("abc", "SubNode1"); tn1.AddTextNode("efg", "SubNode2"); tr.Save("c:\\myTree.xml"); //Save the tree if( tr.Load("c:\\myTree.xml") ) //Load the tree { printf("------Output total tree------\n"); out_tree(tr); // output the tree // access tree nodes TreeNode tnRoot = tr.GetNode("Root"); if(tnRoot) { TreeNode tn1 = tnRoot.GetNode("SubNode1"); out_str("The string value of the first node: " + tn1.strVal); TreeNode tn2 = tnRoot.GetNode("SubNode2"); out_str("The string value of the second node: " + tn2.strVal); } } else out_str("File not existed or this XML format not support"); }
Remark
See Also
Header to Include
origin.h