<< MASCARET_delete Toolbox Mascaret MASCARET_getBool >>

Toolbox Mascaret >> Toolbox Mascaret > MASCARET_exportXml

MASCARET_exportXml

Export the MASCARET model or state in a file with the XML format

Calling sequence

[error] = MASCARET_exportXml(id,FileName,withDesc,exportModel)

Arguments

error

(Output argument) Error code value : zero indicates that no errors occurred

id

MASCARET instance number returned by the function MASCARET_create

FileName

Name of the XML file containing the MASCARET model or state. The length of this string does not exceed 255 characters.

withDesc

If true (value = 1), adds the description of each variable.

exportModel

If true (value = 1), exports the model. If not true (value = 0) exports the state.

Description

Export the MASCARET model or state in a file with the XML format

This function gives the possibility to export in XML files the MASCARET state or model of a particular instance id. This file should be read with the function MASCARET_importXml

Before using this function, it is necessary to load the model or state, with the help of one of the functions MASCARET_importModel or MASCARET_importXml with the last parameter equal to 1. If the state is exported, it must be initialized with the help of one of the functions MASCARET_initState or MASCARET_initStateName or MASCARET_importXml with the last parameter equal to 1.

Example

toolbox_dir=getenv("toolbox_dir");
c = filesep();        
    
// creation of the MASCARET model
[err, id] = MASCARET_create();
assert_checktrue(id>0);

// read data from files
path_xml = "file://"+toolbox_dir+c+"demos"+c+"Help"+c+"demo1"+c+"demo1.xcas";
TabFileName = [strsubst(path_xml,'\','/'), ..
                 toolbox_dir+c+"demos"+c+"Help"+c+"demo1"+c+"demo1.geo", ..
                 toolbox_dir+c+"demos"+c+"Help"+c+"demo1"+c+"demo1_0.loi", ..
                 toolbox_dir+c+"demos"+c+"Help"+c+"demo1"+c+"demo1_1.loi", ..
                 toolbox_dir+c+"demos"+c+"Help"+c+"demo1"+c+"demo1.lis", ..
                 toolbox_dir+c+"demos"+c+"Help"+c+"demo1"+c+"demo1.opt"];
 
TypeFileName = ["xcas","geo","loi","loi","listing","res"];
impression = 0;
err = MASCARET_importModel(id,TabFileName,TypeFileName,impression);
assert_checkequal(err,0);
        
// initialisation
err = MASCARET_initStateName(id,toolbox_dir+c+"demos"+c+"Help"+c+"demo1"+c+"demo1.lig",impression);
assert_checkequal(err,0);

// exporting the model in XML format
err = MASCARET_exportXml(id,toolbox_dir+c+"demos"+c+"Help"+c+"demo1"+c+"demo1_Model.xml",1,1);
assert_checkequal(err,0);

// exporting the state in XML format
err = MASCARET_exportXml(id,toolbox_dir+c+"demos"+c+"Help"+c+"demo1"+c+"demo1_State.xml",1,0);
assert_checkequal(err,0);

// model deletion
err = MASCARET_delete(id);
assert_checkequal(err,0);

See also


Report an issue
<< MASCARET_delete Toolbox Mascaret MASCARET_getBool >>