[bdbxml] XmlManager.openContainer

Andrew Fister 3rd <[email protected]>
Newsgroups gmane.comp.db.dbxml.general
Message-ID <[email protected]>
hi,
    I'm having trouble opening a container separately from creating it.  
I'm working in the python port of BDB XML on a UNIX machine...I'll just 
paste the code where the container is created originally:

def StoreFeeds(feedDocs,feedNames):

    manager = XmlManager()
    updateContext = manager.createUpdateContext()
    container = manager.openContainer("rssfeeds.dbxml",DB_CREATE)
   
    for n in range(0,len(feedDocs)):
        feedString = feedDocs[n].toxml("utf-8")
        feedName = feedNames[n]
        clockTime = str(clock())
        feedID = feedName + " " + clockTime
   
        container.putDocument(feedID,feedString,updateContext)
    #End for
#End StoreFeeds

That works fine.  The file is created as I expect.  In another program I 
want to use to query the DB, I use this code:

manager = XmlManager()
uc = manager.createUpdateContext()

container = manager.openContainer("rssfeeds.dbxml")
qc = manager.createQueryContext()
results = manager.query("collection('rssfeeds.dbxml')/xml",qc)
results.reset()

for value in results:
    document = value.asDocument()
    print document.getName(), "=", value.asString()
#End while

This code doesn't work.  On running I get a Runtime Error as follows:

-bash-3.00$ python RSSretrieve.py
Traceback (most recent call last):
  File "RSSretrieve.py", line 27, in ?
    results = manager.query("collection('rssfeeds.dbxml')/link",qc)
  File "/home/afister/lib/python/dbxml.py", line 124, in query
    def query(*args): return _dbxml.XmlManager_query(*args)
RuntimeError: Error: Cannot query in container dbxml:rssfeeds.dbxml.  
Container not open and auto-open is not enabled

Any help would be appreciated :-)

-Andrew


------------------------------------------
To remove yourself from this list, send an
email to [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.