[Yanel-dev] Creating nodes?
Josias Thöny
josias.thoeny at wyona.com
Mon Feb 19 16:26:09 CET 2007
Michael Wechner wrote:
> Hi
>
> I would like to create a new node
>
> Writer writer = new
> java.io.OutputStreamWriter(repo.getNode(getPath()).getOutputStream());
>
> but receive the following exception
>
>
> 39677 2007-02-19 16:10:10,438 [http-8080-Processor23] ERROR
> org.wyona.yanel.impl.resources.XMLResource.create():468 - No such node:
> //create-windows-installer.html (Repository: Repository: ID =
> yanel-website, Configuration-File = null, Name = Yanel Website Repository)
> org.wyona.yarep.core.NoSuchNodeException: No such node:
> //create-windows-installer.html (Repository: Repository: ID =
> yanel-website, Configuration-File = null, Name = Yanel Website Repository)
> at
> org.wyona.yarep.impl.repo.fs.FileSystemRepository.getNode(FileSystemRepository.java:261)
>
> at
> org.wyona.yanel.impl.resources.XMLResource.create(XMLResource.java:445)
>
> In the case of the old implementation the getOutput ... just created a
> node automatically if it didn't exist, but in the case of the new
> implementation getNode will throw an exception, but how can on create a
> new Node, because I cannot find any create method within the Repository
> API?
The method is part of the Node interface and it's called addNode(...)
This means you have to get the parent node first and then call
addNode(...) too add a child node.
Do you think it should be renamed? (In JCR it's called addNode also.)
hth,
Josias
>
> Thanks
>
> Michi
>
More information about the Yanel-development
mailing list