[EMAIL PROTECTED] schrieb:
The "doctype" is decided in {pub}/parameter-doctype.xmap
Rewrite the relevant portion in Java.
In English, the default pub uses:

if identifier = "/index.html", doctype = "homepage"
docNameSpace = [use code from SourceTypeAction]
if docNameSpace = "http://www.w3.org/1999/xhtml";, doctype = "xhtml"
if docNameSpace = "http://apache.org/lenya/pubs/default/1.0";, doctype = "links"

The code for SourceTypeAction and related classes is at:
http://svn.apache.org/viewvc/forrest/trunk/main/java/org/apache/forrest/sourcetype/

The disadvantage is this code reduces maintainability, meaning
additional work is required when changing the doctypes.  No worries if
the export will only be run once. I would add a comment in
parameter-doctype.xmap about the additional work so nobody adds a
doctype in the next decade and breaks the export function.

Alternatively, you can just replace the matchers in parameter-doctype.xmap with an action that uses the code solprovider describes. So you don't have the problem of knowledge duplication. But this requires a bit more work.

BTW, in 2.0 there's a Document.getResourceType() method, and the resource type name is stored in the meta data. The resolving mechanism (URIParameterizer) of 1.2 is really quite impractical for using in Java code.

-- Andreas


Have you defined custom doctypes?  You might use "xhtml" for all
documents, then handle the homepage separately. Or you might create
easier rules than the default system e.g. documents in the "products"
directory are doctype="product".

solprovider

On 3/6/08, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
I'm using lenya 1.2.4

We are re-writing the default export class: staticHTMLExport.java

The goal is to have an entire publication's pages statically exported with
the push of one button.  In doing so we also need to get the document type
of each document we are statically exporting (for a variety of reasons).

 So from the within the java code, is there a way to get/construct the
document type.  Creating a pub and then creating the document doesn't give
us the document type.  It's simply not a property or method of a document:

http://lenya.apache.org/apidocs/1.2/org/apache/lenya/cms/publication/Document.html

Since all the URL's of the pub are fired from within the java class, we
don't have a page envelope for any given document, and are currently trying
to construct one, but need a cocoon Object Model in order to do so, as in:

http://lenya.apache.org/apidocs/1.2/org/apache/lenya/cms/publication/PageEnvelope.html

It seems like there should be a better way to do this rather than
reconstruct the entire cocoon environment for each document we wish to
export.

Cheers,
-doug


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

Reply via email to