Hi André,
somehow your mail ended up formatted in a strange way; I'll try to keep
some quotes nevertheless …
Florent André schrieb:
[…]
For now, I would like to define the content of my new doc... I try
something (mark with --------------- ) that do this :
- remove the default content of the resource but
- don't write the content I want in the document
So what exactly goes wrong? Do you end up with an empty document? Or
does it throw an exception?
This is the code I write :
[…]
//create the document test content
DocumentBuilderFactory fabrique =
DocumentBuilderFactory.newInstance();
DocumentBuilder constructeur = fabrique.newDocumentBuilder();
org.w3c.dom.Document xmlDoc = constructeur.newDocument();
// DOM properties
xmlDoc.setXmlVersion("1.0");
xmlDoc.setXmlStandalone(true);
Element root = xmlDoc.createElement("html");
This won't be a valid XHTML document because the namespace is missing.
You could for instance use the NamespaceHelper that ships with Lenya and
with the XHTML namespace (http://www.w3.org/1999/xhtml).
[…]
//Write the dom content in the lenya Document
org.apache.lenya.cms.cocoon.source.SourceUtil.writeDOM(xmlDoc,
doc.getOutputStream());
Actually this looks good – maybe you could use a debugger, e.g. in
Eclipse, to see what's wrong? At a first glance I can't spot a problem …
//Start site management ?? this code is usefull if I use the document
manager ??
Since you have already passed the path to the DocumentManager, you don't
have to add the document to the site structure anymore.
Sorry I couldn't help. My guess is that the issue is related to the XML
document you build. Maybe it works better with the DocumentHelper and
NamespaceHelper classes from the org.apache.lenya.xml package.
-- Andreas
--
Andreas Hartmann, CTO
BeCompany GmbH
http://www.becompany.ch
Tel.: +41 (0) 43 818 57 01
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]