当前位置: 首页>>代码示例>>Java>>正文


Java XSLTTraceListener类代码示例

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


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

示例1: getTraceListenerInternal

import net.sf.saxon.trace.XSLTTraceListener; //导入依赖的package包/类
@Override
protected TraceListener getTraceListenerInternal(TraceType traceType) {
  if (traceType.equals(TraceType.BASIC))
    return new XSLTTraceListener();
  else if (traceType.equals(TraceType.TIMING))
    return new XSLWebTimingTraceListener(webApp);
  return null;
}
 
开发者ID:Armatiek,项目名称:xslweb,代码行数:9,代码来源:TransformerStep.java

示例2: applySchematronValidation

import net.sf.saxon.trace.XSLTTraceListener; //导入依赖的package包/类
@Nullable
public final Document applySchematronValidation (@Nonnull final Node aXMLNode,
                                                 @Nullable final String sBaseURI) throws TransformerException
{
  ValueEnforcer.notNull (aXMLNode, "XMLNode");

  final ISchematronXSLTBasedProvider aXSLTProvider = getXSLTProvider ();
  if (aXSLTProvider == null || !aXSLTProvider.isValidSchematron ())
  {
    // We cannot progress because of invalid Schematron
    return null;
  }

  // Debug print the created XSLT document
  if (SchematronDebug.isShowCreatedXSLT ())
    s_aLogger.info ("Created XSLT document: " + XMLWriter.getNodeAsString (aXSLTProvider.getXSLTDocument ()));

  // Create result document
  final Document ret = XMLFactory.newDocument ();

  // Create the transformer object from the templates specified in the
  // constructor
  final Transformer aTransformer = aXSLTProvider.getXSLTTransformer ();

  // Apply customizations
  // Ensure an error listener is present
  if (m_aCustomErrorListener != null)
    aTransformer.setErrorListener (m_aCustomErrorListener);
  else
    aTransformer.setErrorListener (new LoggingTransformErrorListener (Locale.US));

  // Set the optional URI Resolver
  if (m_aCustomURIResolver != null)
    aTransformer.setURIResolver (m_aCustomURIResolver);

  // Set all custom parameters
  if (m_aCustomParameters != null)
    for (final Map.Entry <String, ?> aEntry : m_aCustomParameters.entrySet ())
      aTransformer.setParameter (aEntry.getKey (), aEntry.getValue ());

  if (s_aLogger.isDebugEnabled ())
    s_aLogger.debug ("Applying Schematron XSLT on XML [start]");

  // Enable this for hardcore Saxon debugging only
  if (false)
    if (aTransformer.getClass ().getName ().equals ("net.sf.saxon.jaxp.TransformerImpl"))
    {
      final XsltTransformer aXT = ((TransformerImpl) aTransformer).getUnderlyingXsltTransformer ();

      aXT.setMessageListener ( (a, b, c) -> s_aLogger.info ("MessageListener: " + a + ", " + b + ", " + c));
      aXT.setTraceFunctionDestination (new StandardLogger (System.err));
      if (false)
        aXT.getUnderlyingController ().setTraceListener (new XSLTTraceListener ());
      if (false)
      {
        final XSLTTraceListener aTL = new XSLTTraceListener ();
        aTL.setOutputDestination (new StandardLogger (System.err));
        aXT.getUnderlyingController ().setTraceListener (TraceEventMulticaster.add (aTL, null));
      }

      if (false)
        System.out.println ("mode=" + aXT.getInitialMode ());
      if (false)
        System.out.println ("temp=" + aXT.getInitialTemplate ());
      if (false)
        System.out.println (aTransformer.getOutputProperties ());
    }

  // Do the main transformation
  aTransformer.transform (new DOMSource (aXMLNode), new DOMResult (ret));

  if (s_aLogger.isDebugEnabled ())
    s_aLogger.debug ("Applying Schematron XSLT on XML [end]");

  // Debug print the created SVRL document
  if (SchematronDebug.isShowCreatedSVRL ())
    s_aLogger.info ("Created SVRL:\n" + XMLWriter.getNodeAsString (ret));

  return ret;
}
 
开发者ID:phax,项目名称:ph-schematron,代码行数:81,代码来源:AbstractSchematronXSLTBasedResource.java


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