How to get name list of documents from XML DB

322 Views Asked by At

My application transfers XMLs to Berkeley XML DB with names autogeneration. When I have for example 1000 documents in DB, how can I get name list of documents?

I can only count them by using:

query 'collection("myDB.dbxml")'

after 'print' console lists me a full content of XMLs.

1

There are 1 best solutions below

0
On

The easiest way to do this is by interacting with the dbxml API and calling the getAllDocuments() method in your application. You can pass the output to an http response object if required...

Al la Danny Brian's excellent 'Definitive Guide to Berkeley DB XML' using Python:

container = manager.openContainer("myDB.dbxml")
results = container.getAllDocuments(0)
for value in results:
    document = value.asDocument()
    print document.getName()