Support for DB XML 2.
This commit is contained in:
parent
2a65f76d3e
commit
489e35aea3
|
@ -1,13 +1,11 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import bsddb.db
|
||||
import dbxml
|
||||
|
||||
books = {
|
||||
'short' : '<short />',
|
||||
'oui oui' : '<book><title>Oui oui à la plage</title></book>',
|
||||
'la démocratie' : '<book><title>Science politique - 1. La démocratie</title><author>Philippe Braud</author><chapter><title>La question des origines</title></chapter><chapter><title>La democratie comme reference mobilisatrice</title></chapter></book>',
|
||||
'article' : '''<?xml version="1.0"?>
|
||||
<article xmlns="http://www.entrouvert.org/namespaces/expression/0.0">
|
||||
<title>This is the article title</title>
|
||||
|
@ -21,13 +19,10 @@ Just for testing.</body>
|
|||
</article>''',
|
||||
}
|
||||
|
||||
container = dbxml.XmlContainer(None, "test.dbxml")
|
||||
container.open(None, dbxml.DB_CREATE)
|
||||
manager = dbxml.XmlManager()
|
||||
updateContext = manager.createUpdateContext()
|
||||
container = manager.createContainer("test.dbxml")
|
||||
|
||||
for name in books.keys():
|
||||
document = dbxml.XmlDocument()
|
||||
document.setName(name)
|
||||
document.setContent(books[name])
|
||||
container.putDocument(None, document)
|
||||
container.putDocument(name, books[name], updateContext)
|
||||
|
||||
container.close()
|
||||
|
|
Reference in New Issue