// *********************************************************** /// /// @file sample.dxl /// /// @brief File to import SCADE equations and nodes into DOORS conception module. /// /// @par Document code: /// @par /// // *********************************************************** // ************************************************************ // * * // * include declarations * // * * // ************************************************************ // ************************************************************ // * * // * global data declarations * // * * // ************************************************************ ///@cond DOXYGEN_SHOULD_SKIP_THIS const string pathToXSD = "c:\\test.xsd" ///@endcond // ************************************************************ // * * // * functions definitions * // * * // ************************************************************ //*********************************************************** /// @fn create_fichier_xml(OleAutoObj& msxml_p, OleAutoObj& Node_p, string& baseline_p, string& nameSpace_p) /// @brief Create xml file with XML output from SCADE tcl script /// /// @param[in] msxml_p OleAutoObj representing the XML file /// @param[in] Node_p OleAutoObj representing a Node /// @param[in] nameSpace_p validation URL of XML file /// /// // //*********************************************************** bool create_fichier_xml(OleAutoObj& msxml_p, OleAutoObj& Node_p, string& nameSpace_p) { if (null msxml_p) { errorBox ERR_IMPOSSIBLE_LANCER_CLEARCASE return false } string test = "test" if ( !createXmlDeclarationLine (msxml_p, err) ) { errorBox err return false } OleAutoObj OleAutoObjNS string nameSpace = "http://www.somesite.com/namespace/" if ( !addNameSpace( msxml_p, OleAutoObjNS, "edicg", nameSpace, err ) ) { errorBox err return false } OleAutoObj autoObjHeader if ( !createNode(msxml_p, nameSpace, OleAutoObjNS, "header", autoObjHeader, err) ) { errorBox err return false } OleAutoObj autoObjBaseline if ( !createNode(msxml_p, nameSpace, autoObjHeader, "test", autoObjBaseline, err) ) { errorBox err return false } if ( !setNodeValue(msxml_p, autoObjBaseline, test, err) ) { errorBox err return false } OleAutoArgs autoArgs = create put(autoArgs, "c:\\test.xml") err = oleMethod( msxml_p, "save", autoArgs ) if ( !null err ) { errorBox err return false } nameSpace_p = nameSpace delete autoArgs return true } //*********************************************************** /// @fn importData(......) /// @brief File that imports XML information from the input XML file /// //*********************************************************** bool importData(......) { bool hasChilds = false OleAutoObj childsNodes //list of nodes of call_graph(first call) int nbrChilds = 0 //number of childs of call_graph(first call) if ( HasChilds(...., hasChilds, childsNodes, nbrChilds, err_p) ) { if ( !null err_p ) { return false } if (hasChilds) { string nodeName = "" string strProject = "" int i = 0 for ( i = 0; i < nbrChilds; ++i) { nodeName = "" nodeValue = "" nonStr = "" typeStr = "" oidStr = "" if ( !GetNextChildNode(childsNodes, i, nodeProject, nodeName, err_p) ) { return false } if ( nodeName == "project" ) { if ( !GetAttributNode(nodeProject, "name", nodeValue, err_p) ) { return false } } } } else { "XML is empty" } } else { "XML is empty" } return true } //*********************************************************** /// @fn do_it() /// @brief /// //*********************************************************** void do_it() { OleAutoObj MSXML = null if ( !getMsXMLObj(MSXML, err) ) { errorBox err return } OleAutoObj Node string nameSpace = "" if ( create_fichier_xml (MSXML, projetDir, nonProjetScade, Node, baseLineName, nameSpace)) { closeMsXMLObj (MSXML) /* Validating XML */ OleAutoObj MSXML = null if ( !getMsXMLObj(MSXML, err) ) { errorBox err return } string pathToXML = "c:\\test.xml" if ( !validateXML(MSXML, pathToXML, pathToXSD, nameSpace, err)) { closeMsXMLObj (MSXML) errorBox err return } closeMsXMLObj (MSXML) } do_it() closeMsXML