fmpp-open Mailing List for FMPP: FreeMarker-based File PreProcessor (Page 6)
Brought to you by:
ddekany
You can subscribe to this list here.
| 2003 |
Jan
|
Feb
|
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
(23) |
Aug
(4) |
Sep
(11) |
Oct
(7) |
Nov
|
Dec
(2) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(3) |
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
(5) |
Jul
|
Aug
|
Sep
(2) |
Oct
(9) |
Nov
(2) |
Dec
|
| 2005 |
Jan
(2) |
Feb
(9) |
Mar
|
Apr
(1) |
May
|
Jun
(11) |
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
| 2006 |
Jan
(2) |
Feb
(14) |
Mar
(4) |
Apr
|
May
(6) |
Jun
(7) |
Jul
(7) |
Aug
|
Sep
(4) |
Oct
|
Nov
|
Dec
|
| 2007 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
| 2009 |
Jan
(2) |
Feb
(2) |
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(10) |
Nov
|
Dec
(3) |
| 2010 |
Jan
(9) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(2) |
Aug
(2) |
Sep
|
Oct
(2) |
Nov
|
Dec
|
| 2012 |
Jan
|
Feb
|
Mar
|
Apr
(2) |
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2014 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
|
From: Daniel D. <dd...@fr...> - 2004-06-03 13:43:21
|
Thursday, June 3, 2004, 3:38:52 PM, Asad Niazi wrote: > hello! > I needed your help regarding the pphash "set". > It is mentioned that we can change the values present in a writable Hash > with this command. Now it seems to work for the case when we want to change > the value of the first hierarchical element. Let me give u an example and > explain the problem. I have stored an element (which itself is a hash) from > XML file into a writable hash using this pphash "set". > > <pp.set hash=Hash key="Syntax" value=node.syntax /> > > The structure of this "syntax" element (from node) in the XML file looks > like : > > <syntax> > <typedef basetype="Enumeration"> > <namednumber name="sonet" number="1"/> > <namednumber name="sdh" number="2"/> > </typedef> > </syntax> > > As you can see that there are a few attributes present. Now I want to change > the values of these attributes. I have tried giving different values in the > "key" parameter e.g. key="Hash.Syntax.typdef.@basetype" > and giving the value that i want, in the value parameter, but it doesnt > work. When i print the value using the "pp.warning", it gives the original > values that were stored when i used the first set command to save the > node.syntax. I doesn't dies with error, just silently does nothing? > I am really getting desperate regarding this problem, i know there is a way > to change the values but i cannot seem to figure out how. > I would really appreciate if you can email me the solution to this problem. > Thanking in Anticipation. I'm afraid I have bad news... Set operations only work on "writable hashes" and "writable sequences". "writable sequences" and "writable hashes" are the variables that you made with pp.newWritableSequence and newWritableHash. (Now that I read back pphash.html#sect43, it could be explained more understandably...). The reason of this is that FreeMarker sequence and hash type is read-only. So, for an arbitrary variable that implements the hash and/or sequence type (which are, technically, FreeMarker specific Java interfaces), there is no way to modify it. What to do then? You should not *need* to modify loaded data, at least not in the templates. From the viewpoint of a template, the loaded data represent the content of an abstract data source, so in principle it doesn't make sense to change it. The data is a "fact", graved into stone. Then the template can work on displaying it. I know it's such a academical bullshit, but the MVC-ish approach of FreeMarker suggest this, so if you try to break the base approach of a tool, you will most certainly run into problems. (The writable hashes/sequences were added to create complex temporary variables (work variables) that you use during template execution.) So if you look at the solvable problem with MVC-ish eyes, maybe you were choose a different logic for the project, where simply it never occurs to you to modify the XML... maybe... Say, it can be a good idea to push complex calculations to the data loader (i.e., mostly, write BSH scripts to prepare the data to display), rather than trying to solve them in templates, since templates are for displaying something data and not for calculating data. > Best Regards > Asadullah Khan Niazi -- Best regards, Daniel Dekany |
|
From: Asad N. <noo...@ho...> - 2004-06-03 13:39:44
|
hello!
I needed your help regarding the pphash "set".
It is mentioned that we can change the values present in a writable Hash
with this command. Now it seems to work for the case when we want to change
the value of the first hierarchical element. Let me give u an example and
explain the problem. I have stored an element (which itself is a hash) from
XML file into a writable hash using this pphash "set".
<pp.set hash=Hash key="Syntax" value=node.syntax />
The structure of this "syntax" element (from node) in the XML file looks
like :
<syntax>
<typedef basetype="Enumeration">
<namednumber name="sonet" number="1"/>
<namednumber name="sdh" number="2"/>
</typedef>
</syntax>
As you can see that there are a few attributes present. Now I want to change
the values of these attributes. I have tried giving different values in the
"key" parameter e.g. key="Hash.Syntax.typdef.@basetype"
and giving the value that i want, in the value parameter, but it doesnt
work. When i print the value using the "pp.warning", it gives the original
values that were stored when i used the first set command to save the
node.syntax.
I am really getting desperate regarding this problem, i know there is a way
to change the values but i cannot seem to figure out how.
I would really appreciate if you can email me the solution to this problem.
Thanking in Anticipation.
Best Regards
Asadullah Khan Niazi
_________________________________________________________________
Protect your PC - get McAfee.com VirusScan Online
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
|
|
From: Daniel D. <dd...@fr...> - 2004-03-01 20:17:06
|
FMPP 0.9.7 is released Direct download: http://prdownloads.sourceforge.net/fmpp/fmpp_0.9.7.tar.gz New features, improvements: * New setting: "freemarkerLinks". This is a dirty hack to satisfy a frequent demand: <#include ...>/<#import ...> files that are outside the source root directory (as FTL macro libraries used by more projects). * Later nightly FreeMarker 2.3 build is included. Bugfixes: * Warning! Incompatible change! From now, native separators (as backslash under Windows) are not tolerated in the paths used in <#import ...> and <#include ...> directives. You must use / there. * Fixes in the Manual and in the the API JavaDocs. -- Best regards, Daniel Dekany |
|
From: Daniel D. <dd...@fr...> - 2004-01-20 20:39:29
|
FMPP 0.9.6 is released! Download: http://prdownloads.sourceforge.net/fmpp/fmpp_0.9.6.tar.gz New features, improvements: * New processing mode: renderXml. When a source file is processed in this mode, it's parsed as XML, and then the parsed XML document is rendered to output file(s) by a FreeMarker template, which is chosen based on the path or the document element of the XML document. . New setting: xmlRenderings . New pp variable: pp.doc . Java API: New class: fmpp.XmlRenderingConfiguration. New fmpp.Engine.PMODE_... constant: PMODE_RENDER_XML. New Engine methods to add/clean XML rendering configurations. * When template execution dies with error, and it didn't generated any output yet, nor it flushed the output explicitly or by changing output file, then no 0 length output file will be generated. * New target in the build.xml, "qinstall". It's the same as "install", but assumes "y" for all questions. * Added figures to the Quick Tour chapter. * Java API: Added a new utility method to Engine: static String getProgressListenerEventName(int event) -- Best regards, Daniel Dekany |
|
From: Daniel D. <dd...@fr...> - 2004-01-13 23:04:06
|
FMPP 0.9.5 is released! Download: http://prdownloads.sourceforge.net/fmpp/fmpp_0.9.5.tar.gz New features, improvements: * Java API: Improvements to the Settings class: . The API of this class is now as stable as other FMPP API-s, so it is not marked as experimental anymore. . The execute(Engine) method is now deprecated, and will be soon removed. Use execute() instead. If you use Settings, then don't create Engine objects manually anymore, just use the Settings object alone. (See the FMPP Manual for an example.) . Methods have been added to deal with progress listeners and engine attributes. * Java API: some convenience methods has been added: Settings.set(String, boolean), Settings.set(String, int), Settings.setDefault(String, boolean), Settings.setDefault(String, int), Engine.isXmlSupportAvailable(), TddHashLocalDataLoader(String) * More API documentation. * More reliable and helpful install Ant target. * Terminology change: To prevent confusion, the settings of the fmpp.Engine object (known be people who use FMPP at Java API level) are now called "engine parameters", as the "settings" term is already used since version 0.9.0 for the high level settings seen by usual front-end users. * Many grammatical mistakes have been fixed in the documentation. Other minor improvements in the Manual. Bugfixes: * A later nightly FreeMarker 2.3 build is included, that fixes various bugs with XML related keys @@markup, @@nested_markup, @@start_tag, and @@attributes_markup. This is mostly important for people who uses data of XHTML format for generating (X)HTML pages. -- Best regards, Daniel Dekany |
|
From: Daniel D. <dd...@fr...> - 2004-01-02 22:43:40
|
FMPP 0.9.4 is released. Download: http://prdownloads.sourceforge.net/fmpp/fmpp_0.9.4.tar.gz New features, improvements: * New setting: "localData" . Till now, all source files (all templates) have started with the same data model, the one you have specified with setting "data". With the new "localData" setting you can add variables to, and override the variables of the common data model, for groups of source files selected by path patterns. . This feature also let you attach a BeanShell script to a template, that can done some complex calculations before template execution, and put the results into the data model for the individual template. . Setting "templateData" is now deprecated. . Java API changes: New interface fmpp.LocalDataBuilder, deprecates fmpp.TemplateDataModelBuilder. * Setting "borders" supports multiple layers. That is, multiple borders can be used at once for the same file. * In <@pp.renameOutputFile ... /> you can use parameter extension instead of name, to change only the extension of the output file. * Java API: TemplateEnvironment has new methods, most importantly static TemplateEnvironment getCurrentInstance() for accessing the current template environment in FreeMarker transforms/methods. * Java API: New methods to Engine: Object getData(name) (returns unwrapped original values), Object removeData(name), cleatData() (deprecates misnamed clearSharedVariables()). * Java API: Engine attribute that implements ProgressListener get notifications about engine events. * Java API: fmpp.tdd.FunctionCall has public constructor now. * Warning! Incompatible Java API change! Engine.getData(...) doesn't throw TemplateModelException anymore, because data wrapping is now deferred until the session execution. * Warning! Incompatible Java API change! Synchronization was removed from Engine. It did the same as if you synchronize on the Engine instance and call the methods anyway... * Warning! Incompatible Java API change! ProgressListener.notifyProgressEvent(...) is now allowed to throw Exception. * More API documentation. Bugfixes: * <@pp.renameOutputFile ... /> has malfunctioned when the buffer was already flushed. * Minor documentation fixes. * 3rd party libraries BeanShell and ORO were upgraded. The upgrades fix a few bugs. * Warning! Incompatible Java API change! Package fmpp.listeners were renamed to fmpp.progresslisteners. * Warning! Incompatible Java API change! Engine.removeAttribue was renamed to Engine.removeAttribute. -- Best regards, Daniel Dekany |
|
From: Ralf H. <ral...@gm...> - 2003-12-22 06:42:24
|
Daniel, Thanks a lot, > -----Original Message----- > From: Daniel Dekany [mailto:dd...@fr...] ... > > As per > > > http://freemarker.org/docs/dgui_template_exp.html#dgui_template_ex > p_direct_s > > tring > > I am trying to create a dollar sign. > > > > if \xA9 is a copyright, \x24 should be dollar, > > > > but how do I make this appear in the output, just including > this in ftl file > > doesn't do? > > <#assign dollar>\xA9</#assign> > > ${dollar} > > ${\xA9} > > > > Any hints would be highly appreciated! > > These escapes work only in string literals. Like in Java Language or C > or Perl, etc. But why do you want to escape $? If you want this in the > output: > > A interpolation looks like this: ${moo} > > then write: > > <#noparse>A interpolation looks like this: ${moo}</#noparse> > > or > > A interpolation looks like this: ${'$'}{moo} > > You almost never have to escape dollar. Also note that dollar in itself > is not reserved in FTL. Only '${'. It is used for a combination of xml and ftl: ${'$'}{${sect.@idS}Tit} as per your suggestion works nicely to produce "${GenQ_SectTit}" since idS="GenQ_Sect", similarly, also <#noparse>$</#noparse>{${sect.@idS}Tit} works, but it is so verbose... Thx Ralf P.S.: my posting yesterday got held up for "moderator approval" have you changed the policy on the forum? |
|
From: Daniel D. <dd...@fr...> - 2003-12-22 03:31:46
|
FMPP 0.9.3 is out! Download: http://prdownloads.sourceforge.net/fmpp/fmpp_0.9.3.tar.gz New features, improvements: * In FreeMarker 2.3: The quotations in FreeMarker error messages are now terser and thus easier to read. * Various really missing XML related features added: . New settings: xmlCatalogFiles, xmlCatalogPrefer. With these settings you can setup the OASIS catalogs that will be used for resolving entities in XML files. (See <FMPP>/docs/examples/xml4) . New option to the xml data loader: validate. This specifies if the XML file will be checked for validity. . New setting: validateXml. This specifies if by default XML files will be checked for validity. . New setting: xpathEngine. With this setting you can set if you want to use Xalan or Jaxen for XPath-s. Bugfixes: * In FreeMarker 2.3: A bug that caused template processing to fail with NullPointerException on low memory conditions is now fixed. A bug in Jaxen XPath support that caused NullPointerException-s has been fixed. Etc. * Warning! Incompatible Java API change! Engine.process doesn't throw sly unchecked fmpp.IllegalConfigurationException-s anymore. Also, fmpp.IllegalConfigurationException is not public from now; it wasn't mentioned in other public API-s anyway. * FMPP has died with internal error if somebody tried to use XML related features, and XML support was not available. * Minor documentation fixes. -- Best regards, Daniel Dekany |
|
From: Leonardo F. <lfr...@si...> - 2003-10-14 13:35:30
|
> BTW, there is a bare-bone Ant task that was specifically made as > FreeMarker "style" task, so its approach may fits better what you want. > But I do not know it too much... It's the Ant task comes with the > FreeMarker distribution. Oh I missed that one! I'm going to try. Thank you! |
|
From: Daniel D. (t. acc!) <dd...@ex...> - 2003-10-14 13:06:59
|
Tuesday, October 14, 2003, 12:11:45 PM, Leonardo Francalanci wrote:
>> A possible solution is that you rather use a single-big XML file, an
>> then iterate over the entries stored in that, but you do it by
>> including the small XML files into the big XML file with XML's
>> <!ENTITY ...> stuff.
>
> Nahhh ;)
>
>> Another solution is to query the names of the available *.xml files
>> with an user defined FreeMarker directive (or load the list of files
>> from some other data source), and then use <@pp.loadData ...> to load
>> an xml file in each loop.
>
> yes ,I can do it
>
>> However, the question arises for me, wether in your case (which I
>> don't exactly know), XML files should act as the source files
>> ("templates", not as data), and there should be an "XML"
>> processing-mode, that uses an FTL template to render the XML...
>> something that FMPP does not support yet.
>
> yes, what I want to do is a kind of replacement of the XSL with FMPP.
> I don't like XSL, and I have a lot of XML data files to transform. I
> think something like that (multiple XML -> multiple outputs given a
> template) should not be tricky to implement, and would be very useful.
You *think* that it is not tricky :), but I guess it will require some
deeper rethink (generalization) of the FMPP architecture (*if* it will
fit into it nicely in any way at all). And, the problem is that
currently I'm in the middle of another serious redesign (regarding TDD
and FMPP configuration files), so... I add this to the TODO file and I
will think about it later.
BTW, there is a bare-bone Ant task that was specifically made as
FreeMarker "style" task, so its approach may fits better what you want.
But I do not know it too much... It's the Ant task comes with the
FreeMarker distribution.
--
Best regards,
Daniel Dekany
|
|
From: Leonardo F. <lfr...@si...> - 2003-10-14 11:15:44
|
I have to create different output files based on the same source file but, differently from the Step 4 on the quick tour, what changes is that I have multiple data sources (multiple xml files). Each xml file has the same schema. How can I get different outputs from different data sources? |
|
From: Daniel D. (t. acc!) <dd...@ex...> - 2003-10-14 11:02:59
|
Tuesday, October 14, 2003, 11:32:22 AM, Leonardo Francalanci wrote:
> I have to create different output files based
> on the same source file but, differently
> from the Step 4 on the quick tour, what
> changes is that I have multiple data sources
> (multiple xml files).
> Each xml file has the same schema.
> How can I get different outputs from different data sources?
It can be viewed as the same as qtour_step4, just the data physically
splits into multiple files. So, in the <#list> loop, now you should
iterate over the xml files, instead of the rows of a csv file. It can be
tricky how to do it, though... A possible solution is that you rather
use a single-big XML file, an then iterate over the entries stored in
that, but you do it by including the small XML files into the big XML
file with XML's <!ENTITY ...> stuff. Another solution is to query the
names of the available *.xml files with an user defined FreeMarker
directive (or load the list of files from some other data source), and
then use <@pp.loadData ...> to load an xml file in each loop.
However, the question arises for me, wether in your case (which I don't exactly
know), XML files should act as the source files ("templates", not as data),
and there should be an "XML" processing-mode, that uses an FTL template to render
the XML... something that FMPP does not support yet.
> (I've already posted to the SourceForge.net Web forum: where is
> the best place to ask for informations?)
See the bottom of http://fmpp.sourceforge.net/. I absolutely prefer the
mailing list... especially for longer discussions. However, you should
be subscribed or you will not receive the answers. :( (I will look into
if this can be changed somehow...)
--
Best regards,
Daniel Dekany
|
|
From: Leonardo F. <lfr...@si...> - 2003-10-14 10:40:53
|
I have to create different output files based on the same source file but, differently from the Step 4 on the quick tour, what changes is that I have multiple data sources (multiple xml files). Each xml file has the same schema. How can I get different outputs from different data sources? (I've already posted to the SourceForge.net Web forum: where is the best place to ask for informations?) |
|
From: Daniel D. (t. acc!) <dd...@ex...> - 2003-10-13 20:59:57
|
Monday, October 13, 2003, 12:29:41 PM, Ralf Hauser wrote:
> a <#macro of mine typically gets parameters of the kind
> pathFileBaseName=xml.site.files.thisFilename.@baseName
> out of
> <#assign xml = pp.loadData("xml", "site.xml")>
>
> if for some reason, the not thisFilename was forgotten in site.xml, I would
> like the macro to print
> what it got in the parameter literally.
>
> However, if I do
> <#if pathFileBaseName?has_content?string = "false">
Off-topic note: the above is a syntactical monster... it should be
simply:
<#if !pathFileBaseName?has_content>
or <#if pathFileBaseName?has_content == false> if you don't like "!"
> <@pp.warning message="pathFileBaseName ${pathFileBaseName} not found
> in \
site.xml" />>
> </#if>
>
> I still get
> [fmpp] Expecting a string, date or number here, Expression
> pathFileBaseName
> is instead a freemarker.ext.dom.NodeListModel
Of course...
> but I would like to see whether this is "thisFilename" or "thisFilename1" or
> "thisFilename2"
> how would one do that?
Er... IMO you can't. The problem is that here you should print the name
of the parent element ("thisFilename"), but since the resulting node-set
is empty, there is no node available that could you navigate backward.
You can't get the parent, as the are no children, so the track was lost.
So you should change the flow of the code a bit:
(Note however that it is actually a FreeMarker question, so feel free to
ask it on the FreeMarker list... not that I expect you get other answer,
but maybe Jonathan (the XML stuff author) has some innovative idea.)
<#local fileInfo = pathFileBaseName=xml.site.files.thisFilename>
<#if !fileInfo?has_content>
<@pp.warning message="Entry for file ${fileInfo?node_name} not
found in site.xml!" />
</#if>
<#local pathFileBaseName = fileInfo.@baseName>
--
Best regards,
Daniel Dekany
|
|
From: Ralf H. <ral...@gm...> - 2003-10-13 10:26:19
|
a <#macro of mine typically gets parameters of the kind
pathFileBaseName=xml.site.files.thisFilename.@baseName
out of
<#assign xml = pp.loadData("xml", "site.xml")>
if for some reason, the not thisFilename was forgotten in site.xml, I would
like the macro to print
what it got in the parameter literally.
However, if I do
<#if pathFileBaseName?has_content?string = "false">
<@pp.warning message="pathFileBaseName ${pathFileBaseName} not found
in \
site.xml" />
</#if>
I still get
[fmpp] Expecting a string, date or number here, Expression
pathFileBaseName
is instead a freemarker.ext.dom.NodeListModel
but I would like to see whether this is "thisFilename" or "thisFilename1" or
"thisFilename2"
how would one do that?
|
|
From: Chris N. <ch...@si...> - 2003-09-27 22:10:45
|
Daniel Dekany wrote:
> Friday, September 26, 2003, 9:53:10 PM, Ralf Hauser wrote:
>> I don't want to extract from jsp files, but from *.java files: class
>> names and private variable names.
>>
>> Do you have any experience with that?
>
> .java file parsing? No. But one possibility is that you compile them to
> classes with Sun's compiler ("javac" if you invoke it from command
> line), and then use CGLIB to examine the resulting .class files. If the
> compilation step is inconvenient, then maybe it is not that hard to
> write a java program that extract these infos from a Java file... I
> mean, it need not be a full-blown Java parser for that, so it is maybe
> not that hard. A third possibility is to find a Java parser. I guess
> there is Java language parser available for parser-generators as ANTLR
> or JavaCC.
If by "private variable names" you mean field names, it is very simple to
extract that info from a .class file using ASM (http://asm.objectweb.org/).
For parsing a Java source file you may want to look at the following
projects, they all some sort of parser you could use as a starting point:
http://qdox.codehaus.org/
http://www.beanshell.org/
http://www.antlr.org/
Chris
|
|
From: Daniel D. <dd...@fr...> - 2003-09-26 21:22:11
|
Friday, September 26, 2003, 9:53:10 PM, Ralf Hauser wrote:
>> -----Original Message-----
>> From: fmp...@li...
>> [mailto:fmp...@li...]On Behalf Of Daniel Dekany
>> (temporary acc!)
>> >> > If there was a way to extract the class and private variable
>> >> > names in a fmpp-able manner, this would be significant efficiency
> gain!
>> > ...
>> >>
>> >> It seems to me that it is a question of data-loader... a key point in
>> >> the FMPP design is that it is easily extendable with data-loaders. ...
>> > isn't quite a little bit more than a data loader? Wouldn't this
>> > be closer to the "javac" parser of *.java files and then tapping some of
> the data
>> > structures this javac builds before it starts compiling?
>>
> ...
>> Now, as of the concrete case, I'm not sure if I understand well what do
>> you want, but maybe parsing JSP files to extract "data" from them? I
>> don't know how to do it (right now)... But, it is not an FMPP topic
>> anyway... :)
> I don't want to extract from jsp files, but from *.java files: class names
> and private variable names.
>
> Do you have any experience with that?
.java file parsing? No. But one possibility is that you compile them to
classes with Sun's compiler ("javac" if you invoke it from command
line), and then use CGLIB to examine the resulting .class files. If the
compilation step is inconvenient, then maybe it is not that hard to
write a java program that extract these infos from a Java file... I
mean, it need not be a full-blown Java parser for that, so it is maybe
not that hard. A third possibility is to find a Java parser. I guess
there is Java language parser available for parser-generators as ANTLR
or JavaCC.
--
Best regards,
Daniel Dekany
|
|
From: Ralf H. <ral...@gm...> - 2003-09-26 19:50:22
|
> -----Original Message----- > From: fmp...@li... > [mailto:fmp...@li...]On Behalf Of Daniel Dekany > (temporary acc!) > >> > If there was a way to extract the class and private variable > >> > names in a fmpp-able manner, this would be significant efficiency gain! > > ... > >> > >> It seems to me that it is a question of data-loader... a key point in > >> the FMPP design is that it is easily extendable with data-loaders. ... > > isn't quite a little bit more than a data loader? Wouldn't this > > be closer to the "javac" parser of *.java files and then tapping some of the data > > structures this javac builds before it starts compiling? > ... > Now, as of the concrete case, I'm not sure if I understand well what do > you want, but maybe parsing JSP files to extract "data" from them? I > don't know how to do it (right now)... But, it is not an FMPP topic > anyway... :) I don't want to extract from jsp files, but from *.java files: class names and private variable names. Do you have any experience with that? |
|
From: Daniel D. (t. acc!) <dd...@ex...> - 2003-09-26 19:20:30
|
Friday, September 26, 2003, 9:09:32 AM, Ralf Hauser wrote: >> -----Original Message----- >> From: fmp...@li... >> [mailto:fmp...@li...]On Behalf Of Daniel Dekany > >> > If there was a way to extract the class and private variable names in a >> > fmpp-able manner, this would be significant efficiency gain! > ... >> >> It seems to me that it is a question of data-loader... a key point in >> the FMPP design is that it is easily extendable with data-loaders. And >> if you develop Struts apps., then probably there are Java programmers >> around, so they can do it. And, of course, I'm happy to publish any >> useful and (more/less) documented data-loader on the FMPP homepage for >> the FMPP users. > isn't quite a little bit more than a data loader? Wouldn't this be closer to > the "javac" parser of *.java files and then tapping some of the data > structures this javac builds before it starts compiling? Well... there is no such that "just a data loader", as a data loader can be arbitrary complex... I meant, if you can extract X data with a Java program, *then* it is easy to create a data loader form it, so the "data source" will be "FMPP-able". Now, as of the concrete case, I'm not sure if I understand well what do you want, but maybe parsing JSP files to extract "data" from them? I don't know how to do it (right now)... But, it is not an FMPP topic anyway... :) -- Best regards, Daniel Dekany |
|
From: Ralf H. <ral...@gm...> - 2003-09-26 07:06:29
|
> -----Original Message----- > From: fmp...@li... > [mailto:fmp...@li...]On Behalf Of Daniel Dekany > > If there was a way to extract the class and private variable names in a > > fmpp-able manner, this would be significant efficiency gain! ... > > It seems to me that it is a question of data-loader... a key point in > the FMPP design is that it is easily extendable with data-loaders. And > if you develop Struts apps., then probably there are Java programmers > around, so they can do it. And, of course, I'm happy to publish any > useful and (more/less) documented data-loader on the FMPP homepage for > the FMPP users. isn't quite a little bit more than a data loader? Wouldn't this be closer to the "javac" parser of *.java files and then tapping some of the data structures this javac builds before it starts compiling? |
|
From: Daniel D. <dd...@fr...> - 2003-09-25 16:47:59
|
Thursday, September 25, 2003, 12:05:53 PM, Ralf Hauser wrote: > Hi, > > In a similar spirit as > http://sourceforge.net/mailarchive/message.php?msg_id=6066563 re exporting > sql field names etc. into an xml for fmpp usage, it would be great if for > all Java Business and Java-Struts-ActionForm classes, the variable names > could be distilled in an ant-able/batchable way into a JavaConstants.ftl > file (possibly via an interim xml step) such that I could create > <#assign jc_UserClassLoginVar="login" /> to use in struts as property of its > <logic:... and <html:... tags. > > This would make the struts views much more manageable: > > If there was a way to extract the class and private variable names in a > fmpp-able manner, this would be significant efficiency gain! > > Anybody on the list has a recommendation, please share! It seems to me that it is a question of data-loader... a key point in the FMPP design is that it is easily extendable with data-loaders. And if you develop Struts apps., then probably there are Java programmers around, so they can do it. And, of course, I'm happy to publish any useful and (more/less) documented data-loader on the FMPP homepage for the FMPP users. -- Best regards, Daniel Dekany |
|
From: Ralf H. <ral...@gm...> - 2003-09-25 10:03:07
|
Hi, In a similar spirit as http://sourceforge.net/mailarchive/message.php?msg_id=6066563 re exporting sql field names etc. into an xml for fmpp usage, it would be great if for all Java Business and Java-Struts-ActionForm classes, the variable names could be distilled in an ant-able/batchable way into a JavaConstants.ftl file (possibly via an interim xml step) such that I could create <#assign jc_UserClassLoginVar="login" /> to use in struts as property of its <logic:... and <html:... tags. This would make the struts views much more manageable: If there was a way to extract the class and private variable names in a fmpp-able manner, this would be significant efficiency gain! Anybody on the list has a recommendation, please share! Regards Ralf P.S.: Shall I post this as RFEs to fmpp and freemarker on sourceforge? |
|
From: Daniel D. <dd...@fr...> - 2003-09-16 21:47:57
|
Tuesday, September 16, 2003, 10:12:49 PM, Ralf Hauser wrote: > Hi, > > As described in http://bugs.mysql.com/1307, just entering field names as > strings into prepared-statements and ResultSet processing is nuisance in > java-relational DB implementations because such errors normally are not > detected at compile time, but only at run-time. > If there was a way to extract the field and table names in a fmpp-able > manner, this would be significant efficiency gain! Yes, however, FMPP has no out-of-the-box DB data loaders (yet!), so you have to invent in Java. That is, you have to write some FMPP data loaders. If you can do it with Java (JDBC), then it's really not hard to wrap that functionality into data loader and/or FreeMarker transform, so it will be fmpp-able. > Anybody on the list has a recommendation, please share! > > Regards > > Ralf > > P.S.: I am using a similar approach with struts with great success: > 1) I use an xml file to maintain my error list. An fmpp script then produces > the ErrorConstants.java with the two (!) error constants per string required > by struts as well as the file that manages the error texts > 2) similarly, I store the strings used both in the *Action.java to store > into the session as well as in the jsp's to retrieve the beans also in an > xml. This xml again is used to create a GUIConstants.java file as well as > gc_const.ftl (since I pre-process all my jsp's with fmpp) I see you are a heavy-weight FMPP user... :) -- Best regards, Daniel Dekany |
|
From: Ralf H. <ral...@gm...> - 2003-09-16 20:10:11
|
Hi, As described in http://bugs.mysql.com/1307, just entering field names as strings into prepared-statements and ResultSet processing is nuisance in java-relational DB implementations because such errors normally are not detected at compile time, but only at run-time. If there was a way to extract the field and table names in a fmpp-able manner, this would be significant efficiency gain! Anybody on the list has a recommendation, please share! Regards Ralf P.S.: I am using a similar approach with struts with great success: 1) I use an xml file to maintain my error list. An fmpp script then produces the ErrorConstants.java with the two (!) error constants per string required by struts as well as the file that manages the error texts 2) similarly, I store the strings used both in the *Action.java to store into the session as well as in the jsp's to retrieve the beans also in an xml. This xml again is used to create a GUIConstants.java file as well as gc_const.ftl (since I pre-process all my jsp's with fmpp) |
|
From: Daniel D. <dd...@fr...> - 2003-09-09 08:52:43
|
Monday, September 8, 2003, 4:02:49 PM, Ralf Hauser wrote: > Hi, > > First I thought I had misspelled <#nested> > (http://sourceforge.net/tracker/index.php?func=detail&aid=802412&group_id=79 > 4&atid=100794), but perhaps I am trying something a little bit too > sophisticated. > Unfortunately, the documentation doesn't give an example for how to do this > (http://www.freemarker.org/docs/ref_directive_macro.html). > > The following attempts all failed: > > <#macro outerMacro> > <@innerMacro param1="<#nested>" /></#macro> > > <@outerMacro>helloWorld</@outerMacro> > > unfortunately results in "<#nested"> instead of helloWorld The documentation does say something about this, just not directly: it should be clean from the syntax description that you can't use directives (not just "nested") in string literals, or inside FTL tags anyway. Well, I will state this more explicitly in dgui_template_overallstructure.html. > other attempts wouldn't even pass fmpp: > <#macro outerMacro> > <@innerMacro param1=<#nested> /></#macro> Yeah, this is syntactically bad, as <#nested> is not a valid expression. > <#macro outerMacro> > <@innerMacro param1=nested /></#macro> This wants to pass the value of variable called "nested", so of course it will not do what you want. > any hints would be highly appreciated! The solution is to call the directive, and capture its output into a string variable, and then use that string as the parameter: <#macro outerMacro> <#local x><#nested></#local> <@innerMacro param1=x /> </#macro> -- Best regards, Daniel Dekany |