我使用Apache Velocity生成XML文件,通常使用#if块,如下所示:
<tag>
<subtag>content</subtag>
#if(a)
<subtag attribute="value">content_a</subtag>
#end
</tag>然后使用XSD对生成的XML进行验证。有没有可能在Velocity中做类似的验证?不幸的是,我找不到任何东西。
如果没有,有没有类似XML的语言可以做类似Velocity的事情呢?
任何意见都会很棒,谢谢!
发布于 2014-06-03 00:14:04
如果你对速度模板验证感兴趣,你最好按照马库斯的建议访问post Apache Velocity: Is there a standard way of verifying the correctness of a template from the command line?。
如果您正在寻找一种类似于Velocity的工具,它可以接受XML语法,那么您可以看看FreeMarker。
https://stackoverflow.com/questions/23998167
复制相似问题