[daisy] Namespaces, ID's and daisy
Marc Portier
mpo at outerthought.org
Tue Sep 11 08:24:17 CDT 2007
Shane Starcher wrote:
> My question is, is there anyway to use the daisy java API to do this. I
> have not been able to find a way to create a document and specify it's
> namespace.
What you are looking for is the method
Document#setRequestedId("182784-myns")
http://cocoondev.org/javadoc/daisy/2.1/org/outerj/daisy/repository/Document.html#setRequestedId(java.lang.String)
the sequence in javascript-speek is then:
var document = repository.createDocument(name, type, branch, lang);
var id = "182784-myns";
document.setRequestedId(id);
document.save(false);
'setRequestedId' means as much as you asking the repo to please assign
that id (inclusive namespace) to the document.
It will do so only if the requested namespace is not the one that is
assigned to be managed by the repository itself (see <namespace> element
in {DSY_DATA}/conf/myconfig.xml) - and throww an exception otherwise
The repository will automatically assign a namespace-fingerprint if this
namespace is used for the first time. I however you want to control that
fingerprint yourself, then you will need to properly register the
namespace in the repository.
See the namespace-manager for that:
http://cocoondev.org/javadoc/daisy/2.1/org/outerj/daisy/repository/namespace/NamespaceManager.html
regards,
-marc=
More information about the daisy
mailing list