|
|
|
|
|
|
| Author |
Message |
George *nix forums Guru Wannabe
Joined: 26 Feb 2005
Posts: 198
|
Posted: Thu Mar 03, 2005 5:22 pm Post subject:
Re: DBXML and Xerces-c
|
|
|
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
|
Posted: Thu Mar 03, 2005 12:19 pm Post subject:
Re: DBXML and Xerces-c
|
|
|
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
|
Posted: Tue Mar 01, 2005 5:08 pm Post subject:
DBXML and Xerces-c
|
|
|
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 |
|
 |
|
|
The time now is Thu Jan 08, 2009 5:06 am | All times are GMT
|
|
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
|
|