Re: [bdbxml] XmlManager.openContainer

Andrew Wood <[email protected]>
Newsgroups gmane.comp.db.dbxml.general
Message-ID <[email protected]>
Just a thought...

container = manager.openContainer("rssfeeds.dbxml")

Make sure you're being explicit as to the location of your dbxml file.
 The openContainer() method is probably looking in the current working
directory for your dbxml file.

I was having symptoms like yours but fixed it with something like:

container = manager.openContainer("/xmldata/containers/rssfeeds.dbxml")

or where ever your dbxml containers are.


-Andrew

On 6/28/05, Andrew Fister 3rd <[email protected]> wrote:
> 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]
> 
>


------------------------------------------
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.