I'm trying to migrate some perl code to python and it uses Sleeypcat::DbXml 'simple'
to get read access to a .dbxml
file, creates a XmlManager
, calls createQueryContext
, openContainer
and query
to get an XmlValue
. I have found https://pypi.org/project/berkeleydb/ to support the Berkeley DB in general, but it has no mention of this XML layer. Is there an existing API I can use in python 3?

- 621
- 4
- 11
2 Answers
Berkeley DB and Berkeley DB XML are two different products. My python bindings (legacy "bsddb3" and current "berkeleydb") only interface with Berkeley DB.
I am not aware of any Python bindings for Berkeley DB XML.
I am a freelance with commercial contracts, if that option would be useful to you.

- 648
- 6
- 13
Berkeley dbxml does come with a Pyhon bindings. I ended up having to make modifications to the SWIG interface files to get it to run with Python3. If you are interested in building for a recent Python, you will need to make some modifications to the Python interface file. Specifically, you have to
- redefine PYSTR_* macros to use unicode strings
- make changes to the initialization code to return the module
- update the Python 3 iterator code to use __next__ via a %rename pragma
- potentially add code for missing objects an changed interfaces, e.g. I added an XmlResultsIterator, and added som code to XmlManager to let me reindex containers.
You then need to regenerate the swig interface and recompile the module. I don't know StackOverflow's policy on posting patches, but if it's allowed I'd be happy to post the patches that I created for dbxml 6.1.4 and Python 3.9 for you. Getting it all compiled is a little bit of work, but very doable.

- 270
- 3
- 9
-
I'd certainly be interested in the patch - snoopyjc AT gmail DOT com please – snoopyjc Dec 14 '22 at 04:40