1 // SUPERV GraphBase : contains fondamental classes for Services, Input Ports, Output Ports Links and Nodes.
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
24 // File : DataFlowBase_LoadXml.cxx
28 #include "DataFlowBase_XmlHandler.hxx"
32 #include <qmessagebox.h>
35 // Fonction Load qui utilise un Parser de fichier xml de Dataflow
36 // Utilise DataFlowEditor_XmlHandler.hxx et .cxx
38 //#include "SALOME_NamingService.hxx"
40 //#include <SALOMEconfig.h>
41 //#include CORBA_CLIENT_HEADER(SALOME_SuperVision)
43 #include "DataFlowBase_Graph.hxx"
45 bool GraphBase::Graph::LoadXml( CORBA::ORB_ptr _Orb ,
46 const char* myFileName ,
47 GraphBase::ListOfSGraphs & ListOfDataFlows )
49 char * FileName = new char[ strlen( myFileName ) + 5 ] ;
50 strcpy( FileName , myFileName ) ;
51 QString aqstrFileName(FileName) ;
52 QFile afile( aqstrFileName) ;
54 if ( !afile.exists() || !afile.open( IO_ReadOnly ) ) {
55 strcat( FileName , ".xml" ) ;
56 aqstrFileName = QString(FileName) ;
57 QFile afile( aqstrFileName ) ;
58 if ( !afile.exists() || !afile.open( IO_ReadOnly ) ) {
67 QString qstrFileName(FileName);
68 QFile file( qstrFileName);
69 // GraphBase::XmlHandler::XmlHandler * myXmlHandler = new GraphBase::XmlHandler::XmlHandler( _Orb , true );
70 QXmlInputSource source( file );
71 // QXmlSimpleReader reader;
72 // reader.setContentHandler( myXmlHandler );
73 // reader.setErrorHandler( myXmlHandler );
77 GraphBase::XmlHandler::XmlHandler * myXmlHandler = new GraphBase::XmlHandler::XmlHandler( _Orb , true );
78 QXmlSimpleReader reader;
79 reader.setContentHandler( myXmlHandler );
80 reader.setErrorHandler( myXmlHandler );
81 status = reader.parse( source ) ;
83 ListOfDataFlows = myXmlHandler->ListOfDataFlows() ;
84 cdebug << "Graph::LoadXml " << ListOfDataFlows.size() << " Graphs" << endl ;
87 cdebug << "Graph::LoadXml Graph status " << status << endl ;
93 // delete myXmlHandler ;
94 // Dataflow is now loaded.