On Wednesday, February 19, 2003, at 04:48 AM, Konstantin Priblouda wrote:
--- "Holbrook, R Cody (Cody)" <[EMAIL PROTECTED]> wrote:
Hello all,
Here's what I'd like to do.  I want to make some of
my own tags, like @mytag.  After that, I want to be
able to comment with these tags such that when I
build, the tags don't cause trouble with javadoc and
the comments using the tags I made are collected and
generated in html.  From what I can tell, webworks
takes on most of that work for you.

What it comes down to is I don't know what files I
have to make myself, what files are generated, and
what steps I should be taking.  I really need to be
stepped through because I'm failing miserably!
Hmm, writiung support for your own tags in current
xdoclet version is in no way trivial. Though not
impossible.
It's not nearly as difficult as Konstantin makes it sound :)

In fact, I'm doing a simplified version of my strutsgen tool (JSP generator) which works entirely with the builtin tags and the <template> subtask (this is for an upcoming article I'm writing). Here's a glimpse of what its doing.

I want to generate properties files (name=value) from Struts form beans. Here's the template:

# <XDtClass:fullClassName/>
<XDtClass:className/>.pageTitle=<XDtClass:className/>
<XDtMethod:forAllMethods>
<XDtMethod:ifIsSetter>
<XDtClass:className/>.<XDtMethod:propertyName/ >=<XDtMethod:propertyName/>
</XDtMethod:ifIsSetter>
</XDtMethod:forAllMethods>

looks, ugly, right? It generates this:

# example.struts.ExampleForm
ExampleForm.pageTitle=ExampleForm
ExampleForm.firstName=firstName
ExampleForm.lastName=lastName

from this:

package example.struts;
import org.apache.struts.action.ActionForm;
public class ExampleForm extends ActionForm {
private String firstName;
private String lastName;

public String getFirstName() {
return firstName;
}

public void setFirstName(String firstName) {
this.firstName = firstName;
}

public String getLastName() {
return lastName;
}

public void setLastName(String lastName) {
this.lastName = lastName;
}
}

And all it took to make that happen was this:

<taskdef name="xdoclet"
classname="xdoclet.DocletTask">
<classpath>
<path refid="xdoclet.classpath"/>
</classpath>
</taskdef>

<mkdir dir="${build.dir}/gen"/>

<xdoclet destdir="${build.dir}/gen"
force="${xdoclet.force}">
<fileset dir="src/web"
includes="**/${form.name}.java"
/>
<template templateFile="templates/simple/FormKeys.xdt"
ofType="org.apache.struts.action.ActionForm"
acceptAbstractClasses="false"
prefixWithPackageStructure="false"
destinationFile="{0}.properties"
/>
</xdoclet>

So, you can probably get most of the way there with this simple example and using the built-in templates for examples along with the template documentation here:

http://xdoclet.sourceforge.net/templates/index.html

Dig in and give it a shot and just ask on this list if you run into any issues.

Erik



-------------------------------------------------------
This SF.net email is sponsored by: SlickEdit Inc. Develop an edge.
The most comprehensive and flexible code editor you can use.
Code faster. C/C++, C#, Java, HTML, XML, many more. FREE 30-Day Trial.
www.slickedit.com/sourceforge
_______________________________________________
xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user

Reply via email to