• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java PrintTraceListener类的典型用法和代码示例

java 1次浏览

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

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

示例1: configureTrace

点赞 3

import org.apache.xalan.trace.PrintTraceListener; //导入依赖的package包/类
public void configureTrace(final Transformer t,
                           final XSLTProcess.TraceConfiguration conf) {
    if (t instanceof TransformerImpl && conf != null) {
        final PrintWriter w = new PrintWriter(conf.getOutputStream(), false);
        final PrintTraceListener tl = new PrintTraceListener(w);
        tl.m_traceElements = conf.getElements();
        tl.m_traceExtension = conf.getExtension();
        tl.m_traceGeneration = conf.getGeneration();
        tl.m_traceSelection = conf.getSelection();
        tl.m_traceTemplates = conf.getTemplates();
        try {
            ((TransformerImpl) t).getTraceManager().addTraceListener(tl);
        } catch (final TooManyListenersException tml) {
            throw new BuildException(tml);
        }
    }
}
 

开发者ID:apache,
项目名称:ant,
代码行数:18,
代码来源:Xalan2TraceSupport.java

示例2: style

点赞 2

import org.apache.xalan.trace.PrintTraceListener; //导入依赖的package包/类
/**
    * Transform the input file into the output file by applying the
    * transformation the styler represents.
    *
    * @param params parameters for the transform
    * @param inFileName the name of the input file
    * @param outFileName the name of the output file
    * @throws FileNotFoundException <<Description>>
    * @throws IOException <<Description>>
    * @throws ParserConfigurationException <<Description>>
    * @throws SAXException <<Description>>
    * @throws TransformerConfigurationException <<Description>>
    * @throws TransformerException <<Description>>
    */
   protected void style(Map params, String inFileName, String outFileName)
       throws TransformerConfigurationException,
              SAXException,
              FileNotFoundException,
              IOException,
              TransformerException,
              ParserConfigurationException {

if (logCat.isDebugEnabled())
    logCat.debug("style(" +
		 inFileName +
		 ", " +
		 outFileName +
		 ")");

	Transformer transformer =
    templates.newTransformer();

transformer.setURIResolver(resolver);

for (Iterator it = params.entrySet().iterator(); it.hasNext();) {
    Map.Entry ent = (Map.Entry)it.next();
    transformer.setParameter((String)ent.getKey(), ent.getValue());
}

XMLReader xmlRdr = XMLReaderFactory.createXMLReader();
xmlRdr.setEntityResolver(resolver);

File inputFile = new File(inFileName);
InputSource in = new InputSource(new FileInputStream(inputFile));
SAXSource saxSrc = new SAXSource(xmlRdr, in);
saxSrc.setSystemId(inputFile.getCanonicalPath()) ;

StreamResult outResult =
    new StreamResult(new FileOutputStream(outFileName));

// ### Temp
try {
    PrintTraceListener ptl =
	new PrintTraceListener(new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))));
    ptl.m_traceTemplates = true;
    ptl.m_traceElements = true;
    ptl.m_traceGeneration = true;
    ptl.m_traceSelection = true;
    //((TransformerImpl)transformer).getTraceManager().addTraceListener(ptl);
    ((TransformerImpl)transformer).getTraceManager().addTraceListener(this);
    if (logCat.isDebugEnabled())
           logCat.debug("style(...) TransformerImpl.S_DEBUG .... S_DEBUG no longer exists (markw)");
} catch (TooManyListenersException tmle) {
    logCat.error("TooManyListenersException", tmle);
}
transformer.transform(saxSrc, outResult);
   }
 

开发者ID:mwatts15,
项目名称:XSLTXT,
代码行数:68,
代码来源:Styler.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)