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


Java TransformerImpl类代码示例

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


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

示例1: annotation

import org.apache.xalan.transformer.TransformerImpl; //导入依赖的package包/类
public static void annotation(XSLProcessorContext ctx, ElemExtensionCall call) throws TransformerException {
	TransformerImpl transformer = ctx.getTransformer();
	XMLReaderContext xrctx = (XMLReaderContext) transformer.getParameter(XML_READER_CONTEXT_PARAMETER);
	int start = getAttributeIntValue(ctx, call, START_ATTRNAME);
	int end = getAttributeIntValue(ctx, call, END_ATTRNAME);
	String layers0 = getAttributeStringValue(ctx, call, "xpath-layers", "layers");
	//System.err.println("a: " + start + "-" + end + " (" + layers0 + ")");
	if (layers0 == null)
		return;
	layers0 = layers0.trim();
	if (layers0.isEmpty())
		return;
	String[] layers = WHITESPACE.split(layers0);
	String ref = getAttributeStringValue(ctx, call, "xpath-ref", "ref");
	xrctx.startAnnotation(start, end, layers, ref);
	transformer.executeChildTemplates(call, false);
	xrctx.endAnnotation();
}
 
开发者ID:Bibliome,项目名称:alvisnlp,代码行数:19,代码来源:XMLReader.java

示例2: addAttributes

import org.apache.xalan.transformer.TransformerImpl; //导入依赖的package包/类
/**
 * Copy DOM attributes to the result element.
 *
 * @param src Source node with the attributes
 *
 * @throws TransformerException
 */
public static void addAttributes(SerializationHandler handler, int src)
    throws TransformerException
{

    TransformerImpl transformer =
        (TransformerImpl) handler.getTransformer();
    DTM dtm = transformer.getXPathContext().getDTM(src);

    for (int node = dtm.getFirstAttribute(src);
        DTM.NULL != node;
        node = dtm.getNextAttribute(node))
    {
        addAttribute(handler, node);
    }
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:23,代码来源:SerializerUtils.java

示例3: execute

import org.apache.xalan.transformer.TransformerImpl; //导入依赖的package包/类
/**
 * Execute the xsl:apply-imports transformation.
 *
 * @param transformer non-null reference to the the current transform-time state.
 *
 * @throws TransformerException
 */
public void execute(
        TransformerImpl transformer)
          throws TransformerException
{

  if (transformer.currentTemplateRuleIsNull())
  {
    transformer.getMsgMgr().error(this,
      XSLTErrorResources.ER_NO_APPLY_IMPORT_IN_FOR_EACH);  //"xsl:apply-imports not allowed in a xsl:for-each");
  }

  int sourceNode = transformer.getXPathContext().getCurrentNode();
  if (DTM.NULL != sourceNode)
  {
    // supply the current templated (matched, not named)        
    ElemTemplate matchTemplate = transformer.getMatchedTemplate();
    transformer.applyTemplateToNode(this, matchTemplate, sourceNode);
  }
  else  // if(null == sourceNode)
  {
    transformer.getMsgMgr().error(this,
      XSLTErrorResources.ER_NULL_SOURCENODE_APPLYIMPORTS);  //"sourceNode is null in xsl:apply-imports!");
  }
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:32,代码来源:ElemApplyImport.java

示例4: executeFallback

import org.apache.xalan.transformer.TransformerImpl; //导入依赖的package包/类
/**
 * Execute the fallback elements.  This must be explicitly called to
 * instantiate the content of an xsl:fallback element.
 * When an XSLT transformer performs fallback for an instruction
 * element, if the instruction element has one or more xsl:fallback
 * children, then the content of each of the xsl:fallback children
 * must be instantiated in sequence; otherwise, an error must
 * be signaled. The content of an xsl:fallback element is a template.
 *
 * @param transformer non-null reference to the the current transform-time state.
 *
 * @throws TransformerException
 */
public void executeFallback(
        TransformerImpl transformer)
          throws TransformerException
{

  int parentElemType = m_parentNode.getXSLToken();
  if (Constants.ELEMNAME_EXTENSIONCALL == parentElemType 
      || Constants.ELEMNAME_UNDEFINED == parentElemType)
  {

    transformer.executeChildTemplates(this, true);

  }
  else
  {

    // Should never happen
    System.out.println(
      "Error!  parent of xsl:fallback must be an extension or unknown element!");
  }
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:35,代码来源:ElemFallback.java

示例5: XUnresolvedVariable

import org.apache.xalan.transformer.TransformerImpl; //导入依赖的package包/类
/**
 * Create an XUnresolvedVariable, that may be executed at a later time.
 * This is primarily used so that forward referencing works with 
 * global variables.  An XUnresolvedVariable is initially pushed 
 * into the global variable stack, and then replaced with the real 
 * thing when it is accessed.
 *
 * @param obj Must be a non-null reference to an ElemVariable.
 * @param sourceNode The node context for execution.
 * @param transformer The transformer execution context.
 * @param varStackPos An index to the point in the variable stack where we should
 * begin variable searches for evaluation of expressions.
 * @param varStackContext An index into the variable stack where the variable context 
 * ends, i.e. at the point we should terminate the search.
 * @param isGlobal true if this is a global variable.
 */
public XUnresolvedVariable(ElemVariable obj, int sourceNode, 
                           TransformerImpl transformer,
                           int varStackPos, int varStackContext,
                           boolean isGlobal)
{
  super(obj);
  m_context = sourceNode;
  m_transformer = transformer;
  
  // For globals, this value will have to be updated once we 
  // have determined how many global variables have been pushed.
  m_varStackPos = varStackPos;
  
  // For globals, this should zero.
  m_varStackContext = varStackContext;
  
  m_isGlobal = isGlobal;
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:35,代码来源:XUnresolvedVariable.java

示例6: execute

import org.apache.xalan.transformer.TransformerImpl; //导入依赖的package包/类
/**
 * Execute the xsl:comment transformation 
 *
 *
 * @param transformer non-null reference to the the current transform-time state.
 *
 * @throws TransformerException
 */
public void execute(
        TransformerImpl transformer)
          throws TransformerException
{
  try
  {
    // Note the content model is:
    // <!ENTITY % instructions "
    // %char-instructions;
    // | xsl:processing-instruction
    // | xsl:comment
    // | xsl:element
    // | xsl:attribute
    // ">
    String data = transformer.transformToString(this);

    transformer.getResultTreeHandler().comment(data);
  }
  catch(org.xml.sax.SAXException se)
  {
    throw new TransformerException(se);
  }
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:32,代码来源:ElemComment.java

示例7: executeFallbacks

import org.apache.xalan.transformer.TransformerImpl; //导入依赖的package包/类
/**
 * Execute the fallbacks when an extension is not available.
 *
 * @param transformer non-null reference to the the current transform-time state.
 *
 * @throws TransformerException
 */
private void executeFallbacks(
        TransformerImpl transformer)
          throws TransformerException
{
  for (ElemTemplateElement child = m_firstChild; child != null;
           child = child.m_nextSibling)
  {
    if (child.getXSLToken() == Constants.ELEMNAME_FALLBACK)
    {
      try
      {
        transformer.pushElemTemplateElement(child);
        ((ElemFallback) child).executeFallback(transformer);
      }
      finally
      {
        transformer.popElemTemplateElement();
      }
    }
  }

}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:30,代码来源:ElemExtensionCall.java

示例8: getAttribute

import org.apache.xalan.transformer.TransformerImpl; //导入依赖的package包/类
/**
 * Return the value of the attribute interpreted as an Attribute
 * Value Template (in other words, you can use curly expressions
 * such as href="http://{website}".
 *
 * @param rawName Raw name of the attribute to get
 * @param sourceNode non-null reference to the <a href="http://www.w3.org/TR/xslt#dt-current-node">current source node</a>.
 * @param transformer non-null reference to the the current transform-time state.
 *
 * @return the value of the attribute
 *
 * @throws TransformerException
 */
public String getAttribute(
        String rawName, org.w3c.dom.Node sourceNode, TransformerImpl transformer)
          throws TransformerException
{

  AVT avt = getLiteralResultAttribute(rawName);

  if ((null != avt) && avt.getRawName().equals(rawName))
  {
    XPathContext xctxt = transformer.getXPathContext();

    return avt.evaluate(xctxt, 
          xctxt.getDTMHandleFromNode(sourceNode), 
          this);
  }

  return null;
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:32,代码来源:ElemExtensionCall.java

示例9: execute

import org.apache.xalan.transformer.TransformerImpl; //导入依赖的package包/类
/**
  * Execute an unknown element.
  * Execute fallback if fallback child exists or do nothing
  *
  * @param transformer non-null reference to the the current transform-time state.
  *
  * @throws TransformerException
  */
 public void execute(TransformerImpl transformer)
           throws TransformerException
 {


try {

	if (hasFallbackChildren()) {
		executeFallbacks(transformer);
	} else {
		// do nothing
	}
	
} catch (TransformerException e) {
	transformer.getErrorListener().fatalError(e);
}
 }
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:26,代码来源:ElemUnknown.java

示例10: executeNSDecls

import org.apache.xalan.transformer.TransformerImpl; //导入依赖的package包/类
/**
 * Send startPrefixMapping events to the result tree handler
 * for all declared prefix mappings in the stylesheet.
 *
 * @param transformer non-null reference to the the current transform-time state.
 * @param ignorePrefix string prefix to not startPrefixMapping
 *
 * @throws TransformerException
 */
void executeNSDecls(TransformerImpl transformer, String ignorePrefix) throws TransformerException
{  
  try
  {
    if (null != m_prefixTable)
    {
      SerializationHandler rhandler = transformer.getResultTreeHandler();
      int n = m_prefixTable.size();

      for (int i = n - 1; i >= 0; i--)
      {
        XMLNSDecl decl = (XMLNSDecl) m_prefixTable.get(i);

        if (!decl.getIsExcluded() && !(null != ignorePrefix && decl.getPrefix().equals(ignorePrefix)))
        {
          rhandler.startPrefixMapping(decl.getPrefix(), decl.getURI(), true);
        }
      }
    }
  }
  catch(org.xml.sax.SAXException se)
  {
    throw new TransformerException(se);
  }
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:35,代码来源:ElemTemplateElement.java

示例11: execute

import org.apache.xalan.transformer.TransformerImpl; //导入依赖的package包/类
/**
 * Execute an xsl:number instruction. The xsl:number element is
 * used to insert a formatted number into the result tree.
 *
 * @param transformer non-null reference to the the current transform-time state.
 *
 * @throws TransformerException
 */
public void execute(
        TransformerImpl transformer)
          throws TransformerException
{

  int sourceNode = transformer.getXPathContext().getCurrentNode();
  String countString = getCountString(transformer, sourceNode);

  try
  {
    transformer.getResultTreeHandler().characters(countString.toCharArray(),
                                                  0, countString.length());
  }
  catch(SAXException se)
  {
    throw new TransformerException(se);
  }
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:27,代码来源:ElemNumber.java

示例12: execute

import org.apache.xalan.transformer.TransformerImpl; //导入依赖的package包/类
/**
 * Copy the text literal to the result tree.
 *
 * @param transformer non-null reference to the the current transform-time state.
 *
 * @throws TransformerException
 */
public void execute(
        TransformerImpl transformer)
          throws TransformerException
{
  try
  {
    SerializationHandler rth = transformer.getResultTreeHandler();

      if (m_disableOutputEscaping)
    {
      rth.processingInstruction(javax.xml.transform.Result.PI_DISABLE_OUTPUT_ESCAPING, "");
    }

    rth.characters(m_ch, 0, m_ch.length);

    if (m_disableOutputEscaping)
    {
      rth.processingInstruction(javax.xml.transform.Result.PI_ENABLE_OUTPUT_ESCAPING, "");
    }
  }
  catch(SAXException se)
  {
    throw new TransformerException(se);
  }
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:33,代码来源:ElemTextLiteral.java

示例13: execute

import org.apache.xalan.transformer.TransformerImpl; //导入依赖的package包/类
/**
   * Copy the template contents into the result tree.
   * The content of the xsl:template element is the template
   * that is instantiated when the template rule is applied.
   *
   * @param transformer non-null reference to the the current transform-time state.
   *
   * @throws TransformerException
   */
  public void execute(
          TransformerImpl transformer)
            throws TransformerException
  {
    XPathContext xctxt = transformer.getXPathContext();
    
    xctxt.pushRTFContext();

      // %REVIEW% commenting out of the code below.
//    if (null != sourceNode)
//    {
      transformer.executeChildTemplates(this, true);
//    }
//    else  // if(null == sourceNode)
//    {
//      transformer.getMsgMgr().error(this,
//        this, sourceNode,
//        XSLTErrorResources.ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES);
//
//      //"sourceNode is null in handleApplyTemplatesInstruction!");
//    }

    xctxt.popRTFContext();
    }
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:34,代码来源:ElemTemplate.java

示例14: execute

import org.apache.xalan.transformer.TransformerImpl; //导入依赖的package包/类
/**
 * Generate the EXSLT function return value, and assign it to the variable
 * index slot assigned for it in ElemExsltFunction compose().
 * 
 */
public void execute(TransformerImpl transformer) throws TransformerException
{    
  XPathContext context = transformer.getXPathContext();

  // Verify that result has not already been set by another result
  // element. Recursion is allowed: intermediate results are cleared 
  // in the owner ElemExsltFunction execute().
  if (transformer.currentFuncResultSeen()) {
      throw new TransformerException("An EXSLT function cannot set more than one result!");
  }

  int sourceNode = context.getCurrentNode();

  // Set the return value;
  XObject var = getValue(transformer, sourceNode);
  transformer.popCurrentFuncResult();
  transformer.pushCurrentFuncResult(var);
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:24,代码来源:ElemExsltFuncResult.java

示例15: configureTrace

import org.apache.xalan.transformer.TransformerImpl; //导入依赖的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


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