FMPP新闻生成(一)

FMPP新闻生成(一)

frontPage
http://fmpp.sourceforge.net/

file
fmpp_0.9.13.tar.gz

extract the downloaded archive file into the directory where you prefer
to store FMPP
extract [iksˈtrækt] vt 提取
archive [ˈɑ:kaiv] n 档案文件

command: tar zxvf fmpp_0.9.13.tar.gz
command: mv fmpp_0.9.13 /usr/local/

You may want to create a soft link in a directory that is in the common PATH
ln -s /usr/local/fmpp_0.9.13/bin/fmpp /bin/fmpp

commnd: fmpp
output follow:
Typical usages:
   fmpp -C configfile
   fmpp -S sourcedir -O outputdir
   fmpp sourcefile -o outputfile
  
For more help: fmpp -h
For even more help: fmpp --long-help

通过XML生成POJO的小例子
在/usr/tmp下新建测试目录test
新建XML文件/usr/tmp/test/src/data/po.xml
<po className="Test">
<column javatype="private" type="String" name="userName" >
</column>
<column javatype="private" type="Integer" name="password" >
</column>
</po>
新建模板文件/usr/tmp/test/src/Po.java

public class ${doc.po.@className}{

<#list doc.po.column as co>

${co.@javatype} ${co.@type} ${co.@name} ;

${co.@javatype} void set${co.@name?cap_first}(${co.@type} ${co.@name}) {
    this.${co.@name}=${co.@name};
}
${co.@javatype} ${co.@type} get${co.@name?cap_first}() {
    return this.${co.@name};
}
</#list>
配置文件
/usr/tmp/test/config.fmpp
sourceRoot:src
outputRoot:out
logFile: log.fmpp
data: {doc:xml (data/po.xml)}

doc:xml 标明用什么来装在数据

再在test目录下fmpp就行了

你可能感兴趣的:(C++,c,xml,.net,C#)