本文整理匯總了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;
}
示例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;
}