niXforums Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
·  nixdoc.net ·  man pages ·  Linux HOWTOs ·  FreeBSD Tips ·  Forums
navigation Forum index » Databases » Berkeley DB
DBXML and Xerces-c
Post new topic   Reply to topic Page 1 of 1 [3 Posts] View previous topic :: View next topic
Author Message
George
*nix forums Guru Wannabe


Joined: 26 Feb 2005
Posts: 198

PostPosted: Thu Mar 03, 2005 5:22 pm    Post subject: Re: DBXML and Xerces-c Reply with quote

Florian,

You've uncovered a bug in the Pathan initialization code. It is not
tolerant to
initialization/uninitialization. The XmlManager constructor will
initialize both Pathan and Xerces, so in scope, you don't need to
explicitly initialize Xerces.

To work around the problem, the simplest thing is to keep things
initialized.
The best way to do this is to add a dummy XmlManager object to your
program
at the main() scope:

int
main(){
XmlManager m;
cout << "First round\n";
....

Regards,

George
Sleepycat Software
Back to top
Grimbal
*nix forums beginner


Joined: 24 Feb 2005
Posts: 9

PostPosted: Thu Mar 03, 2005 12:19 pm    Post subject: Re: DBXML and Xerces-c Reply with quote

I still don't know why it hangs, whether it is xerces-c, dbxml or
pathan that is to blame (actually, the program hangs in the Pathan
library).

But never, mind, I worked around the problem. Since DBXML is happy to
provide a document as a DOM tree, I don't need to parse it myself when
the data comes from the databse.
Back to top
Grimbal
*nix forums beginner


Joined: 24 Feb 2005
Posts: 9

PostPosted: Tue Mar 01, 2005 5:08 pm    Post subject: DBXML and Xerces-c Reply with quote

Hello,

My next problem is to use DBXML and Xerces-c together.

When my program started hanging, I stipped it down to the absolute
minimum that still hangs. It seems that as soon as I try to initialize
a DOM parser within the scope of an instance of XmlManager, the program
hangs. But only on the second time I create a XmlManager and
initialize a parse.

Here is the stripped-down program.
-----------------------------------------
#include <iostream>

using namespace std;

#include <dbxml/DbXml.hpp>

using namespace DbXml;

#include <xercesc/util/PlatformUtils.hpp>
#include <xercesc/dom/DOMImplementationLS.hpp>
#include <xercesc/dom/DOMImplementationRegistry.hpp>

using namespace XERCES_CPP_NAMESPACE;


// parse the item

int
parseItem()
{
static const XMLCh gLS[] = { 'L', 'S' , 0 };

try {

// initialize XML utils
XMLPlatformUtils::Initialize();

// Instantiate the DOM parser. (with featyre "LS" in XMLCh's)
cout << "before call\n";
DOMImplementation *impl =
DOMImplementationRegistry::getDOMImplementation(gLS);
cout << "after call\n";

// (actual parsing was here)

// terminate XML utils
XMLPlatformUtils::Terminate();

} catch (exception &e){
cerr << "*** parse exception: " << e.what() << "\n";
}

return 0;
}

// read the item

int
readItem()
{
try {

// Open the DB environment
DbEnv env(0);
env.open("workdb", DB_INIT_MPOOL, 0);

// open the container
XmlManager db(&env);

// (actual opening and reading of the item was here)

// parse it
parseItem();

} catch (exception &e){
cerr << "*** db exception: " << e.what() << "\n";
}

return 0;
}

///////////////////////////////////////////////////////////////////////////////

int
main(){
cout << "First round\n";
readItem();

cout << "Second round\n";
readItem();

cout << "Done\n";
}
-----------------------------------------
The output I get is:
-----------------------------------------
First round
before call
after call
Second round
before call
Segmentation Fault (core dumped)
-----------------------------------------
And the debugger tells me it happens is somewhere in the Xerces
library.

If I move the parseItem() call before before the DbEnv(0), or if I
enclose the DbEnv and XmlManager in a pair of {}, It does not hang.
But that would mean I can not keep my container open while I parse some
item?

Do you see anything in the code that I do wrongly?

Thanks in advance,
Florian Fischer.

I am woking with gcc on Solaris, using DBXML 2.0.9
Back to top
Google

Back to top
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [3 Posts] View previous topic :: View next topic
The time now is Thu Jan 08, 2009 5:06 am | All times are GMT
navigation Forum index » Databases » Berkeley DB
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts problem updatenodes in dbxml mahdieh Berkeley DB 0 Thu Jul 20, 2006 5:15 pm
No new posts JVM Crash with DBXML dgalewsky@gmail.com Berkeley DB 0 Wed Jul 19, 2006 10:35 pm
No new posts Berkeley DBXML vs eXist - tuning Berkeley? tfga Berkeley DB 1 Sat Jul 15, 2006 1:02 am
No new posts cast error after compiling xerces.lib /komische TypeCast-... Martin Himmel C++ 1 Wed Jul 12, 2006 6:54 pm
No new posts cast error after compiling xerces.lib /komische TypeCast-... Martin Himmel C++ 0 Wed Jul 12, 2006 5:50 pm

Bad Credit Mortgages | Credit Card Shop | Debt Help | Libros medicina | 0 Credit Cards
Copyright © 2004-2005 DeniX Solutions SRL
 
Other DeniX Solutions sites: Unix/Linux blog |  electronics forum |  medicine forum |  science forum | 
Privacy Policy


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1798s ][ Queries: 20 (0.1055s) ][ GZIP on - Debug on ]