]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
Porting KERNEL on new XML reader.
authormzn <mzn@opencascade.com>
Mon, 15 Oct 2007 13:55:54 +0000 (13:55 +0000)
committermzn <mzn@opencascade.com>
Mon, 15 Oct 2007 13:55:54 +0000 (13:55 +0000)
15 files changed:
configure.ac
salome_adm/unix/config_files/Makefile.am
salome_adm/unix/config_files/check_cppunit.m4
salome_adm/unix/config_files/check_libxml.m4 [new file with mode: 0644]
src/Container/Makefile.am
src/LifeCycleCORBA/Makefile.am
src/ModuleCatalog/Makefile.am
src/ModuleCatalog/SALOME_ModuleCatalog_Handler.cxx
src/ModuleCatalog/SALOME_ModuleCatalog_Handler.hxx
src/ModuleCatalog/SALOME_ModuleCatalog_impl.cxx
src/ResourcesManager/Makefile.am
src/ResourcesManager/SALOME_ResourcesCatalog_Handler.cxx
src/ResourcesManager/SALOME_ResourcesCatalog_Handler.hxx
src/ResourcesManager/SALOME_ResourcesManager.cxx
src/ResourcesManager/SALOME_ResourcesManager.hxx

index 3347624821dda4f2ce9ebf877f885061df5bf9d6..92a8266bca20849df5986682b1e50cb7d8196e7c 100644 (file)
@@ -244,20 +244,20 @@ AC_SUBST_FILE(CORBA)
 
 echo
 echo ---------------------------------------------
-echo Testing QT
+echo BOOST Library
 echo ---------------------------------------------
 echo
-# Qt must be kept because kernel makes use of qxml and some other
-# non-graphical stuff.
-CHECK_QT
+
+CHECK_BOOST
 
 echo
 echo ---------------------------------------------
-echo BOOST Library
+echo Testing libxml2
 echo ---------------------------------------------
 echo
 
-CHECK_BOOST
+CHECK_LIBXML
+
 
 fi 
 # --- end test corba
@@ -434,7 +434,7 @@ summary $basic_mandatory_products
 check_fatal_error $basic_mandatory_products
 echo
 
-corba_mandatory_products="omniORB_ok qt_ok boost_ok"
+corba_mandatory_products="omniORB_ok boost_ok"
 if test x$corba_gen = xtrue; then
   echo --- CORBA mandatory products - default configuration:
   summary $corba_mandatory_products
index 2cd5f15ce61a9bd441700335e9555a1b4b0d8b64..0c325253e4179937d13199d19b9e236fac6efa96 100644 (file)
@@ -73,7 +73,6 @@ check_mpich.m4 \
 check_omniorb.m4 \
 check_opengl.m4 \
 check_openpbs.m4 \
-check_qt.m4 \
 check_sockets.m4 \
 check_swig.m4 \
 check_withihm.m4 \
index 4029ea19017ac3ca5fc891dc51e108ffd100fcce..e78b4fa24aeb167aceba721cbff9ed29c056b058 100644 (file)
@@ -69,8 +69,7 @@ else
    AC_LANG_CPLUSPLUS
    CPPFLAGS_old=$CPPFLAGS
    CPPFLAGS="$CPPFLAGS -I$CPPUNIT_INCLUDES"
-   CPPFLAGS="$CPPFLAGS $QT_INCLUDES"
-
+   
    AC_CHECK_HEADER(cppunit/extensions/HelperMacros.h,cppunit_ok=yes,cppunit_ok=no) 
 
    CPPFLAGS=$CPPFLAGS_old
diff --git a/salome_adm/unix/config_files/check_libxml.m4 b/salome_adm/unix/config_files/check_libxml.m4
new file mode 100644 (file)
index 0000000..29fc1c3
--- /dev/null
@@ -0,0 +1,38 @@
+AC_DEFUN([CHECK_LIBXML],[
+
+AC_CHECKING(for libxml)
+
+# Custom location of libxml2 package can be specified
+# through LIBXML_DIR variable
+if test "x$LIBXML_DIR" != "x"
+then
+  CPPFLAGS="$CPPFLAGS -I$LIBXML_DIR/include/libxml2"
+  TMPLIBS="-L$LIBXML_DIR/lib -lxml2 $LIBS"
+else
+  CPPFLAGS="$CPPFLAGS -I/usr/include/libxml2"
+  TMPLIBS="-lxml2 $LIBS"
+fi
+
+AC_CHECK_HEADER(libxml/parser.h,libxml_ok="yes",libxml_ok="no")
+
+if  test "x$libxml_ok" = "xyes"
+then
+  LIBS_old=$LIBS
+  LIBS=$TMPLIBS
+  AC_CHECK_LIB(xml2,xmlInitParser,libxml_ok="yes",libxml_ok="no",)
+  LIBS=$LIBS_old
+fi
+
+if test "x$libxml_ok" = "xyes"
+then
+  LIBS=$TMPLIBS
+fi
+
+AC_MSG_RESULT(for libxml: $libxml_ok)
+
+LIBXML_LIBS=$LIBS
+AC_SUBST(LIBXML_LIBS)
+
+])dnl
+dnl
+
index 483524ef71c313ee0f329ccee908e8dcf179a2ca..4b681f518826431d13d6583b200c4e7c5307e3af 100644 (file)
@@ -65,7 +65,6 @@ COMMON_CPPFLAGS=\
        @PYTHON_INCLUDES@ \
        @MPI_INCLUDES@ \
        @HDF5_INCLUDES@ \
-       @QT_MT_INCLUDES@ \
        -I$(srcdir)/../Basics \
        -I$(srcdir)/../SALOMELocalTrace \
        -I$(srcdir)/../NamingService \
index 6bee2cf3c56c4420a2c2d31c6412866c2a3de316..2012177ed12bf296a7033dd2ef6c308280fb1c9a 100644 (file)
@@ -82,7 +82,6 @@ libSalomeLifeCycleCORBA_la_SOURCES  = \
 libSalomeLifeCycleCORBA_la_CPPFLAGS = \
        $(COMMON_CPPFLAGS) \
        @PYTHON_INCLUDES@ \
-       @QT_MT_INCLUDES@ \
        -I$(srcdir)/../Container \
        -I$(srcdir)/../Notification
 
index a29139fd2d5715fe642a36f0821439527e14b415..b0a7fb204afba5efd72929f74e2b0cb34bd7e1c2 100644 (file)
@@ -62,8 +62,7 @@ COMMON_CPPFLAGS=\
        -I$(srcdir)/../Utils \
        -I$(top_builddir)/salome_adm/unix \
        -I$(top_builddir)/idl \
-       @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ \
-       @QT_MT_INCLUDES@
+       @CORBA_CXXFLAGS@ @CORBA_INCLUDES@
 
 # This local variable defines the list of dependant libraries common to all target in this package.
 COMMON_LIBS =\
@@ -85,8 +84,7 @@ libSalomeCatalog_la_CPPFLAGS =\
 libSalomeCatalog_la_LDFLAGS = -no-undefined -version-info=0:0:0
 
 libSalomeCatalog_la_LIBADD  =\
-       $(COMMON_LIBS) \
-       @QT_MT_LIBS@
+       $(COMMON_LIBS)
 
 
 #
index 82f1710b81e4f3892d811108114a90eb34d85da0..3c7fa944d8845a6e210a1f63d974626b2fd685ea 100644 (file)
@@ -53,7 +53,9 @@ SALOME_ModuleCatalog_Handler::SALOME_ModuleCatalog_Handler()
   // Used in the function endElement
   test_path_prefix_name     = "path-prefix-name";
   test_computer_name        = "computer-name" ;
+  test_computer_list        = "computer-list" ;
   test_path_prefix          = "path-prefix" ;
+  test_path_prefix_list     = "path-prefix-list" ;
 
   test_component_name       = "component-name";
   test_component_username   = "component-username";
@@ -99,6 +101,7 @@ SALOME_ModuleCatalog_Handler::SALOME_ModuleCatalog_Handler()
 
   test_constraint = "constraint";
 
+  test_component_list = "component-list";
   test_component="component";
 
   if(MYDEBUG) END_OF("SALOME_ModuleCatalog_Handler");
@@ -114,11 +117,14 @@ SALOME_ModuleCatalog_Handler::~SALOME_ModuleCatalog_Handler()
   if(MYDEBUG) END_OF("~SALOME_ModuleCatalog_Handler()")
 }
 
-//----------------------------------------------------------------------
-// Function : startDocument
-// Purpose  : overload handler function
-//----------------------------------------------------------------------
-bool SALOME_ModuleCatalog_Handler::startDocument()
+
+//=============================================================================
+/*!
+ *  Processes XML document and fills the list of modules
+ */ 
+//=============================================================================
+
+void SALOME_ModuleCatalog_Handler::ProcessXmlDocument(xmlDocPtr theDoc)
 {
   if(MYDEBUG) MESSAGE("Begin parse document");
   // Empty the private elements
@@ -131,465 +137,393 @@ bool SALOME_ModuleCatalog_Handler::startDocument()
   _outDataStreamParamList.resize(0);
   _inParamList.resize(0);
   _outParamList.resize(0);
-  return true;
-}
 
-//----------------------------------------------------------------------
-// Function : startElement
-// Purpose  : overload handler function
-//----------------------------------------------------------------------
-bool SALOME_ModuleCatalog_Handler::startElement(const QString&, 
-                                               const QString &,
-                                               const QString& qName, 
-                                               const QXmlAttributes& atts)
-{
-  _xml_pile.push(qName);
+  // Get the document root node
+  xmlNodePtr aCurNode = xmlDocGetRootElement(theDoc);
 
-  return true;
-} 
+  aCurNode = aCurNode->xmlChildrenNode;
 
-//----------------------------------------------------------------------
-// Function : endElement
-// Purpose  : overload handler function
-//----------------------------------------------------------------------
-bool SALOME_ModuleCatalog_Handler::endElement(const QString&, 
-                                             const QString &,
-                                             const QString& qName)
-{
-  QString parent, grandparent;
-  _xml_pile.pop();
-  if (!_xml_pile.empty()) {
-    parent = _xml_pile.top();
-    _xml_pile.pop();
-    if (!_xml_pile.empty()) grandparent = _xml_pile.top();
-    _xml_pile.push(parent);
-  }
-
-  // Path prefix
-
-  // tag test_path_prefix_name
-  if((qName.compare(test_path_prefix_name)==0)) {
-    _pathPrefix.path = content;
-    return true;
-  }
-
-  // tag test_computer_name
-  if((qName.compare(test_computer_name)==0)) {
-    _pathPrefix.listOfComputer.push_back(content);
-    return true;
-  }
-   
-  // tag test_path_prefix
-  if((qName.compare(test_path_prefix)==0)) {
-    _pathList.push_back(_pathPrefix);
-    _pathPrefix.listOfComputer.resize(0);
-    return true;
-  }
-
-  // Component identification
-
-  // tag test_component_name
-  if((qName.compare(test_component_name)==0)) {
-    _aModule.name = content ;
-    return true;
-  }
-
-  // tag test_component_username
-  if((qName.compare(test_component_username)==0)) {
-    _aModule.username = content ;
-    return true;
-  }
-
-  // tag test_component_type
-   if((qName.compare(test_component_type)==0)) 
-     {
-       if ((content.compare("MESH") == 0) ||
-          (content.compare("Mesh") == 0) ||
-          (content.compare("mesh") == 0))
-        _aModule.type = MESH ;
-       else if((content.compare("MED") == 0) ||
-              (content.compare("Med") == 0) ||
-              (content.compare("med") == 0))
-        _aModule.type = Med ;
-       else if((content.compare("GEOM") == 0) ||
-              (content.compare("Geom") == 0) ||
-              (content.compare("geom") == 0))
-        _aModule.type = GEOM ;
-       else if((content.compare("SOLVER") == 0) ||
-              (content.compare("Solver") == 0) ||
-              (content.compare("solver") == 0))
-        _aModule.type = SOLVER ;
-       else if((content.compare("SUPERV") == 0) ||
-              (content.compare("Superv") == 0) ||
-              (content.compare("Supervision") == 0) ||
-              (content.compare("superv") == 0))
-        _aModule.type = SUPERV ;
-       else if((content.compare("DATA") == 0) ||
-              (content.compare("Data") == 0) ||
-              (content.compare("data") == 0))
-        _aModule.type = DATA ; 
-       else if((content.compare("VISU") == 0) ||
-              (content.compare("Visu") == 0) ||
-              (content.compare("visu") == 0))
-        _aModule.type = VISU ; 
-       else if((content.compare("OTHER") == 0) ||
-              (content.compare("Other") == 0) ||
-              (content.compare("other") == 0))                
-        _aModule.type = OTHER ;
-       else
-        // If it'not in all theses cases, the type is affected to OTHER
-        _aModule.type = OTHER ;
-       return true;
-     }
-
-   // tag test_component_multistudy
-   if((qName.compare(test_component_multistudy)==0)) {
-    _aModule.multistudy = atoi(content.c_str()) ;
-    return true;
-   }
-
-   // tag test_component_impltype
-  if((qName.compare(QString(test_component_impltype))==0)) 
-    _aModule.implementationType = atoi(content.c_str()) ;
-
-  // tag test_component_icon
-   if((qName.compare(test_component_icon)==0)) {
-     _aModule.icon = content ;
-     return true;
-   }
-
-  // tag test_component_version
-   if((qName.compare(test_component_version)==0)) {
-     _aModule.version = content ;
-     return true;
-   }
-
-  // tag test_component_comment
-   if((qName.compare(test_component_comment)==0)) {
-     _aModule.comment = content ;
-     return true;
-   }
-
-   // interface identification
-
-   // tag test_interface_name
-   if ((qName.compare(test_interface_name)==0)) {
-       _aInterface.name = content ;
-       return true;
-   }
-
-   // Service identification
-
-   // tag test_service_name
-   if ((qName.compare(test_service_name)==0)) {
-     _aService.name = content ;
-     return true;
-   }
-
-   //tag test_defaultservice
-   if ((qName.compare(test_defaultservice)==0)) {
-     _aService.byDefault = atoi(content.c_str()) ;
-     return true;
-   }
-
-   //tag test_typeofnode
-   if((qName.compare(QString(test_typeofnode))==0))
-     _aService.typeOfNode = atoi(content.c_str()) ;
-
-   // Parameter in
-
-   // tag test_inDataStreamParameter_type
-   if ((qName.compare(test_inDataStreamParameter_type)==0)) {
-     if (grandparent.compare(test_inDataStreamParameter_list) == 0)
-       _inDataStreamParam.type = content ;
-     else 
-        _inParam.type = content ;
-     return true;
-   }
-        
-   // tag test_inParameter_type
-   if ((qName.compare(test_inParameter_type)==0)) {
-     if (grandparent.compare(test_inDataStreamParameter_list) == 0)
-       _inDataStreamParam.type = content ;
-     else 
-        _inParam.type = content ;
-     return true;
-   }
-        
-   //tag test_inDataStreamParameter_name
-   if ((qName.compare(test_inDataStreamParameter_name)==0)) {
-     if (grandparent.compare(test_inDataStreamParameter_list) == 0)
-       _inDataStreamParam.name = content ;
-     else 
-        _inParam.name = content ;
-     return true;
-   }
-
-   //tag test_inParameter_name
-   if ((qName.compare(test_inParameter_name)==0)) {
-     if(MYDEBUG) SCRUTE(parent);
-     if(MYDEBUG) SCRUTE(grandparent);
-     if (grandparent.compare(test_inDataStreamParameter_list) == 0)
-       _inDataStreamParam.name = content ;
-     else 
-       _inParam.name = content ;
-     return true;
-   }
-
-   //tag test_inDataStreamParameter_dependency
-   if ((qName.compare(test_inDataStreamParameter_dependency)==0)) {
-       _inDataStreamParam.dependency = content ;
-     return true;
-   }
-
-   //tag test_inParameter
-  if ((qName.compare(test_inParameter)==0))
+  // Processing the document nodes
+  while(aCurNode != NULL)
     {
-      if (parent.compare(test_inParameter_list)==0) {
+      // Process path prefix list (tag test_path_prefix_list)
+      if ( !xmlStrcmp(aCurNode->name,(const xmlChar*)test_path_prefix_list) )
+       {
+         xmlNodePtr aCurSubNode = aCurNode->xmlChildrenNode;
+         while(aCurSubNode != NULL)
+           {
+             // Forming a PathPrefix structure (tag test_path_prefix)
+             if ( xmlStrcmp(aCurSubNode->name, (const xmlChar*)test_path_prefix) ) {
+               aCurSubNode = aCurSubNode->next;
+               continue;
+             }
+             
+             xmlNodePtr aCurSubSubNode = aCurSubNode->xmlChildrenNode;
+             while(aCurSubSubNode != NULL)
+               {
+                 // Tag test_path_prefix_name
+                 if ( !xmlStrcmp(aCurSubSubNode->name, (const xmlChar*)test_path_prefix_name) )
+                   _pathPrefix.path = (const char*)aCurSubSubNode->content;
+
+                 // Tag test_computer_list
+                 if ( !xmlStrcmp(aCurSubSubNode->name, (const xmlChar*)test_computer_list) ) {
+                   xmlNodePtr aComputerNode = aCurSubSubNode->xmlChildrenNode;
+                   while (aComputerNode != NULL) {
+                     // Tag test_computer_name
+                     if ( !xmlStrcmp(aComputerNode->name, (const xmlChar*) test_computer_name) )
+                       _pathPrefix.listOfComputer.push_back((const char*)aComputerNode->content);
+                     
+                     aComputerNode = aComputerNode->next;
+                   }
+                 }
+                 
+                 aCurSubSubNode = aCurSubSubNode->next;
+               }
+             
+             _pathList.push_back(_pathPrefix);
+             _pathPrefix.listOfComputer.resize(0);
+             
+             aCurSubNode = aCurSubNode->next;
+           }
+       }
+
+      //@ Process list of components (tag test_component_list)
+      if ( !xmlStrcmp(aCurNode->name,(const xmlChar*)test_component_list) )
+       {
+         xmlNodePtr aComponentNode = aCurNode->xmlChildrenNode;
+         while(aComponentNode != NULL)
+           {
+             // Do not process tags differ from test_component here
+             if ( xmlStrcmp(aComponentNode->name, (const xmlChar*)test_component) ) {
+               aComponentNode = aComponentNode->next;
+               continue;
+             }
+             
+             // Component identification
+
+             // Empty temporary structures
+             _aModule.name = "";
+             _aModule.constraint = "";
+             _aModule.icon="";       
+             _aModule.interfaces.resize(0);
+             
+             xmlNodePtr aComponentSubNode = aComponentNode->xmlChildrenNode;
+             while(aComponentSubNode != NULL) {
+               
+               std::string aContent = (const char*)aComponentSubNode->content;
+
+               // Tag test_component_name
+               if ( !xmlStrcmp(aComponentSubNode->name, (const xmlChar*)test_component_name) )
+                 _aModule.name = aContent;
+
+               // Tag test_component_username
+               if ( !xmlStrcmp(aComponentSubNode->name, (const xmlChar*)test_component_username) )
+                 _aModule.username = aContent;
+
+               // Tag test_component_type
+               if ( !xmlStrcmp(aComponentSubNode->name, (const xmlChar*)test_component_type) ) {
+                 std::string aType = aContent;
+
+                 if ((aType.compare("MESH") == 0) ||
+                     (aType.compare("Mesh") == 0) ||
+                     (aType.compare("mesh") == 0))
+                   _aModule.type = MESH ;
+                 else if((aType.compare("MED") == 0) ||
+                         (aType.compare("Med") == 0) ||
+                         (aType.compare("med") == 0))
+                   _aModule.type = Med ;
+                 else if((aType.compare("GEOM") == 0) ||
+                         (aType.compare("Geom") == 0) ||
+                         (aType.compare("geom") == 0))
+                   _aModule.type = GEOM ;
+                 else if((aType.compare("SOLVER") == 0) ||
+                         (aType.compare("Solver") == 0) ||
+                         (aType.compare("solver") == 0))
+                   _aModule.type = SOLVER ;
+                 else if((aType.compare("SUPERV") == 0) ||
+                         (aType.compare("Superv") == 0) ||
+                         (aType.compare("Supervision") == 0) ||
+                         (aType.compare("superv") == 0))
+                   _aModule.type = SUPERV ;
+                 else if((aType.compare("DATA") == 0) ||
+                         (aType.compare("Data") == 0) ||
+                         (aType.compare("data") == 0))
+                   _aModule.type = DATA ; 
+                 else if((aType.compare("VISU") == 0) ||
+                         (aType.compare("Visu") == 0) ||
+                         (aType.compare("visu") == 0))
+                   _aModule.type = VISU ; 
+                 else if((aType.compare("OTHER") == 0) ||
+                         (aType.compare("Other") == 0) ||
+                         (aType.compare("other") == 0))                
+                   _aModule.type = OTHER ;
+                 else
+                   // If it'not in all theses cases, the type is affected to OTHER
+                   _aModule.type = OTHER ;
+               }
+               
+               // Tag test_component_multistudy
+               if ( !xmlStrcmp(aComponentSubNode->name, (const xmlChar*)test_component_multistudy) )
+                 _aModule.multistudy = atoi( aContent.c_str() );
+
+               // Tag test_component_impltype
+               if ( !xmlStrcmp(aComponentSubNode->name, (const xmlChar*)test_component_impltype) )
+                 _aModule.implementationType = atoi(aContent.c_str());
+
+               // Tag test_component_icon
+               if ( !xmlStrcmp(aComponentSubNode->name, (const xmlChar*)test_component_icon) )
+                 _aModule.icon = aContent;
+
+               // Tag test_component_version
+               if ( !xmlStrcmp(aComponentSubNode->name, (const xmlChar*)test_component_version) )
+                 _aModule.version = aContent;
+
+               // Tag test_component_comment
+               if ( !xmlStrcmp(aComponentSubNode->name, (const xmlChar*)test_component_comment) )
+                 _aModule.comment = aContent;
+
+               // Tag test_constraint
+               if ( !xmlStrcmp(aComponentSubNode->name, (const xmlChar*)test_constraint) )
+                 _aModule.constraint = aContent;
+               
+               // Process tag test_interface_list:
+               if ( !xmlStrcmp(aComponentSubNode->name, (const xmlChar*)test_interface_list) ) {
+
+                 // Form an interface list for the component
+                 xmlNodePtr aSubNode = aComponentSubNode->xmlChildrenNode;
+                 while(aSubNode != NULL) {
+                   // Tag test_interface_name
+                   if ( !xmlStrcmp(aSubNode->name, (const xmlChar*)test_interface_name) )
+                     _aInterface.name = (const char*)aSubNode->content;
+                   
+                   // Tag test_service_list
+                   if ( !xmlStrcmp(aSubNode->name, (const xmlChar*)test_service_list) ) {
+                     // Form a service list for the interface
+                     xmlNodePtr aCompServiceNode = aSubNode->xmlChildrenNode;
+                     while(aCompServiceNode != NULL) {
+                       // Tag test_service
+                       if ( !xmlStrcmp(aCompServiceNode->name, (const xmlChar*)test_interface_name) ) {
+                         xmlNodePtr aCompServiceSubNode = aCompServiceNode->xmlChildrenNode;
+                         while(aCompServiceSubNode != NULL) {
+                           // Tag test_service_name
+                           if ( !xmlStrcmp(aCompServiceSubNode->name, (const xmlChar*)test_service_name) )
+                             _aService.name = (const char*)aCompServiceSubNode->content;
+
+                           // Tag test_defaultservice
+                           if ( !xmlStrcmp(aCompServiceSubNode->name, (const xmlChar*)test_defaultservice) )
+                             _aService.byDefault = (const char*)aCompServiceSubNode->content;
+
+                           // Tag test_typeofnode
+                           if ( !xmlStrcmp(aCompServiceSubNode->name, (const xmlChar*)test_typeofnode) )
+                             _aService.typeOfNode = (const char*)aCompServiceSubNode->content;
+
+                           // Tag test_inParameter_list
+                           if ( !xmlStrcmp(aCompServiceSubNode->name, (const xmlChar*)test_inParameter_list) ) {
+                             xmlNodePtr aParamNode = aCompServiceSubNode->xmlChildrenNode;
+                             while(aParamNode != NULL) {
+                               
+                               // Tag test_inParameter
+                               if (xmlStrcmp(aParamNode->name, (const xmlChar*)test_inParameter)) {
+                                 aParamNode = aParamNode->next;
+                                 continue;
+                               }
+                               
+                               xmlNodePtr aParamItemNode = aParamNode->xmlChildrenNode;
+                               while(aParamItemNode != NULL) {
+
+                                 // Tag test_inParameter_name
+                                 if ( !xmlStrcmp(aParamItemNode->name, (const xmlChar*)test_inParameter_name) )
+                                   _inParam.name = (const char*)aParamItemNode->content;
+
+                                 // Tag test_inParameter_type
+                                 if ( !xmlStrcmp(aParamItemNode->name, (const xmlChar*)test_inParameter_type) )
+                                   _inParam.type = (const char*)aParamItemNode->content;
+                                 
+                                 aParamItemNode = aParamItemNode->next;
+                               }
+                               
+                               _inParamList.push_back(_inParam) ; 
        
-       if(MYDEBUG) MESSAGE("add inParameter : " << _inParam.name);
-       _inParamList.push_back(_inParam) ; 
+                               // Empty temporary structures
+                               _inParam.type = "";
+                               _inParam.name = "";
+
+                               aParamNode = aParamNode->next;
+                             }
+                             
+                             _aService.inParameters = _inParamList;
+                             _inParamList.resize(0);
+                           }
+
+                           // Tag test_outParameter_list
+                           if ( !xmlStrcmp(aCompServiceSubNode->name, (const xmlChar*)test_outParameter_list) ) {
+                             xmlNodePtr aParamNode = aCompServiceSubNode->xmlChildrenNode;
+                             while(aParamNode != NULL) {
+                               
+                               // Tag test_outParameter
+                               if (xmlStrcmp(aParamNode->name, (const xmlChar*)test_outParameter)) {
+                                 aParamNode = aParamNode->next;
+                                 continue;
+                               }
+                               
+                               xmlNodePtr aParamItemNode = aParamNode->xmlChildrenNode;
+                               while(aParamItemNode != NULL) {
+
+                                 // Tag test_outParameter_name
+                                 if ( !xmlStrcmp(aParamItemNode->name, (const xmlChar*)test_outParameter_name) )
+                                   _outParam.name = (const char*)aParamItemNode->content;
+
+                                 // Tag test_outParameter_type
+                                 if ( !xmlStrcmp(aParamItemNode->name, (const xmlChar*)test_outParameter_type) )
+                                   _outParam.type = (const char*)aParamItemNode->content;
+                                 
+                                 aParamItemNode = aParamItemNode->next;
+                               }
+                               
+                               _outParamList.push_back(_outParam) ; 
        
-       // Empty temporary structures
-       _inParam.type = "";
-       _inParam.name = "";
-      }
-      else if ((qName.compare(test_inDataStreamParameter)==0)) {
+                               // Empty temporary structures
+                               _outParam.type = "";
+                               _outParam.name = "";
+
+                               aParamNode = aParamNode->next;
+                             }
+                             
+                             _aService.outParameters = _outParamList;
+                             _outParamList.resize(0);
+                           }
+
+                           //@ Tag test_inDataStreamParameter_list
+                           if ( !xmlStrcmp(aCompServiceSubNode->name, (const xmlChar*)test_inDataStreamParameter_list) ) {
+                             xmlNodePtr aParamNode = aCompServiceSubNode->xmlChildrenNode;
+                             while(aParamNode != NULL) {
+                               
+                               // Tag test_inDataStreamParameter
+                               if (xmlStrcmp(aParamNode->name, (const xmlChar*)test_inDataStreamParameter)) {
+                                 aParamNode = aParamNode->next;
+                                 continue;
+                               }
+                               
+                               xmlNodePtr aParamItemNode = aParamNode->xmlChildrenNode;
+                               while(aParamItemNode != NULL) {
+
+                                 // Tag test_inDataStreamParameter_name
+                                 if ( !xmlStrcmp(aParamItemNode->name, (const xmlChar*)test_inDataStreamParameter_name) )
+                                   _inDataStreamParam.name = (const char*)aParamItemNode->content;
+
+                                 // Tag test_inDataStreamParameter_type
+                                 if ( !xmlStrcmp(aParamItemNode->name, (const xmlChar*)test_inDataStreamParameter_type) )
+                                   _inDataStreamParam.type = (const char*)aParamItemNode->content;
+
+                                 // Tag test_inDataStreamParameter_dependency
+                                 if ( !xmlStrcmp(aParamItemNode->name, (const xmlChar*)test_inDataStreamParameter_dependency) )
+                                   _inDataStreamParam.dependency = (const char*)aParamItemNode->content;
+                                 
+                                 aParamItemNode = aParamItemNode->next;
+                               }
+                               
+                               _inDataStreamParamList.push_back(_inDataStreamParam) ; 
        
-       if(MYDEBUG) MESSAGE("add inDataStreamParameter : " << _inDataStreamParam.name);
-       _inDataStreamParamList.push_back(_inDataStreamParam) ; 
+                               // Empty temporary structures
+                               _inDataStreamParam.type = "";
+                               _inDataStreamParam.name = "";
+                               _inDataStreamParam.dependency = "";
+
+                               aParamNode = aParamNode->next;
+                             }
+                             
+                             _aService.inDataStreamParameters = _inDataStreamParamList;
+                             _inDataStreamParamList.resize(0);
+                           }
+                           
+                           // Tag test_outDataStreamParameter_list
+                           if ( !xmlStrcmp(aCompServiceSubNode->name, (const xmlChar*)test_outDataStreamParameter_list) ) {
+                             xmlNodePtr aParamNode = aCompServiceSubNode->xmlChildrenNode;
+                             while(aParamNode != NULL) {
+                               
+                               // Tag test_outDataStreamParameter
+                               if (xmlStrcmp(aParamNode->name, (const xmlChar*)test_outDataStreamParameter)) {
+                                 aParamNode = aParamNode->next;
+                                 continue;
+                               }
+                               
+                               xmlNodePtr aParamItemNode = aParamNode->xmlChildrenNode;
+                               while(aParamItemNode != NULL) {
+
+                                 // Tag test_outDataStreamParameter_name
+                                 if ( !xmlStrcmp(aParamItemNode->name, (const xmlChar*)test_outDataStreamParameter_name) )
+                                   _outDataStreamParam.name = (const char*)aParamItemNode->content;
+
+                                 // Tag test_outDataStreamParameter_type
+                                 if ( !xmlStrcmp(aParamItemNode->name, (const xmlChar*)test_outDataStreamParameter_type) )
+                                   _outDataStreamParam.type = (const char*)aParamItemNode->content;
+
+                                 // Tag test_outDataStreamParameter_dependency
+                                 if ( !xmlStrcmp(aParamItemNode->name, (const xmlChar*)test_outDataStreamParameter_dependency) )
+                                   _outDataStreamParam.dependency = (const char*)aParamItemNode->content;
+                                 
+                                 aParamItemNode = aParamItemNode->next;
+                               }
+                               
+                               _outDataStreamParamList.push_back(_outDataStreamParam) ; 
        
-       // Empty temporary structures
-       _inDataStreamParam.type = "";
-       _inDataStreamParam.name = "";
-       _inDataStreamParam.dependency = "";
-      }
-      return true;
+                               // Empty temporary structures
+                               _outDataStreamParam.type = "";
+                               _outDataStreamParam.name = "";
+                               _outDataStreamParam.dependency = "";
+
+                               aParamNode = aParamNode->next;
+                             }
+                             
+                             _aService.outDataStreamParameters = _outDataStreamParamList;
+                             _outDataStreamParamList.resize(0);
+                           }
+                           
+                           aCompServiceSubNode = aCompServiceSubNode->next;
+                         }
+
+
+                         // Put formed service into the list
+                         _serviceList.push_back(_aService);
+
+                         // Empty temporary structures
+                         _aService.name = "";
+                         _aService.typeOfNode = 1;
+                         _aService.inParameters.resize(0);
+                         _aService.outParameters.resize(0);
+                         _aService.inDataStreamParameters.resize(0);
+                         _aService.outDataStreamParameters.resize(0);
+                       }
+                       
+                       aCompServiceNode = aCompServiceNode->next;
+                     }
+                     
+                     _aInterface.services = _serviceList ;
+                     
+                     // Empty temporary structures
+                     _serviceList.resize(0);
+                     _interfaceList.push_back(_aInterface);  
+                     _aInterface.name ="";    
+                     _aInterface.services.resize(0);
+                   }
+                   
+                   aSubNode = aSubNode->next;
+                 }
+                 
+                 _aModule.interfaces = _interfaceList ;
+                 _interfaceList.resize(0);
+               }
+               
+
+               aComponentSubNode = aComponentSubNode->next;
+             }
+           
+             
+             aComponentNode = aComponentNode->next;
+           }
+       }
+
+      
+      aCurNode = aCurNode->next;
     }
-  
-   //tag test_inParameter_list
-   if((qName.compare(test_inParameter_list)==0))
-     {
-       if(MYDEBUG) SCRUTE(_inParamList.size());
-       _aService.inParameters = _inParamList;
-       _inParamList.resize(0);
-       return true;
-     }
-  
-   //tag test_inDataStreamParameter_list
-   if((qName.compare(test_inDataStreamParameter_list)==0))
-     {
-       if(MYDEBUG) SCRUTE(_inDataStreamParamList.size());
-       _aService.inDataStreamParameters = _inDataStreamParamList;
-       _inDataStreamParamList.resize(0);
-     }
-   //tag test_outDataStreamParameter_list
-   if((qName.compare(test_outDataStreamParameter_list)==0))
-     {
-       if(MYDEBUG) SCRUTE(_outDataStreamParamList.size());
-       _aService.outDataStreamParameters = _outDataStreamParamList;
-       _outDataStreamParamList.resize(0);
-       return true;
-     }
-
-
-
-   // Parameter out
-   if(MYDEBUG) SCRUTE(qName);
-
-   // tag test_outParameter_type
-   if ((qName.compare(test_outParameter_type)==0)) {
-     if (grandparent.compare(test_outDataStreamParameter_list) == 0)
-       _outDataStreamParam.type = content ;
-     else 
-        _outParam.type = content ;
-     return true;
-   }
-        
-   // tag test_outDataStreamParameter_type
-   if ((qName.compare(test_outDataStreamParameter_type)==0)) {
-     if (grandparent.compare(test_outDataStreamParameter_list) == 0)
-       _outDataStreamParam.type = content ;
-     else 
-        _outParam.type = content ;
-     return true;
-   }
-        
-   //tag test_outParameter_name
-   if ((qName.compare(test_outParameter_name)==0)) {
-     if (grandparent.compare(test_outDataStreamParameter_list) == 0)
-       _outDataStreamParam.name = content ;
-     else 
-        _outParam.name = content ;
-     return true;
-   }
-        
-   //tag test_outDataStreamParameter_name
-   if ((qName.compare(test_outDataStreamParameter_name)==0)) {
-     if(MYDEBUG) SCRUTE(grandparent);
-     if(MYDEBUG) SCRUTE(test_outDataStreamParameter_list);
-     if (grandparent.compare(test_outDataStreamParameter_list) == 0)
-       _outDataStreamParam.name = content ;
-     else 
-        _outParam.name = content ;
-     return true;
-   }
-        
-   //tag test_outParameter_dependency
-   if ((qName.compare(test_outDataStreamParameter_dependency)==0)) {
-     _outDataStreamParam.dependency = content ;
-     return true;
-   }
-
-   //tag test_outParameter
-  if ((qName.compare(test_outParameter)==0))
-    {
-      if (parent.compare(test_outParameter_list)==0) {
-       
-       if(MYDEBUG) MESSAGE("add outParameter : " << _outParam.name);
-       _outParamList.push_back(_outParam) ; 
-       
-       // Empty temporary structures
-       _outParam.type = "";
-       _outParam.name = "";
-      }
-      else if ((qName.compare(test_outDataStreamParameter)==0)) {
-       
-       if(MYDEBUG) MESSAGE("add outDataStreamParameter : " << _outDataStreamParam.name);
-       _outDataStreamParamList.push_back(_outDataStreamParam) ; 
-       
-       // Empty temporary structures
-       _outDataStreamParam.type = "";
-       _outDataStreamParam.name = "";
-       _outDataStreamParam.dependency = "";
-      }
-      return true;
-    }
-  
-   //tag test_outParameter_list
-   if((qName.compare(test_outParameter_list)==0))
-     {
-       if(MYDEBUG) SCRUTE(_outParamList.size());
-       _aService.outParameters = _outParamList;
-       _outParamList.resize(0);
-       return true;
-     }
-  
-   // tag   test_service
-   if((qName.compare(test_service)==0))
-     {
-       _serviceList.push_back(_aService);
-
-       // Empty temporary structures
-       _aService.name = "";
-       _aService.typeOfNode = 1;
-       _aService.inParameters.resize(0);
-       _aService.outParameters.resize(0);
-       _aService.inDataStreamParameters.resize(0);
-       _aService.outDataStreamParameters.resize(0);
-     }
-
-   // tag   test_service_list
-   if((qName.compare(test_service_list)==0))
-     {
-       _aInterface.services = _serviceList ;
-
-       // Empty temporary structures
-       _serviceList.resize(0); 
-       _interfaceList.push_back(_aInterface);  
-       _aInterface.name ="";    
-       _aInterface.services.resize(0);
-
-     }
-
-   //tag test_interface_list
-   if((qName.compare(test_interface_list)==0))
-     {
-       _aModule.interfaces = _interfaceList ;
-       _interfaceList.resize(0);
-     }
-
-   //tag test_constraint
-   if((qName.compare(test_constraint)==0))
-     _aModule.constraint = content ;
-
-   // tag test_component
-   if((qName.compare(test_component)==0))
-     {
-       _moduleList.push_back(_aModule) ;
-       
-       // Empty temporary structures
-       _aModule.name = "";
-       _aModule.constraint = "";
-       _aModule.icon="";       
-       _aModule.interfaces.resize(0);
-     }
-    
-  return true;
-}
-  
-//----------------------------------------------------------------------
-// Function : characters
-// Purpose  : overload handler function
-//----------------------------------------------------------------------
-bool SALOME_ModuleCatalog_Handler::characters(const QString& chars)
-{
-  content = (const char*)chars ;
-  return true;
-}
-
-//----------------------------------------------------------------------
-// Function : endDocument
-// Purpose  : overload handler function
-//            Print all informations find in the catalog 
-//            (only in DEBUG mode!!)
-//----------------------------------------------------------------------  
-#include <fstream>
-bool SALOME_ModuleCatalog_Handler::endDocument()
-{
-//  ofstream f("/tmp/logs/xxx.log", std::ofstream::app);
-//  f << "---------------------------------------------------------" << std::endl;
-  if(MYDEBUG) BEGIN_OF("endDocument");
-  //_pathlist
-  for (unsigned int ind = 0; ind < _pathList.size(); ind++)
-    {
-      if(MYDEBUG) MESSAGE("Path :"<<_pathList[ind].path);
-      for (unsigned int i = 0; i < _pathList[ind].listOfComputer.size(); i++)
-       if(MYDEBUG) MESSAGE("Computer name :" << _pathList[ind].listOfComputer[i]);
-    }
-
-   // _moduleList
-//  if(MYDEBUG) SCRUTE(_moduleList.size());
-//  for (unsigned int ind = 0; ind < _moduleList.size(); ind++)
-//    {
-//      f << _moduleList[ind] << std::endl;
-//    }
-
-  if(MYDEBUG) MESSAGE("Document parsed");
-  if(MYDEBUG) END_OF("endDocument");
-  return true;
-}
-//----------------------------------------------------------------------
-// Function : errorProtocol
-// Purpose  : overload handler function
-//----------------------------------------------------------------------  
-QString SALOME_ModuleCatalog_Handler::errorProtocol()
-{
-  return errorProt ;
-}
-
-
-//----------------------------------------------------------------------
-// Function : fatalError
-// Purpose  : overload handler function
-//----------------------------------------------------------------------  
-bool SALOME_ModuleCatalog_Handler::fatalError(const QXmlParseException& exception)
-{
-    errorProt += QString( "fatal parsing error: %1 in line %2, column %3\n" )
-    .arg( exception.message() )
-    .arg( exception.lineNumber() )
-    .arg( exception.columnNumber() );
-
-  return QXmlDefaultHandler::fatalError( exception );
 }
index 01870cf85eac03ccf9cee9480424b2f89b5c016e..d8c27c5a8380f040dd70835ed62bcd566a11021a 100644 (file)
 #include <SALOME_ModuleCatalog.hxx>
 
 #include "SALOME_ModuleCatalog_Parser.hxx"
-#include <qxml.h>
+
 #include <string>
 #include <stack>
 #include <map>
 
-class MODULECATALOG_EXPORT SALOME_ModuleCatalog_Handler : public QXmlDefaultHandler 
+#include <libxml/parser.h>
+
+class MODULECATALOG_EXPORT SALOME_ModuleCatalog_Handler
 {
 public:
   //! standard constructor
@@ -46,140 +48,84 @@ public:
   //! standard destructor
   virtual ~SALOME_ModuleCatalog_Handler();
 
-
-  //! method to overload handler function startDocument
-  /*! Is called before a xml file is parsed
-   \return true if no error was detected
-  */ 
-  virtual bool startDocument();
-
-
-  //! method to overload handler function startElement
-  /*! 
-   \param QString argument by value
-   \param QString argument by value
-   \param QString argument by value
-   \param QXmlAttributes argument by value
-   \return true if no error was detected
-  */
-  virtual bool startElement(const QString&, const QString &,
-                           const QString& qName, const QXmlAttributes& atts); 
-
-  //! method to overload handler function endElement
-  /*!
-   \param QString argument by value
-   \param QString argument by value
-   \param QString argument by value
-   \return true if no error was detected
-   \sa _Find
-  */   
-  virtual bool endElement(const QString&, const QString &,
-                         const QString& qName);
-  
-
-  //! method to overload handler function characters
-  /*!
-   \param QString argument by value
-   \return true if no error was detected
-  */
-  virtual bool characters(const QString& chars);
-  
-  //! method to overload handler function endDocument
-  /*! Is called at the end of the parsing
-   \return true if no error was detected
-  */
-  virtual bool endDocument();
-
-  //! method to overload handler function errorProtocol
- /*!
-   \return the error message
-  */
-  virtual QString errorProtocol();
-
-  //! method to overload handler function fatalError
-  /*!
-    \param QXmlParseExecption argument by value
-    \return true if no error was detected
-  */
-  virtual bool fatalError(const QXmlParseException& exception);
+  void ProcessXmlDocument(xmlDocPtr theDoc);
  
 private:
-  QString errorProt ;
-
-  std::string content;
 
-  QString test_path_prefix_name ;
-  QString test_computer_name ;
-  QString test_path_prefix ;
-
-  QString test_component_name;
-  QString test_component_username;
-  QString test_component_type ;
-  QString test_component_multistudy ;
-  QString test_component_icon ;
-  QString test_component_impltype;
-  QString test_component_version;
-  QString test_component_comment;
-
-  QString test_interface_name;
-
-  QString test_service_name;
-  QString test_defaultservice;
-  QString test_typeofnode;
-
-  QString test_inParameter_type;
-  QString test_inParameter_name;
-  QString test_inParameter;
-  QString test_inParameter_list;
-
-  QString test_outParameter_type;
-  QString test_outParameter_name;
-  QString test_outParameter;
-  QString test_outParameter_list;
-
-  QString test_inDataStreamParameter_type;
-  QString test_inDataStreamParameter_name;
-  QString test_inDataStreamParameter_dependency;
-  QString test_inDataStreamParameter;
-  QString test_inDataStreamParameter_list;
-
-  QString test_outDataStreamParameter_type;
-  QString test_outDataStreamParameter_name;
-  QString test_outDataStreamParameter_dependency;
-  QString test_outDataStreamParameter;
-  QString test_outDataStreamParameter_list;
-
-  QString test_service;
-  QString test_service_list;
-  QString test_interface_list;
-  QString test_constraint;
+  const char *test_path_prefix_name ;
+  const char *test_computer_name ;
+  const char *test_computer_list ;
+  const char *test_path_prefix ;
+  const char *test_path_prefix_list;
+
+  const char *test_component_name;
+  const char *test_component_username;
+  const char *test_component_type ;
+  const char *test_component_multistudy ;
+  const char *test_component_icon ;
+  const char *test_component_impltype;
+  const char *test_component_version;
+  const char *test_component_comment;
+  
+  const char *test_interface_name;
+  
+  const char *test_service_name;
+  const char *test_defaultservice;
+  const char *test_typeofnode;
+  
+  const char *test_inParameter_type;
+  const char *test_inParameter_name;
+  const char *test_inParameter;
+  const char *test_inParameter_list;
+  
+  const char *test_outParameter_type;
+  const char *test_outParameter_name;
+  const char *test_outParameter;
+  const char *test_outParameter_list;
+  
+  const char *test_inDataStreamParameter_type;
+  const char *test_inDataStreamParameter_name;
+  const char *test_inDataStreamParameter_dependency;
+  const char *test_inDataStreamParameter;
+  const char *test_inDataStreamParameter_list;
+  
+  const char *test_outDataStreamParameter_type;
+  const char *test_outDataStreamParameter_name;
+  const char *test_outDataStreamParameter_dependency;
+  const char *test_outDataStreamParameter;
+  const char *test_outDataStreamParameter_list;
+  
+  const char *test_service;
+  const char *test_service_list;
+  const char *test_interface_list;
+  const char *test_constraint;
+  
+  const char *test_component_list;
+  const char *test_component;
   
-  QString test_component;
-
   ParserPathPrefix _pathPrefix;
-
+  
   ParserComponent _aModule;
-
-
+  
+  
   ParserInterfaces _interfaceList;
   ParserInterface  _aInterface;
-
+  
   ParserServices   _serviceList;
   ParserService    _aService;
 
   ParserParameters _inParamList;
   ParserParameter  _inParam;
-
+  
   ParserParameters _outParamList;
   ParserParameter  _outParam;
-
+  
   ParserDataStreamParameters _inDataStreamParamList;
   ParserDataStreamParameter  _inDataStreamParam;
-
+  
   ParserDataStreamParameters _outDataStreamParamList;
   ParserDataStreamParameter  _outDataStreamParam;
 
-  std::stack<QString> _xml_pile;
 };
 
 #endif // SALOME_CATALOG_HANDLER_H
index 55dd3cede27404ae93484710edf10e50600db357..b4d7edbd1486e7eeb4d28de3adb657c84dcff0b0 100644 (file)
@@ -31,8 +31,6 @@
 #include <fstream>
 #include <map>
 
-#include <qstringlist.h>
-#include <qfileinfo.h>
 using namespace std;
 
 #include "utilities.h"
@@ -46,6 +44,26 @@ static int MYDEBUG = 1;
 static const char* SEPARATOR     = "::";
 static const char* OLD_SEPARATOR = ":";
 
+
+list<string>& splitStringToList(string theString, string theSeparator)
+{
+  list<string> aList;
+
+  int sepLen = theSeparator.length();
+  
+  int startPos = 0, sepPos = theString.find(theSeparator, startPos);
+
+  for ( ; (startPos < theString.size()) && (sepPos != string::npos); sepPos = theString.find(theSeparator, startPos))
+    {
+      string anItem = theString.substr(startPos, sepPos - startPos);
+      if (anItem.length() > 0)
+       aList.push_back(anItem);
+      startPos = sepPos + sepLen;
+    }
+
+  return aList;
+}
+
 //----------------------------------------------------------------------
 // Function : SALOME_ModuleCatalogImpl
 // Purpose  : Constructor 
@@ -111,31 +129,35 @@ SALOME_ModuleCatalogImpl::SALOME_ModuleCatalogImpl(int argc, char** argv, CORBA:
     // Affect the _general_module_list and _general_path_list members
     // with the common catalog
     
-    QStringList dirList;
+    list<string> dirList;
+
 #ifdef WNT
-    dirList = QStringList::split( SEPARATOR, _general_path, 
-                                 false ); // skip empty entries
+    dirList = splitStringToList(_general_path, SEPARATOR);
 #else
     //check for new format
-    int isNew = QString( _general_path ).contains(SEPARATOR);
-    if ( isNew > 0 ) {
+    bool isNew = (std::string( _general_path ).find(SEPARATOR) != string::npos);
+    if ( isNew ) {
       //using new format
-      dirList = QStringList::split( SEPARATOR, _general_path, 
-                                   false ); // skip empty entries
+      dirList = splitStringToList(_general_path, SEPARATOR);
     } else {
       //support old format
-      dirList = QStringList::split( OLD_SEPARATOR, _general_path, 
-                                   false ); // skip empty entries
+      dirList =splitStringToList(_general_path, OLD_SEPARATOR);
     }   
 #endif
     
-    for ( int i = 0; i < dirList.count(); i++ ) {
-      //QFileInfo fileInfo( dirList[ i ] );
-      QFileInfo fileInfo( dirList[ i ].replace( '\"', "" ) ); //remove inverted commas from filename
-      if ( fileInfo.isFile() && fileInfo.exists() ) {
-       _parse_xml_file(fileInfo.filePath(), 
+    for(list<string>::iterator iter=dirList.begin();iter!=dirList.end();iter++){
+      string aPath = (*iter);
+      //remove inverted commas from filename
+      while(aPath.find('\"') != string::npos)
+       aPath.erase(aPath.find('\"'), 1);
+
+      FILE* aFile = fopen(aPath.c_str(), "r");
+      if (aFile != NULL) {
+       _parse_xml_file(aPath.c_str(), 
                        _general_module_list, 
                        _general_path_list);
+       
+       fclose(aFile);
       }
     }
     
@@ -575,16 +597,26 @@ SALOME_ModuleCatalogImpl::_parse_xml_file(const char* file,
   if(MYDEBUG) SCRUTE(file);
 
   SALOME_ModuleCatalog_Handler* handler = new SALOME_ModuleCatalog_Handler();
-  QFile xmlFile(file);
-
-  QXmlInputSource source(xmlFile);
 
-  QXmlSimpleReader reader;
-  reader.setContentHandler( handler );
-  reader.setErrorHandler( handler );
-  reader.parse( source );
-  xmlFile.close();
+  FILE* aFile = fopen(file, "r");
 
+  if (aFile != NULL)
+    {
+      xmlDocPtr aDoc = xmlReadFile(file, NULL, 0);
+      if (aDoc != NULL)
+       handler->ProcessXmlDocument(aDoc);
+      else
+       INFOS("ModuleCatalog: could not parse file "<<file);
+
+      xmlFreeDoc(aDoc);
+      xmlCleanupParser();
+      fclose(aFile);
+    }
+  else
+    INFOS("ModuleCatalog: file "<<file<<" is not readable.");
+  
+  delete handler;
+  
   unsigned int i, j;
 
   for ( i = 0; i < _moduleList.size(); i++) {
index eaa49f92aa9dbee23936d53124c44633fdfb8dbe..febe9a7a046506263ae7cc960d1f3729f810843c 100755 (executable)
@@ -54,6 +54,7 @@ COMMON_CPPFLAGS=\
        -I$(srcdir)/../Utils \
        -I$(top_builddir)/salome_adm/unix \
        -I$(top_builddir)/idl \
+       -I/usr/include/libxml2
        @CORBA_CXXFLAGS@ @CORBA_INCLUDES@
 
 # This local variable defines the list of dependant libraries common to all target in this package.
@@ -75,10 +76,9 @@ libSalomeResourcesManager_la_SOURCES =\
        SALOME_ResourcesManager.cxx
 
 libSalomeResourcesManager_la_CPPFLAGS =\
-       $(COMMON_CPPFLAGS) \
-       @QT_MT_INCLUDES@
+       $(COMMON_CPPFLAGS)
+
 
 libSalomeResourcesManager_la_LDFLAGS = -no-undefined -version-info=0:0:0
 libSalomeResourcesManager_la_LIBADD  =\
-       $(COMMON_LIBS) \
-       @QT_MT_LIBS@
+       $(COMMON_LIBS)
index 53162f87c22eac4529f5514222d9e8aae0c1d102..a42b4369f828d1a9d61498329aa5af87c55c507d 100755 (executable)
 #include "SALOME_ResourcesCatalog_Handler.hxx"
 #include <iostream>
 #include <map>
-#include <qdom.h>
 #include "utilities.h"
 
 using namespace std;
 
+#ifdef _DEBUG_
+static int MYDEBUG = 1;
+#else
+static int MYDEBUG = 0;
+#endif
+
 //=============================================================================
 /*!
  *  Constructor
@@ -86,331 +91,219 @@ SALOME_ResourcesCatalog_Handler::~SALOME_ResourcesCatalog_Handler()
 
 const MapOfParserResourcesType&
 SALOME_ResourcesCatalog_Handler::GetResourcesAfterParsing() const
-  {
-    return _resources_list;
-  }
-
-//=============================================================================
-/*!
- *  Overload handler function startDocument.
- *  Called before an xml file is parsed.
- *  Clears the list of resources.
- *  \return true (if no error detected...)
- */ 
-//=============================================================================
-
-bool SALOME_ResourcesCatalog_Handler::startDocument()
 {
-  //  MESSAGE("Begin parse document");
-
-  // --- Empty private elements
-
-  _resources_list.clear();
-  return true;
+  return _resources_list;
 }
 
 //=============================================================================
 /*!
- *  Overload handler function startElement.
- *    \param QString argument by reference (not used here ?)
- *    \param QString argument by reference (not used here ?)
- *    \param name                          (not used here ?)
- *    \param atts
- *    \return true if no error was detected
+ *  Processes XML document and fills the list of resources
  */ 
 //=============================================================================
 
-bool
-SALOME_ResourcesCatalog_Handler::
-startElement( const QString&,
-              const QString&,
-              const QString& name,
-              const QXmlAttributes& attrs )
+void SALOME_ResourcesCatalog_Handler::ProcessXmlDocument(xmlDocPtr theDoc)
 {
-  for (int i = 0;i < attrs.count();i++)
-    {
-      QString qName(attrs.localName(i));
-      std::string content(attrs.value(i).latin1());
+  if (MYDEBUG) MESSAGE("Begin parse document");
 
-      if ((qName.compare(QString(test_hostname)) == 0))
-        _resource.DataForSort._hostName = content;
-
-      if ((qName.compare(QString(test_alias)) == 0))
-        _resource.Alias = content;
-
-      if ((qName.compare(QString(test_protocol)) == 0))
-        {
-          switch (content[0])
-            {
-
-            case 'r':
-              _resource.Protocol = rsh;
-              break;
+  // Empty private elements
+  _resources_list.clear();
 
-            case 's':
-              _resource.Protocol = ssh;
-              break;
+  // Get the document root node
+  xmlNodePtr aCurNode = xmlDocGetRootElement(theDoc);
 
-            default:
-              // If it'not in all theses cases, the protocol is affected to rsh
-              _resource.Protocol = rsh;
-              break;
-            }
-        }
-
-      if ((qName.compare(QString(test_mode)) == 0))
-        {
-          switch (content[0])
+  aCurNode = aCurNode->xmlChildrenNode;
+  
+  // Processing the document nodes
+  while(aCurNode != NULL)
+    {
+      if ( !xmlStrcmp(aCurNode->name,(const xmlChar*)test_machine) )
+       {
+         if (xmlHasProp(aCurNode, (const xmlChar*)test_hostname))
+           _resource.DataForSort._hostName = (const char*)xmlGetProp(aCurNode, (const xmlChar*)test_hostname);
+         else
+           break;
+
+         if (xmlHasProp(aCurNode, (const xmlChar*)test_alias))
+           _resource.Alias = (const char*)xmlGetProp(aCurNode, (const xmlChar*)test_alias);
+         else
+           _resource.Alias = "";
+
+         switch ( ((const char*)xmlGetProp(aCurNode, (const xmlChar*)test_protocol))[0] )
+           {
+           case 'r':
+             _resource.Protocol = rsh;
+             break;
+           case 's':
+             _resource.Protocol = ssh;
+             break;
+           default:
+             // If it'not in all theses cases, the protocol is affected to rsh
+             _resource.Protocol = rsh;
+             break;
+           }
+         
+         switch ( ((const char*)xmlGetProp(aCurNode, (const xmlChar*)test_mode))[0] )
             {
-
             case 'i':
               _resource.Mode = interactive;
               break;
-
-            case 'b':
+           case 'b':
               _resource.Mode = batch;
               break;
-
             default:
               // If it'not in all theses cases, the mode is affected to interactive
               _resource.Mode = interactive;
               break;
             }
-        }
-
-      if ((qName.compare(QString(test_user_name)) == 0))
-        _resource.UserName = content;
-
-      if ((qName.compare(QString(test_appli_path)) == 0))
-        _resource.AppliPath = content;
-
-      if ((qName.compare(QString(test_module_name)) == 0))
-        previous_module_name = content;
-
-      if ((qName.compare(QString(test_module_path)) == 0))
-        previous_module_path = content;
 
-      if ((qName.compare(QString(test_pre_req_file_path)) == 0))
-        _resource.PreReqFilePath = content;
-
-      if ((qName.compare(QString(test_os)) == 0))
-        _resource.OS = content;
-
-      if ((qName.compare(QString(test_mem_in_mb)) == 0))
-        _resource.DataForSort._memInMB = atoi(content.c_str());
-
-      if ((qName.compare(QString(test_cpu_freq_mhz)) == 0))
-        _resource.DataForSort._CPUFreqMHz = atoi(content.c_str());
-
-      if ((qName.compare(QString(test_nb_of_nodes)) == 0))
-        _resource.DataForSort._nbOfNodes = atoi(content.c_str());
-
-      if ((qName.compare(QString(test_nb_of_proc_per_node)) == 0))
-        _resource.DataForSort._nbOfProcPerNode = atoi(content.c_str());
+         if (xmlHasProp(aCurNode, (const xmlChar*)test_user_name))
+           _resource.UserName = (const char*)xmlGetProp(aCurNode, (const xmlChar*)test_user_name);
+         
+         if (xmlHasProp(aCurNode, (const xmlChar*)test_appli_path))
+           _resource.AppliPath = (const char*)xmlGetProp(aCurNode, (const xmlChar*)test_appli_path);
+         
+         if (xmlHasProp(aCurNode, (const xmlChar*)test_pre_req_file_path))
+           _resource.PreReqFilePath = (const char*)xmlGetProp(aCurNode, (const xmlChar*)test_pre_req_file_path);
+         
+         if (xmlHasProp(aCurNode, (const xmlChar*)test_os))
+           _resource.OS = (const char*)xmlGetProp(aCurNode, (const xmlChar*)test_os);
+         
+         if (xmlHasProp(aCurNode, (const xmlChar*)test_mem_in_mb))
+           _resource.DataForSort._memInMB = atoi((const char*)xmlGetProp(aCurNode, (const xmlChar*)test_mem_in_mb));
+         
+         if (xmlHasProp(aCurNode, (const xmlChar*)test_cpu_freq_mhz))
+           _resource.DataForSort._CPUFreqMHz = atoi((const char*)xmlGetProp(aCurNode, (const xmlChar*)test_cpu_freq_mhz));
+         
+         if (xmlHasProp(aCurNode, (const xmlChar*)test_nb_of_nodes))
+           _resource.DataForSort._nbOfNodes = atoi((const char*)xmlGetProp(aCurNode, (const xmlChar*)test_nb_of_nodes));
+         
+         if (xmlHasProp(aCurNode, (const xmlChar*)test_nb_of_proc_per_node))
+           _resource.DataForSort._nbOfProcPerNode = atoi((const char*)xmlGetProp(aCurNode, (const xmlChar*)test_nb_of_proc_per_node));
+         
+         // Process modules
+         xmlNodePtr aCurSubNode = aCurNode->xmlChildrenNode;
+         while(aCurSubNode != NULL)
+           {
+             if ( !xmlStrcmp(aCurSubNode->name, (const xmlChar*)test_modules) )
+               {
+                 if (xmlHasProp(aCurSubNode, (const xmlChar*)test_module_name) && 
+                     xmlHasProp(aCurSubNode, (const xmlChar*)test_module_path)) 
+                   {
+                     std::string aModuleName = (const char*)xmlGetProp(aCurSubNode, (const xmlChar*)test_module_name);
+                     std::string aModulePath = (const char*)xmlGetProp(aCurSubNode, (const xmlChar*)test_module_path);
+                     _resource.ModulesPath[aModuleName] = aModulePath;
+                   }
+               }
+             aCurSubNode = aCurSubNode->next;
+           }
+         
+         int aNbNodes = _resource.DataForSort._nbOfNodes;
+         if( aNbNodes > 1 ){
+           string clusterNode = _resource.DataForSort._hostName ;
+           for( int i=0; i < aNbNodes; i++ ){
+             char inode[64];
+             inode[0] = '\0' ;
+             sprintf(inode,"%s%d",clusterNode.c_str(),i+1);
+             std::string nodeName(inode);
+             _resource.DataForSort._hostName = nodeName ;
+             _resources_list[nodeName] = _resource;
+           }
+         }
+         else
+           _resources_list[_resource.DataForSort._hostName] = _resource;
+       }
+      
+      aCurNode = aCurNode->next;
     }
 
-  return true;
-}
-
-//=============================================================================
-/*!
- *  Overload handler function endElement.
- *     \param QString argument by reference  (not used here ?)
- *     \param QString argument by reference  (not used here ?)
- *     \param qName 
- *     \return true (if no error detected ...)
- */ 
-//=============================================================================
-
-bool SALOME_ResourcesCatalog_Handler::
-endElement(const QString&,
-           const QString&,
-           const QString& qName)
-{
-  if ((qName.compare(QString(test_modules)) == 0))
-    _resource.ModulesPath[previous_module_name] = previous_module_path;
-
-  if ((qName.compare(QString(test_machine)) == 0)){
-    int nbnodes = _resource.DataForSort._nbOfNodes;
-    if( nbnodes > 1 ){
-      string clusterNode = _resource.DataForSort._hostName ;
-      for(int i=0;i<nbnodes;i++){
-        char inode[64];
-        inode[0] = '\0' ;
-        sprintf(inode,"%s%d",clusterNode.c_str(),i+1);
-        std::string nodeName(inode);
-//        _resource.DataForSort._nbOfNodes = 1;
-        _resource.DataForSort._hostName = nodeName ;
-        _resources_list[nodeName] = _resource;
-        //cout << "SALOME_ResourcesCatalog_Handler::endElement _resources_list["
-        //     << nodeName << "] = _resource " << _resource.DataForSort._hostName.c_str()
-        //     << endl ;
-      }
+  // For debug only
+  if (MYDEBUG)
+    {
+      for (map<string, ParserResourcesType>::const_iterator iter =
+            _resources_list.begin();
+          iter != _resources_list.end();
+          iter++)
+       {
+         SCRUTE((*iter).second.Alias);
+         SCRUTE((*iter).second.UserName);
+         SCRUTE((*iter).second.AppliPath);
+         SCRUTE((*iter).second.PreReqFilePath);
+         SCRUTE((*iter).second.OS);
+         SCRUTE((*iter).second.Protocol);
+         SCRUTE((*iter).second.Mode);
+       }
+      
+      MESSAGE("This is the end of document");
     }
-    else
-      _resources_list[_resource.DataForSort._hostName] = _resource;
-  }
-
-  return true;
-}
-
-//=============================================================================
-/*!
- *  Overload handler function characters.
- *  fills the private attribute string 'content'.
- *     \param chars  
- *     \return true (if no error detected ...)
- */ 
-//=============================================================================
-
-bool SALOME_ResourcesCatalog_Handler::characters(const QString& chars)
-{
-  content = (const char *)chars ;
-  return true;
-}
-
-//=============================================================================
-/*!
- *  Overload handler function endDocument.
- *  Called after the document has been parsed.
- *     \return true (if no error detected ...)
- */ 
-//=============================================================================
-
-bool SALOME_ResourcesCatalog_Handler::endDocument()
-{
-//   for (map<string, ParserResourcesType>::const_iterator iter =
-//          _resources_list.begin();
-//        iter != _resources_list.end();
-//        iter++)
-//     {
-//       SCRUTE((*iter).second.Alias);
-//       SCRUTE((*iter).second.UserName);
-//       SCRUTE((*iter).second.AppliPath);
-//       SCRUTE((*iter).second.PreReqFilePath);
-//       SCRUTE((*iter).second.OS);
-//       SCRUTE((*iter).second.Protocol);
-//       SCRUTE((*iter).second.Mode);
-//    }
-  
-//  MESSAGE("This is the end of document");
-  return true;
-}
-
-//=============================================================================
-/*!
- *  Overload handler function errorProtocol.
- *  \return the error message.
- */ 
-//=============================================================================
-
-QString SALOME_ResourcesCatalog_Handler::errorProtocol()
-{
-  INFOS(" ------------- error protocol !");
-  return errorProt;
 }
 
-//=============================================================================
-/*!
- *  Overload handler function fatalError.
- *  Fills the private string errorProt with details on error.
- *     \param exception from parser
- *     \return boolean (meaning ?)
- */
-//=============================================================================
-
-bool
-SALOME_ResourcesCatalog_Handler::fatalError
-(const QXmlParseException& exception)
-{
-  INFOS(" ------------- fatal error !");
-  errorProt += QString( "fatal parsing error: %1 in line %2, column %3\n" )
-               .arg( exception.message() )
-               .arg( exception.lineNumber() )
-               .arg( exception.columnNumber() );
-  INFOS("parser error: " << errorProt.latin1());
-
-  return QXmlDefaultHandler::fatalError( exception );
-}
 
 //=============================================================================
 /*!
  *  Fill the document tree in xml file, used to write in an xml file.
- *  \param doc document to fill.
+ *  \param theDoc document to fill.
  */ 
 //=============================================================================
 
-void SALOME_ResourcesCatalog_Handler::PrepareDocToXmlFile(QDomDocument& doc)
+void SALOME_ResourcesCatalog_Handler::PrepareDocToXmlFile(xmlDocPtr theDoc)
 {
-  QDomElement root = doc.createElement("resources");
-  doc.appendChild(root);
+  // Node pointers
+  xmlNodePtr root_node = NULL, node = NULL, node1 = NULL;
+  char string_buf[80];
 
+  root_node = xmlNewNode(NULL, BAD_CAST "resources");
+  xmlDocSetRootElement(theDoc, root_node);
+    
   for (map<string, ParserResourcesType>::iterator iter =
          _resources_list.begin();
        iter != _resources_list.end();
        iter++)
     {
-      QDomElement eltRoot = doc.createElement(test_machine);
-      root.appendChild( eltRoot );
-      eltRoot.setAttribute((char *)test_hostname, (*iter).first.c_str());
-      eltRoot.setAttribute((char *)test_alias, (*iter).second.Alias.c_str());
-
+      node = xmlNewChild(root_node, NULL, BAD_CAST test_machine, NULL);
+      xmlNewProp(node, BAD_CAST test_hostname, BAD_CAST (*iter).first.c_str());
+      xmlNewProp(node, BAD_CAST test_alias, BAD_CAST (*iter).second.Alias.c_str());
+      
       switch ((*iter).second.Protocol)
         {
-
         case rsh:
-          eltRoot.setAttribute((char *)test_protocol, "rsh");
+         xmlNewProp(node, BAD_CAST test_protocol, BAD_CAST "rsh");
           break;
-
         case ssh:
-          eltRoot.setAttribute((char *)test_protocol, "ssh");
-          break;
-
+         xmlNewProp(node, BAD_CAST test_protocol, BAD_CAST "ssh");
+         break;
         default:
-          eltRoot.setAttribute((char *)test_protocol, "rsh");
-        }
+         xmlNewProp(node, BAD_CAST test_protocol, BAD_CAST "rsh");
+       }
 
       switch ((*iter).second.Mode)
         {
-
-        case interactive:
-          eltRoot.setAttribute((char *)test_mode, "interactive");
+       case interactive:
+         xmlNewProp(node, BAD_CAST test_mode, BAD_CAST "interactive");
           break;
-
         case batch:
-          eltRoot.setAttribute((char *)test_mode, "batch");
+         xmlNewProp(node, BAD_CAST test_mode, BAD_CAST "batch");
           break;
-
         default:
-          eltRoot.setAttribute((char *)test_mode, "interactive");
+         xmlNewProp(node, BAD_CAST test_mode, BAD_CAST "interactive");
         }
 
-      eltRoot.setAttribute((char *)test_user_name,
-                           (*iter).second.UserName.c_str());
+      xmlNewProp(node, BAD_CAST test_user_name, BAD_CAST (*iter).second.UserName.c_str());
 
       for (map<string, string>::const_iterator iter2 =
              (*iter).second.ModulesPath.begin();
            iter2 != (*iter).second.ModulesPath.end();
            iter2++)
         {
-          QDomElement rootForModulesPaths = doc.createElement(test_modules);
-          rootForModulesPaths.setAttribute(test_module_name,
-                                           (*iter2).first.c_str());
-          rootForModulesPaths.setAttribute(test_module_path,
-                                           (*iter2).second.c_str());
-          eltRoot.appendChild(rootForModulesPaths);
+         node1 = xmlNewChild(node, NULL, BAD_CAST test_modules, NULL);
+         xmlNewProp(node1, BAD_CAST test_module_name, BAD_CAST (*iter2).first.c_str());
+         xmlNewProp(node1, BAD_CAST test_module_path, BAD_CAST (*iter2).second.c_str());
         }
 
-      eltRoot.setAttribute(test_pre_req_file_path,
-                           (*iter).second.PreReqFilePath.c_str());
-      eltRoot.setAttribute(test_os, (*iter).second.OS.c_str());
-      eltRoot.setAttribute(test_mem_in_mb,
-                           (*iter).second.DataForSort._memInMB);
-      eltRoot.setAttribute(test_cpu_freq_mhz,
-                           (*iter).second.DataForSort._CPUFreqMHz);
-      eltRoot.setAttribute(test_nb_of_nodes,
-                           (*iter).second.DataForSort._nbOfNodes);
-      eltRoot.setAttribute(test_nb_of_proc_per_node,
-                           (*iter).second.DataForSort._nbOfProcPerNode);
+      xmlNewProp(node, BAD_CAST test_pre_req_file_path, BAD_CAST (*iter).second.PreReqFilePath.c_str());
+      xmlNewProp(node, BAD_CAST test_os, BAD_CAST (*iter).second.OS.c_str());
+      xmlNewProp(node, BAD_CAST test_mem_in_mb, BAD_CAST sprintf(string_buf, "%u", (*iter).second.DataForSort._memInMB));
+      xmlNewProp(node, BAD_CAST test_cpu_freq_mhz, BAD_CAST sprintf(string_buf, "%u", (*iter).second.DataForSort._CPUFreqMHz));
+      xmlNewProp(node, BAD_CAST test_nb_of_nodes, BAD_CAST sprintf(string_buf, "%u", (*iter).second.DataForSort._nbOfNodes));
+      xmlNewProp(node, BAD_CAST test_nb_of_proc_per_node, BAD_CAST sprintf(string_buf, "%u", (*iter).second.DataForSort._nbOfProcPerNode));
     }
 }
index 497f0dddf8beada9608a5b576818f3535f946edb..560659ece7db0239e801450c08d265c0cfd506ad 100755 (executable)
 
 #include "SALOME_ResourcesCatalog_Parser.hxx"
 
-#include <qxml.h>
 #include <string>
 #include <vector>
 
-class QDomElement;
-
-class QDomDocument;
-
-class SALOME_ResourcesCatalog_Handler : public QXmlDefaultHandler
-  {
+#include <libxml/parser.h>
 
+class SALOME_ResourcesCatalog_Handler
+{
+  
   public :
     SALOME_ResourcesCatalog_Handler(MapOfParserResourcesType& listOfResources);
 
@@ -49,27 +46,11 @@ class SALOME_ResourcesCatalog_Handler : public QXmlDefaultHandler
 
     virtual ~SALOME_ResourcesCatalog_Handler();
 
-    virtual bool startDocument();
-
-    virtual bool startElement(const QString& , const QString& ,
-                              const QString& name, 
-                             const QXmlAttributes& attrs);
-
-    virtual bool endElement(const QString&, const QString&,
-                            const QString& qName);
-
-    virtual bool characters(const QString& chars);
-
-    virtual bool endDocument();
-
-   virtual QString errorProtocol();
-    virtual bool fatalError(const QXmlParseException& exception);
-
-    void PrepareDocToXmlFile(QDomDocument& doc);
+    void ProcessXmlDocument(xmlDocPtr theDoc);
+  
+    void PrepareDocToXmlFile(xmlDocPtr theDoc);
 
   private :
-    QString errorProt;
-    std::string content;
     std::string previous_module_name;
     std::string previous_module_path;
 
index 01bf2756b3e7471c1f7dc729dcec0150d440843d..4c002f91b6fb93cdbf1e89aacbe67258d8ff9071 100644 (file)
@@ -22,8 +22,6 @@
 #include "Utils_ExceptHandlers.hxx"
 #include "OpUtil.hxx"
 
-#include <qdom.h>
-
 #include <stdlib.h>
 #ifndef WNT
 #include <unistd.h>
@@ -282,23 +280,37 @@ void SALOME_ResourcesManager::DeleteResourceInCatalog(const char *hostname)
 
 void SALOME_ResourcesManager::WriteInXmlFile()
 {
-  QDomDocument doc("ResourcesCatalog");
+  const char* aFilePath = _path_resources.c_str();
+  
+  FILE* aFile = fopen(aFilePath, "w");
+
+  if (aFile == NULL)
+    {
+      INFOS("Error opening file !");
+      return;
+    }
+  
+  xmlDocPtr aDoc = xmlNewDoc(BAD_CAST "1.0");
+  xmlNewDocComment(aDoc, BAD_CAST "ResourcesCatalog");
+
   SALOME_ResourcesCatalog_Handler* handler =
     new SALOME_ResourcesCatalog_Handler(_resourcesList);
-  handler->PrepareDocToXmlFile(doc);
+  handler->PrepareDocToXmlFile(aDoc);
   delete handler;
 
-  QFile file( _path_resources );
-
-  if ( !file.open( IO_WriteOnly ) )
-    INFOS("WRITING ERROR !");
-
-  QTextStream ts( &file );
-
-  ts << doc.toString();
-
-  file.close();
-
+  int isOk = xmlSaveFile(aFilePath, aDoc);
+  
+  if (!isOk)
+    INFOS("Error while XML file saving.");
+  
+  // Free the document
+  xmlFreeDoc(aDoc);
+
+  // Free the global variables that may have been allocated by the parser
+  xmlCleanupParser();
+  
+  fclose(aFile);
+  
   MESSAGE("WRITING DONE!");
 }
 
@@ -312,16 +324,31 @@ const MapOfParserResourcesType& SALOME_ResourcesManager::ParseXmlFile()
 {
   SALOME_ResourcesCatalog_Handler* handler =
     new SALOME_ResourcesCatalog_Handler(_resourcesList);
-  QFile xmlFile(_path_resources);
 
-  QXmlInputSource source(xmlFile);
-
-  QXmlSimpleReader reader;
-  reader.setContentHandler( handler );
-  reader.setErrorHandler( handler );
-  reader.parse( source );
-  xmlFile.close();
+  const char* aFilePath = _path_resources.c_str();
+  FILE* aFile = fopen(aFilePath, "r");
+  
+  if (aFile != NULL)
+    {
+      xmlDocPtr aDoc = xmlReadFile(aFilePath, NULL, 0);
+      
+      if (aDoc != NULL)
+       handler->ProcessXmlDocument(aDoc);
+      else
+       INFOS("ResourcesManager: could not parse file "<<aFilePath);
+      
+      // Free the document
+      xmlFreeDoc(aDoc);
+
+      // Free the global variables that may have been allocated by the parser
+      xmlCleanupParser();
+      fclose(aFile);
+    }
+  else
+    INFOS("ResourcesManager: file "<<aFilePath<<" is not readable.");
+  
   delete handler;
+
   return _resourcesList;
 }
 
index 42cc984cd86ea30d4c67a0d852bff0c399467d76..d9ca64434cd31f0a88d0dccf386fd74108e20927 100644 (file)
@@ -118,7 +118,7 @@ class RESOURCESMANAGER_EXPORT SALOME_ResourcesManager
 
 
     //! will contain the path to the ressources catalog
-    QString _path_resources;
+    std::string _path_resources;
 
     //! attribute that contains current tmp files generated
     std::string _TmpFileName;