• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java NodeModel类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中freemarker.ext.dom.NodeModel的典型用法代码示例。如果您正苦于以下问题:Java NodeModel类的具体用法?Java NodeModel怎么用?Java NodeModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



NodeModel类属于freemarker.ext.dom包,在下文中一共展示了NodeModel类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getXmlNodeModel

import freemarker.ext.dom.NodeModel; //导入依赖的package包/类
/**
 * @return FreeMarker NodeModel for the XML content of this node, or null if no parsable XML found
 */
public NodeModel getXmlNodeModel()
{
    try
    {
        return NodeModel.parse(new InputSource(new StringReader(getContent())));
    }
    catch (Throwable err)
    {
        if (logger.isDebugEnabled())
            logger.debug(err.getMessage(), err);
        
        return null;
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:18,代码来源:TemplateNode.java


示例2: processWfsEntity

import freemarker.ext.dom.NodeModel; //导入依赖的package包/类
public static String processWfsEntity(String entityName, Node domNode, String templatePath) throws TemplateException, FileNotFoundException, IOException, URISyntaxException {
    String result = null;
    NodeModel nodeModel = NodeModel.wrap(domNode);
    Map<String, Object> ctx = FastMap.newInstance();
    ctx.put("doc", nodeModel);
    ctx.put("entityName", entityName);
    StringWriter outWriter = new StringWriter();
    Template template = getDocTemplate(templatePath);
    template.process(ctx, outWriter);
    outWriter.close();
    result = outWriter.toString();
    return result;
}
 
开发者ID:gildaslemoal,项目名称:elpi,代码行数:14,代码来源:WfsEventHandler.java


示例3: getRootNode

import freemarker.ext.dom.NodeModel; //导入依赖的package包/类
private Node getRootNode(NodeModel model) {
    NodeList list = model.getNode().getChildNodes();
    for (int i=0; i<list.getLength(); i++) {
        Node n = list.item(i);
        if (n instanceof Element) {
            return n;
        }
    }
    throw new IllegalStateException("Can't find root node!");
}
 
开发者ID:betfair,项目名称:cougar,代码行数:11,代码来源:IDLReader.java


示例4: init

import freemarker.ext.dom.NodeModel; //导入依赖的package包/类
public void init(
        Document iddDoc,
        Document extensionDoc,
        final String service,
        String packageName,
        final String basedir,
        final String genSrcDir,
        final Log log,
        final String outputDir,
        boolean client,
        boolean server)
        throws Exception {

    try {
        output = new File(basedir, genSrcDir);
        if (outputDir != null) {
            iDDOutputDir = new File(basedir+"/"+outputDir);
            if (!iDDOutputDir.exists()) {
                if (!iDDOutputDir.mkdirs()) {
                    throw new IllegalArgumentException("IDD Output Directory "+iDDOutputDir+" could not be created");
                }
            }
            if (!iDDOutputDir.isDirectory() || (!iDDOutputDir.canWrite())) {
                throw new IllegalArgumentException("IDD Output Directory "+iDDOutputDir+" is not a directory or cannot be written to.");
            }
        }
        config = new Configuration();
        config.setClassForTemplateLoading(IDLReader.class, "/templates");

        config.setStrictSyntaxMode(true);
        this.log = log;
        this.packageName = packageName;
        this.service = service;
        this.client = client;
        this.server = server || !client; // server must be true if client if false.

        dataModel = NodeModel.wrap(iddDoc.cloneNode(true));

        if (extensionDoc != null) {
            NodeModel extensionModel = NodeModel.wrap(extensionDoc);
            mergeExtensionsIntoDocument(getRootNode(dataModel),
                    getRootNode(extensionModel));
            removeUndefinedOperations(getRootNode(dataModel),
                    getRootNode(extensionModel));
        }
        if(log.isDebugEnabled()) {
            log.debug(serialize());
        }
    } catch (final Exception e) {
        log.error("Failed to initialise FTL", e);
        throw e;
    }
}
 
开发者ID:betfair,项目名称:cougar,代码行数:54,代码来源:IDLReader.java


示例5: writeTemplate

import freemarker.ext.dom.NodeModel; //导入依赖的package包/类
private void writeTemplate(final Transformation trans, final NodeModel topLevelDoc, final NodeModel data, final String paramName, final List<NodeModel> paramNodes, final String pkg, final String serviceName, final String majorVersion, final String majorMinorVersion, String name, String dirName)
        throws Exception {
    log.debug(trans.toString());
    String nsVersion = majorVersion;
    String namespace = "http://www.betfair.com/servicetypes/"+nsVersion+"/"+serviceName+"/";
    final Map<String, Object> root = new HashMap<String, Object>();
    root.put("interface", topLevelDoc);
    root.put("doc", data);
    root.put("package", pkg.replaceAll("/", "\\."));
    root.put("majorVersion", majorVersion);
    root.put("majorMinorVersion", majorMinorVersion);
    root.put("name", name);
    root.put("namespace", namespace);
    if (paramName != null) {
        if (paramNodes.size() == 1) {
            root.put(paramName, paramNodes.get(0));
        }
        else {
            root.put(paramName, paramNodes);
        }
    }


    final File outputDirectory = new File(output, dirName);
    name = name.trim();
    name = capFirst(name);
    final String fileName = trans.getFileName().replace("${name}", name);
    final String className = fileName.replace(".java", "");
    File outputFile = new File(outputDirectory, fileName);
    FileWriter fw = new FileWriter(outputFile);
    root.put("className", className);

    log.debug("Writing " + name + " using template " + trans.getTemplate() + " to file " + outputFile);
    try {
        // First thing is to deal with the service
        final Template template = config.getTemplate(trans.getTemplate());
        template.process(root, fw);
    } finally {
        fw.close();
        //write the jaxb.index file
        if(trans.isJaxb()) {
            outputFile = new File(outputDirectory, "jaxb.index");
            fw = new FileWriter(outputFile,true);
            fw.append(className).append("\n");
            fw.close();
            outputFile = new File(outputDirectory, "package-info.java");
            fw = new FileWriter(outputFile);
            fw.write("@javax.xml.bind.annotation.XmlAccessorOrder(javax.xml.bind.annotation.XmlAccessOrder.UNDEFINED)\n");
            fw.write("@javax.xml.bind.annotation.XmlSchema(namespace=\""+namespace+"\",elementFormDefault=javax.xml.bind.annotation.XmlNsForm.QUALIFIED)\n");
            fw.write("package "+dirName.replaceAll("/", ".")+";");
            fw.close();
        }
    }
}
 
开发者ID:betfair,项目名称:cougar,代码行数:55,代码来源:IDLReader.java



注:本文中的freemarker.ext.dom.NodeModel类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java BlockGravel类代码示例发布时间:2022-05-23
下一篇:
Java TermFilterBuilder类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap