LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-26-2010, 04:45 AM   #1
Pianoman78315
LQ Newbie
 
Registered: Oct 2010
Location: Germany
Distribution: Angstrom
Posts: 3

Rep: Reputation: 0
Question libxml++ enable exception handling


Hello,

To parse several XML documents I´m using libxml++. I do programming for linux angstrom-armv5te. Because compiling libxml++ for this distribution and platform was impossible, I simply included the library to my project, which workes fine.

Unfortunately I´m not able not use the exception handing which effects that a simple error inside a documents makes my whole program crash. This should not happen.

Is there a way to check the documents validity before parsing or better active the exception handling for doing this:

Code:
try{
xmlpp::DomParser Parser; 
Parser.parse_file( XMLFilePath);
}
catch (...){ 
printf("error"); 
}

LIBXMLCPP_EXCEPTIONS_ENABLED is not defined. Inside the 'libxml++config.h' there is following code:

Code:
#ifdef GLIBMM_CONFIGURE
/* compiler feature tests that are used during compile time and run-time
   by libxml++ only. */
#undef LIBXMLCPP_EXCEPTIONS_ENABLED
#endif /* GLIBMM_CONFIGURE */
Any chances to solve my problem?
Thanks in advance, Michael
 
Old 10-27-2010, 12:30 AM   #2
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi -

I can't believe that if you're able to compile your application, you're not able to RE-compile libxml++ (and compile it with exception support).

"Plan A" should certainly be to create a viable libXML++, if at all possible.

If it isn't possible, for whatever reason, then I guess "Plan B" would be to find a different library.

"expat" would probably be a good choice:
http://expat.sourceforge.net/

'Hope that helps
 
Old 10-28-2010, 02:36 AM   #3
Pianoman78315
LQ Newbie
 
Registered: Oct 2010
Location: Germany
Distribution: Angstrom
Posts: 3

Original Poster
Rep: Reputation: 0
The reason why I can´t compile libxml++ is that after configuring and setting all paths and env-variables right, during compilation strange ref paths apeared that never existed on my system. The library is unable to compile because those paths don´t exists. I manipulated everything inside the makefile that could be the reason. Later on I found those paths in the *.la file of another already installed library. I´m not sure if it was glibmm or libxml2. Those paths do also exist in the binaries of the libraries as dependencies . Creating a path with that name and putting in the libs I was able to make, but unfortunately not to install.

What could be the reason why LIBXMLL_EXCEPTION_ENABLED is not defined. What do I have to do to enable this?
 
Old 10-28-2010, 07:48 AM   #4
Pianoman78315
LQ Newbie
 
Registered: Oct 2010
Location: Germany
Distribution: Angstrom
Posts: 3

Original Poster
Rep: Reputation: 0
Talking

problem solved.

redefined LIBXMLCPP_EXCEPTIONS_ENABLED where it is to be undefined in 'libxml++config.h'.

Then while compiling an error appeared in 'textreader.cc'.

Uncommented following lines in 'textreader.cc' ( 375 - 378 )

Code:
TextReader* ths = const_cast<TextReader*>(this);

   int severity = severity_;
   ths->severity_ = 0;
Then compiling works fine. Exception handling as well. I´m so happy.
Thank you very much.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Exception handling in Perl shifter Programming 1 05-12-2010 10:42 AM
exception handling question firsten Programming 15 05-15-2009 06:53 AM
Exception Handling vipinsharma Programming 2 09-25-2005 11:05 AM
Exception Handling C++ Hady Programming 3 07-26-2005 11:07 PM
python; exception handling TheLinuxDuck Programming 2 08-20-2003 02:01 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:46 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration