Salome HOME
Removed expat support (replaced by libxml2) V7_5_0a1
authorimn <imn@opencascade.com>
Wed, 8 Oct 2014 10:47:40 +0000 (14:47 +0400)
committervsr <vsr@opencascade.com>
Mon, 13 Oct 2014 05:45:09 +0000 (09:45 +0400)
34 files changed:
CMakeLists.txt
SalomeYACSConfig.cmake.in
adm/cmake/CMakeLists.txt
adm/cmake/FindExpat.cmake [deleted file]
adm/cmake/FindSalomeExpat.cmake [deleted file]
adm/unix/config_files/CMakeLists.txt
adm/unix/config_files/check_expat.m4 [deleted file]
doc/ref/yacs.dox
src/genericgui/CMakeLists.txt
src/hmi/CMakeLists.txt
src/yacsloader/CMakeLists.txt
src/yacsloader/Test/CMakeLists.txt
src/yacsloader/blocParsers.hxx
src/yacsloader/codeParsers.hxx
src/yacsloader/componentinstanceParsers.cxx
src/yacsloader/containerParsers.cxx
src/yacsloader/inlineParsers.hxx
src/yacsloader/linkParsers.hxx
src/yacsloader/loopParsers.hxx
src/yacsloader/nodeParsers.hxx
src/yacsloader/outputParsers.hxx
src/yacsloader/parserBase.cxx
src/yacsloader/parserBase.hxx
src/yacsloader/parsers.cxx
src/yacsloader/pmml/CMakeLists.txt
src/yacsloader/portParsers.hxx
src/yacsloader/presetParsers.hxx
src/yacsloader/procParsers.hxx
src/yacsloader/propertyParsers.cxx
src/yacsloader/switchParsers.hxx
src/yacsloader/typeParsers.cxx
src/yacsloader/xmlParserBase.cxx
src/yacsloader/xmlParserBase.hxx
src/yacsloader_swig/CMakeLists.txt

index 1327b21afda3a69d8aa6d42efa7572e77ff5e4ea..74bbc9a3d79072e31f002bfa3c7ac43e099ec23c 100644 (file)
@@ -172,8 +172,6 @@ ENDIF(SALOME_YACS_USE_QSCINTILLA)
 ## YACS specifics
 ##
 
-FIND_PACKAGE(SalomeExpat REQUIRED)
-
 # Detection summary:
 SALOME_PACKAGE_REPORT_AND_CHECK()
 
@@ -314,19 +312,18 @@ EXPORT(TARGETS ${_${PROJECT_NAME}_exposed_targets}
 SET(KERNEL_ROOT_DIR "${KERNEL_ROOT_DIR}")
 SET(GUI_ROOT_DIR "${GUI_ROOT_DIR}")
 SET(QT4_ROOT_DIR "${QT4_ROOT_DIR}")
-SET(EXPAT_ROOT_DIR "${EXPAT_ROOT_DIR}")
 SET(QSCINTILLA_ROOT_DIR "${QSCINTILLA_ROOT_DIR}")
  
 SET(CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/include" "${PROJECT_BINARY_DIR}/include")
 
 # Build variables that will be expanded when configuring Salome<MODULE>Config.cmake:
-SALOME_CONFIGURE_PREPARE(Expat QScintilla Qt4)
+SALOME_CONFIGURE_PREPARE(QScintilla Qt4)
 
 CONFIGURE_PACKAGE_CONFIG_FILE(${PROJECT_NAME}Config.cmake.in 
     ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
     INSTALL_DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}"
     PATH_VARS CONF_INCLUDE_DIRS SALOME_INSTALL_CMAKE_LOCAL CMAKE_INSTALL_PREFIX
-    KERNEL_ROOT_DIR GUI_ROOT_DIR QT4_ROOT_DIR EXPAT_ROOT_DIR QSCINTILLA_ROOT_DIR)
+    KERNEL_ROOT_DIR GUI_ROOT_DIR QT4_ROOT_DIR QSCINTILLA_ROOT_DIR)
 
 #   - in the install tree (VSR 16/08/2013: TEMPORARILY COMMENT THIS - TO REMOVE?):
 #       Get the relative path of the include directory so 
@@ -336,7 +333,7 @@ CONFIGURE_PACKAGE_CONFIG_FILE(${PROJECT_NAME}Config.cmake.in
 #    ${PROJECT_BINARY_DIR}/to_install/${PROJECT_NAME}Config.cmake
 #    INSTALL_DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}"
 #    PATH_VARS CONF_INCLUDE_DIRS SALOME_INSTALL_CMAKE_LOCAL CMAKE_INSTALL_PREFIX 
-#    KERNEL_ROOT_DIR GUI_ROOT_DIR QT4_ROOT_DIR EXPAT_ROOT_DIR QSCINTILLA_ROOT_DIR)
+#    KERNEL_ROOT_DIR GUI_ROOT_DIR QT4_ROOT_DIR QSCINTILLA_ROOT_DIR)
 
 WRITE_BASIC_PACKAGE_VERSION_FILE(${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
     VERSION ${${PROJECT_NAME_UC}_VERSION}
index 0ecc26f3f5f0b42b92bdc62fdf5a142bc8c8f353..ba855f03610a224244e809321381e9734f736c48 100644 (file)
@@ -58,9 +58,6 @@ SET(SALOME_YACS_USE_DSC        @SALOME_YACS_USE_DSC@)
 SET(SALOME_YACS_USE_QSCINTILLA @SALOME_YACS_USE_QSCINTILLA@)
 SET(SALOME_YACS_USE_SWIG       @SALOME_YACS_USE_SWIG@)
 
-# Level 1 prerequisites:
-SET_AND_CHECK(EXPAT_ROOT_DIR_EXP "@PACKAGE_EXPAT_ROOT_DIR@")
-
 # Optional level 1 prerequisites:
 IF(SALOME_YACS_USE_KERNEL)
   SET_AND_CHECK(KERNEL_ROOT_DIR_EXP "@PACKAGE_KERNEL_ROOT_DIR@")
index e278368ecf3344a963cf7b32fba8587701646ddd..0c714b453b43c26b0bbc0b623a8d729685ab1605 100644 (file)
@@ -23,8 +23,6 @@
 
 # These files are data, module or lib files
 SET(_adm_data
-  FindExpat.cmake
-  FindSalomeExpat.cmake
   FindQScintilla.cmake
   FindSalomeQScintilla.cmake
   FindSphinx.cmake
diff --git a/adm/cmake/FindExpat.cmake b/adm/cmake/FindExpat.cmake
deleted file mode 100644 (file)
index 42e8b24..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-# Copyright (C) 2006-2014  CEA/DEN, EDF R&D
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-#
-# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
-
-FIND_LIBRARY(EXPAT_LIBRARIES NAMES expat libexpat)
-
-FIND_PATH(EXPAT_INCLUDE_DIR expat.h)
-
-# Handle the standard arguments of the find_package() command:
-INCLUDE(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(Expat REQUIRED_VARS EXPAT_LIBRARIES EXPAT_INCLUDE_DIR)
diff --git a/adm/cmake/FindSalomeExpat.cmake b/adm/cmake/FindSalomeExpat.cmake
deleted file mode 100644 (file)
index 1ce58fd..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-# Copyright (C) 2013-2014  CEA/DEN, EDF R&D
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-#
-# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
-
-# Expat detection for Salome
-#
-#  !! Please read the generic detection procedure in SalomeMacros.cmake !!
-#
-SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(Expat EXPAT_ROOT_DIR 0)
-MARK_AS_ADVANCED(EXPAT_LIBRARIES EXPAT_INCLUDE_DIR)
-#IF(Expat_FOUND OR EXPAT_FOUND)
-#  MESSAGE(STATUS "EXPAT include dir is: ${EXPAT_INCLUDE_DIR}")
-#ENDIF()
-
-IF(Expat_FOUND OR EXPAT_FOUND)
-  SALOME_ACCUMULATE_HEADERS(EXPAT_INCLUDE_DIR)
-  SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH ${EXPAT_LIBRARIES})
-ENDIF()
index 2614ada15b3a9a5cfffaac04f54a81da6c71dc2f..35b892286c3528e3d8ae8fed8607e30261ee495a 100644 (file)
@@ -25,7 +25,6 @@ SET(_m4_data
   check_boost.m4
   check_cas.m4
   check_cppunit.m4
-  check_expat.m4
   check_htmlgen.m4
   check_libxml.m4
   check_omniorb.m4
diff --git a/adm/unix/config_files/check_expat.m4 b/adm/unix/config_files/check_expat.m4
deleted file mode 100644 (file)
index 81a435d..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-dnl Copyright (C) 2006-2014  CEA/DEN, EDF R&D
-dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License, or (at your option) any later version.
-dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl Lesser General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-dnl
-
-AC_DEFUN([AC_CHECK_EXPAT],[
-
-AC_CHECKING(for expat)
-
-CXXFLAGS_old=$CXXFLAGS
-CPPFLAGS_old=$CPPFLAGS
-
-# Custom location of expat package can be specified
-# through EXPAT_DIR variable
-EXPATDIR=
-if test "x$EXPAT_DIR" != "x"
-then
-  EXPATDIR=$EXPAT_DIR
-elif test "x$EXPAT_ROOT" != "x"
-then
-  EXPATDIR=$EXPAT_ROOT
-fi
-
-if test "x$EXPATDIR" != "x"
-then
-  if test "x$EXPATDIR" = "x/usr"
-  then
-    AC_MSG_NOTICE(Trying native Expat...)
-    TMPLIBS="-lexpat $LIBS"
-  else
-    AC_MSG_NOTICE(Trying Expat from $EXPATDIR ...)
-    TMPLIBS="-L$EXPATDIR/lib -lexpat $LIBS"
-    CXXFLAGS="$CXXFLAGS -I$EXPATDIR/include"
-    CPPFLAGS="$CPPFLAGS -I$EXPATDIR/include"
-    EXPAT_INCLUDES="-I$EXPATDIR/include"
-  fi
-else
-  AC_MSG_NOTICE(Trying native Expat...)
-  TMPLIBS="-lexpat $LIBS"
-fi
-
-AC_CHECK_HEADER(expat.h,expat_ok="yes",expat_ok="no")
-
-if  test "x$expat_ok" = "xyes"
-then
-  LIBS_old=$LIBS
-  LIBS=$TMPLIBS
-  AC_CHECK_LIB(expat,XML_ExpatVersionInfo,expat_ok="yes",expat_ok="no",)
-  LIBS=$LIBS_old
-fi
-
-if test "x$expat_ok" = "xyes"
-then
-  EXPAT_LIBS=$TMPLIBS
-fi
-
-AC_MSG_RESULT(for expat: $expat_ok)
-
-CXXFLAGS=$CXXFLAGS_old
-CPPFLAGS=$CPPFLAGS_old
-
-AC_SUBST(EXPAT_LIBS)
-AC_SUBST(EXPAT_INCLUDES)
-
-])dnl
-dnl
-
index 77608b68904f3aa2780aa9a6d8f7fe069d89f8a2..2c2d484357367707e021b40cd68a5f79bd07cb52 100644 (file)
@@ -45,7 +45,6 @@
  For building %YACS, you need some prerequisites
  - g++ 4.1 or more (mandatory)
  - libxml2 (mandatory)
- - expat (mandatory)
  - omniorb 4.1 or more (mandatory)
  - python 2.3 and + (mandatory)
  - swig 1.3.31 (mandatory)
index 71352e7f90b415b8284bad001c036f9028ac804c..c8398c02362f7762b0dd4b12e0ce2dcb4fa3d810 100644 (file)
@@ -22,7 +22,6 @@
 # additional include directories
 INCLUDE_DIRECTORIES(
   ${PYTHON_INCLUDE_DIR}
-  ${EXPAT_INCLUDE_DIR}
   ${OMNIORB_INCLUDE_DIR}
   ${LIBXML2_INCLUDE_DIR}
   ${GRAPHVIZ_INCLUDE_DIRS}
@@ -63,7 +62,6 @@ SET(_link_LIBRARIES
   SalomeWrap
   HMI
   SalomeResourcesManager
-  ${EXPAT_LIBRARIES}
   ${LIBXML2_LIBRARIES}
   ${GRAPHVIZ_LIBRARIES}
   )
index 2f6eb9952c7d5032c0e4c1c7e7f5b5a9b67072b7..38b7be0cff7fe9263e016fd435cf716d363f2326 100644 (file)
@@ -45,7 +45,6 @@ ADD_DEFINITIONS(
 
 # libraries to link to
 SET(_link_LIBRARIES
-  ${EXPAT_LIBRARIES}
   ${LIBXML2_LIBRARIES}
   YACSRuntimeSALOME
   YACSloader
index 43c1f2f68e52a9d0b1fc0409ad9991ef7922094d..b0e08f4c075e4fe1ded2a012c982b252ca5864af 100644 (file)
@@ -52,7 +52,6 @@ ENDIF(SALOME_YACS_USE_KERNEL)
 # additional include directories
 INCLUDE_DIRECTORIES(
   ${OMNIORB_INCLUDE_DIR}
-  ${EXPAT_INCLUDE_DIR}
   ${PYTHON_INCLUDE_DIR}
   ${PROJECT_SOURCE_DIR}/src/bases
   ${PROJECT_SOURCE_DIR}/src/engine
@@ -73,7 +72,7 @@ SET(_exec_DEFINITIONS
 # libraries to link to
 SET(YACSloader_LIBRARIES
   ${OMNIORB_LIBRARIES}
-  ${EXPAT_LIBRARIES}
+  ${LIBXML2_LIBRARIES}
   YACSlibEngine
   )
 SET(_link_LIBRARIES
index c53c72dde30766f0c8b3f89facba9a45a3c020c5..6e19f9d3623d79f0236475801ef039909973c8ea 100644 (file)
@@ -26,7 +26,6 @@ INCLUDE_DIRECTORIES(
   ${CPPUNIT_INCLUDE_DIRS}
   ${PYTHON_INCLUDE_DIR}
   ${OMNIORB_INCLUDE_DIR}
-  ${EXPAT_INCLUDE_DIR}
   ${KERNEL_INCLUDE_DIRS}
   ${CMAKE_CURRENT_SOURCE_DIR}/..
   ${CMAKE_CURRENT_SOURCE_DIR}/../../bases
index c1642f00a56ac9f871cbf371a542e484b7802429..fef6eacb2362569155af30531811f4c1625feda1 100644 (file)
@@ -87,6 +87,8 @@ struct bloctypeParser:parser
   virtual void onEnd(const char *el,parser* child);
   virtual void buildAttr(const XML_Char** attr)
     {
+      if (!attr)
+        return;
       this->required("name",attr);
       for (int i = 0; attr[i]; i += 2) 
         {
index aa3728c5f13c555169aed900a87974f8e02bd8b0..d635eda600f683866b3a1f329307a5201ecd2fb2 100644 (file)
@@ -75,6 +75,8 @@ struct functypeParser: codetypeParser
   static functypeParser funcParser;
   virtual void buildAttr(const XML_Char** attr)
     {
+      if (!attr)
+        return;
       required("name",attr);
       for (int i = 0; attr[i]; i += 2) 
       {
index e8b852c690cad96a4f04d6923d2eefe6702126a4..4f6e9455d9f05e0593da0f0cfb121f98a2af2576 100644 (file)
@@ -31,6 +31,8 @@ namespace YACS
 
   void componentinstancetypeParser::buildAttr(const XML_Char** attr)
     {
+      if (!attr)
+        return;
       required("name",attr);
       for (int i = 0; attr[i]; i += 2)
       {
index fab182bac7cf74ed73782a683b6e71f2ab7f6d2c..0c89b92165a71b961ea1656102a089eaba1a3439 100644 (file)
@@ -32,6 +32,8 @@ namespace YACS
 
   void machinetypeParser::buildAttr(const XML_Char** attr)
     {
+      if (!attr)
+        return;
       required("name",attr);
       for (int i = 0; attr[i]; i += 2)
       {
@@ -47,6 +49,8 @@ namespace YACS
 
   void containertypeParser::buildAttr(const XML_Char** attr)
     {
+      if (!attr)
+        return;
       required("name",attr);
       for (int i = 0; attr[i]; i += 2)
       {
@@ -101,6 +105,8 @@ namespace YACS
 
   void loadtypeParser::buildAttr(const XML_Char** attr)
     {
+      if (!attr)
+        return;
       required("container",attr);
       for (int i = 0; attr[i]; i += 2)
       {
index 0f6112e7e8dfa3ad17b19907bcfe32638fa5db1c..d3e76f4ef1b7025e441608d0d6fdfd97543e2929 100644 (file)
@@ -66,6 +66,8 @@ struct inlinetypeParser:public nodetypeParser<T>
     }
   virtual void buildAttr(const XML_Char** attr)
     {
+      if (!attr)
+        return;
       this->required("name",attr);
       for (int i = 0; attr[i]; i += 2) 
       {
index ab74234f3b9a9941041d7df655b8ef23d80ad6f2..0b608c63415aeecbea90683493a46f53a6d80c9f 100644 (file)
@@ -112,6 +112,8 @@ struct linktypeParser: controltypeParser<T>
     }
   virtual void buildAttr(const XML_Char** attr)
     {
+      if (!attr)
+        return;
       for (int i = 0; attr[i]; i += 2) 
         {
           if((std::string(attr[i]) == "control")
index 8ece73119f3c8082e809c561233dd301a3f64e11..4eb4c15ab67fe26482253f8e841054db15861f46 100644 (file)
@@ -84,6 +84,8 @@ namespace YACS
 template <class T>
 void looptypeParser<T>::buildAttr(const XML_Char** attr)
     {
+      if (!attr)
+        return;
       this->required("name",attr);
       for (int i = 0; attr[i]; i += 2) 
         {
@@ -336,6 +338,8 @@ template <class T> forlooptypeParser<T> forlooptypeParser<T>::forloopParser;
 template <class T>
 void forlooptypeParser<T>::buildAttr(const XML_Char** attr)
     {
+      if (!attr)
+        return;
       this->required("name",attr);
       for (int i = 0; attr[i]; i += 2) 
         {
@@ -493,6 +497,8 @@ struct foreachlooptypeParser:dynparalooptypeParser<T>
 
   virtual void buildAttr(const XML_Char** attr)
     {
+      if (!attr)
+        return;
       this->required("name",attr);
       this->required("type",attr);
       for (int i = 0; attr[i]; i += 2) 
@@ -579,6 +585,8 @@ struct optimizerlooptypeParser:dynparalooptypeParser<T>
 
   virtual void buildAttr(const XML_Char** attr)
     {
+      if (!attr)
+        return;
       this->required("name",attr);
       this->required("lib",attr);
       this->required("entry",attr);
index 2c5da31c73103756ec4ae22df1bf63b130c148ec..bea05f42cdd1b3d181ae9baa67e8a5668f7c4f25 100644 (file)
@@ -71,6 +71,8 @@ struct nodetypeParser: parser
     }
   virtual void buildAttr(const XML_Char** attr)
     {
+      if (!attr)
+        return;
       required("name",attr);
       required("type",attr);
       for (int i = 0; attr[i]; i += 2) 
index 98f64d404c13548ece9e17de4623573363f060f6..f1542e03c6e41a850684afb1d72a5462522d5680 100644 (file)
@@ -59,6 +59,8 @@ struct outputdatatypeParser: parser
     }
   virtual void buildAttr(const XML_Char** attr)
     {
+      if (!attr)
+        return;
       DEBTRACE("outputdatatypeParser::buildAttr");
       required("name",attr);
       required("type",attr);
@@ -156,6 +158,8 @@ void outnodetypeParser<T>::onEnd(const char *el,parser* child)
 template <class T>
 void outnodetypeParser<T>::buildAttr(const XML_Char** attr)
     {
+      if (!attr)
+        return;
       DEBTRACE("outnodetypeParser::buildAttr");
       this->required("name",attr);
       for (int i = 0; attr[i]; i += 2)
index 8fc61ed5232365aaa2984460af02b52076269b3f..95a88fc4d45fb36f94d0b16e2c49e67934077124 100644 (file)
 
 //#define _DEVDEBUG_
 #include "YacsTrace.hxx"
+#include <libxml/parserInternals.h>
 
 YACS::ENGINE::Proc* currentProc;
-XML_Parser p ;
-std::stack<YACS::parser*> sp;
+_xmlParserCtxt* saxContext;
 
 namespace YACS
 {
   parser parser::main_parser;
+  std::stack<parser*> parser::_stackParser;
 
 parser::~parser()
 {
@@ -48,52 +49,26 @@ parser::~parser()
 
 std::stack<parser*>& parser::getStack()
 {
-  return sp;
+  return _stackParser;
 }
 
 void parser::SetUserDataAndPush(parser* pp)
 {
-  XML_SetUserData(p,pp);
-  sp.push(pp);
+  XML_SetUserData(saxContext,pp);
+  _stackParser.push(pp);
   DEBTRACE("parser::SetUserDataAndPush, stack size: " << sp.size());
 }
 
-void XMLCALL parser::start(void *data, const XML_Char* el, const XML_Char** attr)
-{
-  DEBTRACE("parser::start, stack size: " << sp.size());
-  parser* pp=static_cast <parser *> (data);
-  pp->incrCount(el);
-  pp->onStart(el,attr);
-}
-
-void parser::onEnd(const XML_Char *el,parser* child)
+void parser::onEnd(const XML_Char *el, parser* child)
 {
   DEBTRACE("parser::onEnd: " << el)
 }
 
-void XMLCALL parser::end(void *data, const char *el)
-{
-  DEBTRACE("parser::end: " << el);
-  parser* child=static_cast <parser *> (data);
-  sp.pop();
-  DEBTRACE("parser::end, stack size: " << sp.size());
-  parser* pp=sp.top();
-  XML_SetUserData(p,pp);
-  pp->onEnd(el,child);
-  child->endParser();
-}
-
 void parser::charData(const XML_Char *s, int len)
 {
   _content=_content+std::string(s,len);
 }
 
-void XMLCALL parser::charac(void *data, const XML_Char *s, int len)
-{
-  parser* pp=static_cast <parser *> (data);
-  pp->charData(s,len);
-}
-
 void parser::endParser()
 {
   DEBTRACE("parser::endParser, level: " <<_level);
@@ -124,7 +99,7 @@ void parser::init ()
 
 void parser::incrCount(const XML_Char *el)
 {
-  if(_counts->count(el)==0)
+  if((*_counts).find(el)==(*_counts).end())
     (*_counts)[el]=1;
   else
     (*_counts)[el]=(*_counts)[el]+1;
@@ -210,7 +185,7 @@ void parser::minchoice(std::string *names, int min)
 
 void parser::required(const std::string& name, const XML_Char** attr)
 {
-  for (int i = 0; attr[i]; i += 2) 
+  for (int i = 0; attr[i]; i += 2)
     {
       if(name == std::string(attr[i]))return;
     }
@@ -219,10 +194,12 @@ void parser::required(const std::string& name, const XML_Char** attr)
 
 void parser::buildAttr(const XML_Char** attr)
 {
-  for (int i = 0; attr[i]; i += 2) 
-    {
-      DEBTRACE(attr[i] << "=" << attr[i + 1]);
-    }
+  if (!attr)
+    return;
+  for (int i = 0; attr[i]; i += 2)
+  {
+    DEBTRACE(attr[i] << "=" << attr[i + 1]);
+  }
 }
 
 void parser::onStart(const XML_Char* el, const XML_Char** attr)
@@ -237,7 +214,128 @@ void parser::onStart(const XML_Char* el, const XML_Char** attr)
 void parser::logError(const std::string& reason)
 {
   DEBTRACE( "parser::logError: " << _file );
-  currentProc->getLogger("parser")->error(reason,main_parser._file.c_str(),XML_GetCurrentLineNumber(p));
+  currentProc->getLogger("parser")->error(reason,main_parser._file.c_str(),saxContext->input->line);
+}
+void parser::XML_SetUserData(_xmlParserCtxt* ctxt,
+                             parser* par)
+{
+  ctxt->userData = par;
+}
+
+void XMLCALL parser::start_document(void* data)
+{
+  DEBTRACE("parser::start_document");
+  parser *currentParser = static_cast<parser *> (data);
+}
+
+void XMLCALL parser::end_document(void* data)
+{
+  DEBTRACE("parser::end_document");
+  parser *currentParser = static_cast<parser *> (data);
+}
+
+void XMLCALL parser::start_element(void* data,
+                                   const xmlChar* name,
+                                   const xmlChar** p)
+{
+  DEBTRACE("parser::start_element " << name);
+  parser *currentParser = static_cast<parser *> (data);
+  currentParser->incrCount((const XML_Char *)name);
+  currentParser->onStart((const XML_Char *)name, (const XML_Char **)p);
+}
+
+void XMLCALL parser::end_element(void* data,
+                                 const xmlChar* name)
+{
+  DEBTRACE("parser::end_element");
+  parser *childParser = static_cast<parser *> (data);
+  _stackParser.pop();
+  parser* pp=_stackParser.top();
+  XML_SetUserData(saxContext, pp);
+  pp->onEnd((const XML_Char *)name, childParser);
+  childParser->endParser();
+ }
+
+void XMLCALL parser::characters(void* data,
+                                const xmlChar* ch,
+                                int len)
+{
+  DEBTRACE("parser::characters " << len);
+  parser *currentParser = (parser *) (data);
+  currentParser->charData((const XML_Char*) ch, len);
+}
+
+void XMLCALL parser::comment(void* data,
+                             const xmlChar* value)
+{
+  DEBTRACE("parser::comment");
+  parser *currentParser = static_cast<parser *> (data);
+}
+
+void XMLCALL parser::cdata_block(void* data,
+                                 const xmlChar* value,
+                                 int len)
+{
+  DEBTRACE("parser::cdata_block");
+  parser *currentParser = static_cast<parser *> (data);
+  currentParser->charData((const XML_Char*) value, len);
+}
+
+void XMLCALL parser::warning(void* data,
+                             const char* fmt, ...)
+{
+  DEBTRACE("parser::warning");
+  parser *currentParser = static_cast<parser *> (data);
+  va_list args;
+  va_start(args, fmt);
+  std::string format = "%s";
+  if (format == fmt)
+    {
+      char* parv;
+      parv = va_arg(args, char*);
+      std::cerr << parv ;
+    }
+  else std::cerr << __FILE__ << " [" << __LINE__ << "] : "
+                 << "error format not taken into account: " << fmt << std::endl;
+  va_end(args);
+}
+
+void XMLCALL parser::error(void* data,
+                           const char* fmt, ...)
+{
+  DEBTRACE("parser::error");
+  parser *currentParser = static_cast<parser *> (data);
+  va_list args;
+  va_start(args, fmt);
+  std::string format = "%s";
+  if (format == fmt)
+    {
+      char* parv;
+      parv = va_arg(args, char*);
+      std::cerr << parv ;
+    }
+  else std::cerr << __FILE__ << " [" << __LINE__ << "] : "
+                 << "error format not taken into account: " << fmt << std::endl;
+  va_end(args);
+}
+
+void XMLCALL parser::fatal_error(void* data,
+                                 const char* fmt, ...)
+{
+  DEBTRACE("parser::fatal_error");
+  parser *currentParser = static_cast<parser *> (data);
+  va_list args;
+  va_start(args, fmt);
+  std::string format = "%s";
+  if (format == fmt)
+    {
+      char* parv;
+      parv = va_arg(args, char*);
+      std::cerr << parv ;
+    }
+  else std::cerr << __FILE__ << " [" << __LINE__ << "] : "
+                 << "error format not taken into account: " << fmt << std::endl;
+  va_end(args);
 }
 
 }
index 58963ecad6c2e271bb27c3c5f77a780f121b922f..d90eadda94b86a7b04f2baf511aeabe4c30e5746 100644 (file)
 
 #include "YACSloaderExport.hxx"
 
-#include <expat.h>
 #include <stack>
 #include <map>
 #include <string>
 #include <iostream>
 
+#include <libxml/parser.h>
+#include <libxml/tree.h>
+#include <libxml/xmlreader.h>
+
 namespace YACS
 {
 
+typedef char XML_Char;
+
 struct YACSLOADER_EXPORT parser
 {
   static parser main_parser;
+  static std::stack<parser*> _stackParser;
 
   parser():_level(0),_defaultParsersMap(0)
   {
     _counts=new std::map<std::string,int>;
   }
   virtual ~parser();
-
   virtual void SetUserDataAndPush(parser* pp);
   virtual void onStart(const XML_Char *el, const XML_Char** attr);
-  static void XMLCALL start(void *data, const XML_Char* el, const XML_Char** attr);
-
-  virtual void onEnd(const XML_Char *el,parser* child);
-    
-  static void XMLCALL end(void *data, const char *el);
-    
+  virtual void onEnd(const XML_Char *el, parser* child);
   virtual void charData(const XML_Char *s, int len);
-  
-  static void XMLCALL charac(void *data, const XML_Char *s, int len);
-    
   virtual void endParser();
-    
   virtual void init();
-    
-  virtual void incrCount(const XML_Char *el);
-    
+  virtual void incrCount(const XML_Char *elem);
   virtual void checkOrder(std::string& el);
-    
   virtual void maxcount(std::string name, int max, std::string& el);
-    
   virtual void mincount(std::string name,int min );
-    
   virtual void maxchoice(std::string *names, int max, std::string& el);
-    
   virtual void minchoice(std::string *names, int min);
-    
   virtual void pre(){_content="";};
   virtual void required(const std::string& name, const XML_Char** attr);
-    
   virtual void buildAttr(const XML_Char** attr);
-    
+
+  static void XMLCALL start_document(void* data);
+  static void XMLCALL end_document  (void* data);
+  static void XMLCALL start_element (void* data,
+                                     const xmlChar* name,
+                                     const xmlChar** p);
+  static void XMLCALL end_element   (void* data,
+                                     const xmlChar* name);
+  static void XMLCALL characters    (void* data,
+                                     const xmlChar* ch,
+                                     int len);
+  static void XMLCALL comment       (void* data,
+                                     const xmlChar* value);
+  static void XMLCALL cdata_block   (void* data,
+                                     const xmlChar* value,
+                                     int len);
+  static void XMLCALL warning       (void* data,
+                                     const char* fmt, ...);
+  static void XMLCALL error         (void* data,
+                                     const char* fmt, ...);
+  static void XMLCALL fatal_error   (void* data,
+                                     const char* fmt, ...);
+
+  static void XML_SetUserData(_xmlParserCtxt* ctxt, parser* par);
+
   std::stack<parser*>& getStack();
 
   template<class T>
index 08e19649ad168eed690d69a3b5e2a49ef5783a12..5cfe9e9a67510c71d1596539c2d6373e0a4bf91b 100644 (file)
@@ -19,7 +19,6 @@
 
 #include "parsers.hxx"
 
-#include <expat.h>
 #include <iostream>
 #include <stdexcept>
 #include <cstdio>
 //#define _DEVDEBUG_
 #include "YacsTrace.hxx"
 
+#include <libxml/parser.h>
+#include <libxml/tree.h>
+#include <libxml/xmlreader.h>
+#include <libxml/parserInternals.h>
 YACS::ENGINE::Runtime* theRuntime=0;
 
 #define BUFFSIZE        8192
@@ -41,15 +44,13 @@ YACS::ENGINE::Runtime* theRuntime=0;
 char Buff[BUFFSIZE];
 
 extern YACS::ENGINE::Proc* currentProc;
-extern XML_Parser p ;
-
+extern _xmlParserCtxt* saxContext;
 namespace YACS
 {
 
 YACSLoader::YACSLoader()
 {
   _defaultParsersMap.clear();
-
   theRuntime = ENGINE::getRuntime();
 }
 
@@ -62,79 +63,80 @@ void YACSLoader::registerProcCataLoader()
 ENGINE::Proc* YACSLoader::load(const char * file)
 {
   DEBTRACE("YACSLoader::load: " << file);
-  FILE* fin=fopen(file,"r");
-  if (! fin) 
-    {
-      std::cerr << "Couldn't open schema file" << std::endl;
-      throw std::invalid_argument("Couldn't open schema file");
-    }
-
-  p = XML_ParserCreate(NULL);
-  if (! p) 
-    {
-      std::cerr << "Couldn't allocate memory for parser" << std::endl;
-      throw Exception("Couldn't allocate memory for parser");
-    }
-  XML_SetElementHandler(p, parser::start,parser::end);
-  XML_SetCharacterDataHandler(p,parser::charac );
+  parser::main_parser.init();
+  parser::main_parser._stackParser.push(&parser::main_parser);
+  xmlSAXHandler baseHandler =
+  {
+    0,  // internal_subset,
+    0,  // isStandalone
+    0,  // hasInternalSubset
+    0,  // hasExternalSubset
+    0,  // resolveEntity
+    0,  // getEntity
+    0,  // entityDecl
+    0,  // notationDecl
+    0,  // attributeDecl
+    0,  // elementDecl
+    0,  // unparsedEntityDecl
+    0,  // setDocumentLocator
+    parser::start_document, // startDocument
+    parser::end_document,   // endDocument
+    parser::start_element,  // startElement
+    parser::end_element,    // endElement
+    0,  // reference
+    parser::characters,     // characters
+    0,  // ignorableWhitespace
+    0,  // processingInstruction
+    parser::comment,        // comment
+    parser::warning,  // warning
+    parser::error,  // error
+    parser::fatal_error,  // fatalError
+    0,  // getParameterEntity
+    parser::cdata_block,    // cdataBlock
+    0  // externalSubset
+  };
 
+  FILE* fin=fopen(file,"r");
+  if (! fin)
+  {
+    std::cerr << "Couldn't open schema file" << std::endl;
+    throw std::invalid_argument("Couldn't open schema file");
+  }
+
+  saxContext = xmlCreateFileParserCtxt(file);
+
+  if (!saxContext)
+  {
+    std::cerr << "Couldn't allocate memory for parser" << std::endl;
+    throw Exception("Couldn't allocate memory for parser");
+  }
+  saxContext->sax = &baseHandler;
   parser::main_parser.SetUserDataAndPush(&YACS::roottypeParser::rootParser);
-
-  // OCC: san -- Allow external parsers for handling of unknown elements
-  // and attributes. This capability is used by YACS GUI to read
-  // graph presentation data
   if ( !_defaultParsersMap.empty() )
     roottypeParser::rootParser.setDefaultMap(&_defaultParsersMap);
   else
     roottypeParser::rootParser.setDefaultMap(0);
-  
-  parser::main_parser._file=file;
 
-  currentProc=0;
+  parser::main_parser._file = file;
+  currentProc = 0;
 
   try
+  {
+    if ( xmlParseDocument(saxContext) == -1 )
     {
-      for (;;) 
-        {
-          int done;
-          int len;
-
-          len = fread(Buff, 1, BUFFSIZE, fin);
-          if (ferror(fin)) 
-            {
-              std::cerr << "Read error" << std::endl;
-              throw Exception("Read error");
-            }
-          done = feof(fin);
-
-          if (XML_Parse(p, Buff, len, done) == XML_STATUS_ERROR) 
-            {
-              if(currentProc==0)
-                {
-                  std::cerr <<XML_ErrorString(XML_GetErrorCode(p))<<" "<<file<<" "<<XML_GetCurrentLineNumber(p)<<std::endl;
-                  break;
-                }
-              YACS::ENGINE::Logger* logger=currentProc->getLogger("parser");
-              logger->fatal(XML_ErrorString(XML_GetErrorCode(p)),file,XML_GetCurrentLineNumber(p));
-              break;
-            }
-
-          if (done)
-            break;
-        }
-      XML_ParserFree (p);
-      p=0;
-      return currentProc;
+      YACS::ENGINE::Logger* logger = currentProc->getLogger("parser");
+      logger->fatal( saxContext->lastError.message, file, saxContext->input->line );
     }
+    saxContext = 0;
+    return currentProc;
+  }
   catch(Exception& e)
-    {
-      //get line number from XML parser
-      YACS::ENGINE::Logger* logger=currentProc->getLogger("parser");
-      logger->fatal(e.what(),file,XML_GetCurrentLineNumber(p));
-      XML_ParserFree (p);
-      p=0;
-      return currentProc;
-    }
+  {
+    YACS::ENGINE::Logger* logger = currentProc->getLogger("parser");
+    logger->fatal(e.what(), file, saxContext->input->line);
+    saxContext = 0;
+    return currentProc;
+  }
 }
 
 YACSLoader::~YACSLoader()
index 8e355b988e4a185131db0b85846f5836612b6b3e..ea299e86f86ad12053f6fbc7b4ad39eeb347c921 100755 (executable)
@@ -27,7 +27,6 @@ ADD_DEFINITIONS(
 INCLUDE_DIRECTORIES(
   ${CPPUNIT_INCLUDE_DIRS}
   ${PTHREADS_INCLUDE_DIRS}
-  ${EXPAT_INCLUDE_DIR}
   ${CMAKE_CURRENT_SOURCE_DIR}/
   ${CMAKE_CURRENT_SOURCE_DIR}/..
   ${CMAKE_CURRENT_SOURCE_DIR}/../../bases
index f67f74884495135a80917c935d302f632fd30d16..10a5a2d3adbe706469bfe3625ea8893f288da8c2 100644 (file)
@@ -94,6 +94,8 @@ template <class T>
 template <class T>
   void inporttypeParser<T>::buildAttr(const XML_Char** attr)
     {
+      if (!attr)
+        return;
       required("name",attr);
       required("type",attr);
       for (int i = 0; attr[i]; i += 2) 
index 6b8ecde9427d35a47207e2b3b3dc4d03491c39a6..12fe3d4c1ccb81fd51949cf1886e4cacdc45aacc 100644 (file)
@@ -64,6 +64,8 @@ struct presetdatatypeParser: parser
     }
   virtual void buildAttr(const XML_Char** attr)
     {
+      if (!attr)
+        return;
       DEBTRACE("presetdatatypeParser::buildAttr");
       required("name",attr);
       required("type",attr);
@@ -174,6 +176,8 @@ void presettypeParser<T>::onEnd(const char *el,parser* child)
 template <class T>
 void presettypeParser<T>::buildAttr(const XML_Char** attr)
     {
+      if (!attr)
+        return;
       DEBTRACE("presettypeParser::buildAttr");
       this->required("name",attr);
       for (int i = 0; attr[i]; i += 2)
index cc02ff46aa7150364b906a82276ceab511d755bd..185bb808c56a3329f6d11ed78bbbff7fc3fd0f29 100644 (file)
@@ -51,6 +51,8 @@ struct proctypeParser: bloctypeParser<T>
   virtual void onEnd(const char *el,parser* child);
   virtual void buildAttr(const XML_Char** attr)
     {
+         if (!attr)
+               return;
       for (int i = 0; attr[i]; i += 2) 
         {
           if(std::string(attr[i]) == "state")
index ccf95e8d36c5c878d304c7a33b1fff13e425f8f0..a418dfe1041c200c748182ca2d7579591b7fc2cd 100644 (file)
@@ -26,6 +26,8 @@ namespace YACS
 
   void propertytypeParser::buildAttr(const XML_Char** attr)
     {
+      if (!attr)
+        return;
       required("name",attr);
       required("value",attr);
       for (int i = 0; attr[i]; i += 2)
index 808c95928e358a02f1d3ff205ad15e2a1942817c..76e0cc4e46cbbb596b63575d154d0b790d69c329 100644 (file)
@@ -112,6 +112,8 @@ namespace YACS
 
   void casetypeParser::buildAttr(const XML_Char** attr)
     {
+      if (!attr)
+        return;
       this->required("id",attr);
       for (int i = 0; attr[i]; i += 2) 
         {
@@ -237,6 +239,8 @@ namespace YACS
 
   void defaultcasetypeParser::buildAttr(const XML_Char** attr)
     {
+      if (!attr)
+        return;
       for (int i = 0; attr[i]; i += 2) 
       {
         DEBTRACE( attr[i] << "=" << attr[i + 1] )             
@@ -256,6 +260,8 @@ namespace YACS
 
   void switchtypeParser::buildAttr(const XML_Char** attr)
     {
+      if (!attr)
+        return;
       this->required("name",attr);
       for (int i = 0; attr[i]; i += 2) 
         {
index 241d8fe71795d9cf04033d69a71fb4c84361419d..50f5c01888dbd339c7cdbaa7986e78774cddc9ff 100644 (file)
@@ -41,6 +41,8 @@ namespace YACS
 
   void typetypeParser::buildAttr(const XML_Char** attr)
     {
+      if (!attr)
+        return;
       required("name",attr);
       required("kind",attr);
       for (int i = 0; attr[i]; i += 2) 
@@ -84,6 +86,8 @@ namespace YACS
     }
   void seqtypeParser::buildAttr(const XML_Char** attr)
     {
+      if (!attr)
+        return;
       required("name",attr);
       required("content",attr);
       for (int i = 0; attr[i]; i += 2) 
@@ -145,6 +149,8 @@ namespace YACS
     }
   void objtypeParser::buildAttr(const XML_Char** attr)
     {
+      if (!attr)
+        return;
       required("name",attr);
       for (int i = 0; attr[i]; i += 2) 
         {
@@ -204,6 +210,8 @@ namespace YACS
 
   void membertypeParser::buildAttr(const XML_Char** attr)
     {
+      if (!attr)
+        return;
       required("name",attr);
       required("type",attr);
       for (int i = 0; attr[i]; i += 2)
@@ -235,6 +243,8 @@ namespace YACS
     }
   void structtypeParser::buildAttr(const XML_Char** attr)
     {
+      if (!attr)
+        return;
       required("name",attr);
       for (int i = 0; attr[i]; i += 2) 
         {
index 913955bfa3b1d3eadcd16d35c794bc4b1d7204eb..8d83ff9264896a5e5e8b718162b2d80857802395 100644 (file)
@@ -29,9 +29,6 @@
 //#define _DEVDEBUG_
 #include "YacsTrace.hxx"
 
-// --- specific part for libxml2 ----------------------------------------------
-
-#ifdef USE_LIBXML2
 extern "C"
 {
 #include <libxml/parserInternals.h> // for xmlCreateFileParserCtxt
@@ -42,13 +39,6 @@ void xmlParserBase::XML_SetUserData(_xmlParserCtxt* ctxt,
 {
   ctxt->userData = parser;
 }
-#endif
-
-// --- specific part for expat ------------------------------------------------
-
-#ifdef USE_EXPAT
-XML_Parser xmlParserBase::_xmlParser;
-#endif
 
 // --- generic part -----------------------------------------------------------
 
@@ -111,8 +101,8 @@ void XMLCALL xmlParserBase::end_element   (void* userData,
 
 
 /*! callback called for significant characters inside tags: \verbatim <tag>content</tag> \endverbatim
- *  or outside tags, like space or new line
- *  with expat get also the CDATA tags: \verbatim <tag>![CDATA[content]]></tag> \endverbatim
+ *  or outside tags, like space or new line;
+ *  get also the CDATA tags: \verbatim <tag>![CDATA[content]]></tag> \endverbatim
  */
 
 void XMLCALL xmlParserBase::characters    (void* userData,
@@ -329,23 +319,16 @@ void xmlParserBase::end()
 {
 }
 
-/*! Throws an exception. different implementation with libxml2 and expat
+/*! Throws an exception.
  */
 
 void xmlParserBase::stopParse(std::string what)
 {
-#ifdef USE_LIBXML2
   xmlStopParser(_xmlParser);
-#endif
-#ifdef USE_EXPAT
-  throw Exception(what);
-#endif  
 }
 
 // ----------------------------------------------------------------------------
 
-#ifdef USE_LIBXML2
-
 /*! libxml2 parser initialisation
  * \param parser dedicated parser
  */
@@ -411,92 +394,15 @@ void xmlReader::parse(std::string xmlFile)
 
   xmlParseDocument(saxContext);
   _rootParser->cleanGarbage();
-  xmlFileClose(saxContext);
-  xmlFreeParserCtxt(saxContext);
+  if ( saxContext->myDoc != NULL ) {
+    xmlFreeDoc( saxContext->myDoc );
+    saxContext->myDoc = NULL;
+  }
+  if ( saxContext != NULL ) {
+    saxContext->sax = old_sax;
+    xmlFreeParserCtxt( saxContext );
+  }
   DEBTRACE("xmlParserBase::end of parse, garbage size = " << _rootParser->getGarbageSize());
 }
-#endif
-
-// ----------------------------------------------------------------------------
-
-#ifdef USE_EXPAT
-
-#define SIZEBUF        8192
-char Buffer[SIZEBUF];
-
-/*! expat parser initialisation
- * \param parser dedicated parser
- */
-
-xmlReader::xmlReader(xmlParserBase* parser): _rootParser(parser)
-{
-  xmlParserBase::_xmlParser= XML_ParserCreate(NULL);
-  if (! _rootParser ) 
-    {
-      cerr << "Couldn't allocate memory for parser" << endl;
-      throw Exception("Couldn't allocate memory for parser");
-    }
-}
-
-/*! expat parse
- * \param xmlFile file to parse
- */
-
-void xmlReader::parse(std::string xmlFile)
-{
-  FILE* fin=fopen(xmlFile.c_str(),"r");
-  if (! fin) 
-    {
-      std::cerr << "Couldn't open schema file" << std::endl;
-      throw std::invalid_argument("Couldn't open schema file");
-      //throw Exception("Couldn't open schema file");
-    }
-
-  XML_SetElementHandler(xmlParserBase::_xmlParser,
-                        xmlParserBase::start_element,
-                        xmlParserBase::end_element);
-  XML_SetCharacterDataHandler(xmlParserBase::_xmlParser,
-                              xmlParserBase::characters );
-  XML_SetUserData(xmlParserBase::_xmlParser, _rootParser);
-  _rootParser->init(0);
-  _rootParser->_stackParser.push(_rootParser);
-
-  try
-    {
-      for (;;) 
-        {
-          int done;
-          int len;
-
-          len = fread(Buffer, 1, SIZEBUF, fin);
-          if (ferror(fin)) 
-            {
-              std::cerr << "Read error" << std::endl;
-              throw Exception("Read error");
-            }
-          done = feof(fin);
-
-          if (XML_Parse(xmlParserBase::_xmlParser, Buffer, len, done) == XML_STATUS_ERROR) 
-            {
-              throw Exception(XML_ErrorString(XML_GetErrorCode(xmlParserBase::_xmlParser)));
-            }
-
-          if (done)
-            break;
-        }
-      XML_ParserFree (xmlParserBase::_xmlParser);
-      xmlParserBase::_xmlParser=0;
-      _rootParser->cleanGarbage();
-      DEBTRACE("xmlParserBase::end of parse, garbage size = " << _rootParser->getGarbageSize());
-    }
-  catch(Exception& e)
-    {
-      _rootParser->cleanGarbage();
-      //get line number from XML parser
-      cerr << "Error at line: " << XML_GetCurrentLineNumber(xmlParserBase::_xmlParser) << endl;
-      throw e;
-    }
-}
-#endif
 
 // ----------------------------------------------------------------------------
index dd9c316a284e5c70dc5e250d6a424123b5ee62ea..d57c82b271285f0d4e8e21982ffc6cf0db9c2b33 100644 (file)
 #define __XMLPARSERBASE_HXX_
 
 
-// --- select only one of the following packages ------------------------------
-// - libxml2 comes with gnome, so it's almost always already installed,
-//   but may not not work (see below).
-// - libexpat is a less common package, but light, and works fine.
-
-// With standard installation of libxml2, C++ exception cannot be catched 
-// during the parse process. This is required for normal use of yacs.
-// libxml2 must be generated with configure --with-fexceptions ...
-// (to be tested)
-// Developpement and tests are done with libexpat.
-
-//#define USE_LIBXML2
-#define USE_EXPAT
-
-// --- specific part for libxml2 ----------------------------------------------
-
-#ifdef USE_LIBXML2
 extern "C"
 {
 #include <libxml/parser.h>
@@ -45,16 +28,6 @@ extern "C"
 #define XMLCALL
 #define XML_Char char
 inline XML_Char* tochar(const xmlChar *c) { return (XML_Char*)c; };
-#endif
-
-// --- specific part for expat ------------------------------------------------
-
-#ifdef USE_EXPAT
-  #include <expat.h>
-#define xmlChar XML_Char
-inline const XML_Char* tochar(const xmlChar *c) { return c; };
-#endif
-
 
 // --- generic part -----------------------------------------------------------
 
@@ -114,15 +87,9 @@ public:
 
   std::map< std::string, int > counts;
 
-#ifdef USE_LIBXML2
   static _xmlParserCtxt* _xmlParser;
   static void XML_SetUserData(_xmlParserCtxt* ctxt,
                               xmlParserBase* parser);
-#endif
-
-#ifdef USE_EXPAT
-  static XML_Parser _xmlParser;
-#endif
 
   static std::stack<xmlParserBase*> _stackParser;
 
index 4b651420c4d47e4c995817023bc5c08103289bd1..19e73bc23993baad7c92c5f30cf33e1c330f26e2 100644 (file)
@@ -33,7 +33,6 @@ INCLUDE_DIRECTORIES(
   ${PROJECT_SOURCE_DIR}/src/yacsloader
   ${PROJECT_BINARY_DIR}/src/engine_swig
   ${OMNIORB_INCLUDE_DIR}
-  ${EXPAT_INCLUDE_DIR}
   ${PYTHON_INCLUDE_DIRS}
 )