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


Java TransformerImpl.transformToString方法代码示例

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


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

示例1: 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

示例2: constructNode

import org.apache.xalan.transformer.TransformerImpl; //导入方法依赖的package包/类
/**
 * Construct a node in the result tree.  This method is overloaded by 
 * xsl:attribute. At this class level, this method creates an element.
 *
 * @param nodeName The name of the node, which may be null.
 * @param prefix The prefix for the namespace, which may be null.
 * @param nodeNamespace The namespace of the node, which may be null.
 * @param transformer non-null reference to the the current transform-time state.
 * @param sourceNode non-null reference to the <a href="http://www.w3.org/TR/xslt#dt-current-node">current source node</a>.
 * @param mode reference, which may be null, to the <a href="http://www.w3.org/TR/xslt#modes">current mode</a>.
 *
 * @throws TransformerException
 */
void constructNode(
        String nodeName, String prefix, String nodeNamespace, TransformerImpl transformer)
          throws TransformerException
{

  if(null != nodeName && nodeName.length() > 0)
  {
    SerializationHandler rhandler = transformer.getSerializationHandler();

    // Evaluate the value of this attribute
    String val = transformer.transformToString(this);
    try 
    {
      // Let the result tree handler add the attribute and its String value.
      String localName = QName.getLocalPart(nodeName);
      if(prefix != null && prefix.length() > 0){
          rhandler.addAttribute(nodeNamespace, localName, nodeName, "CDATA", val, true);
      }else{
          rhandler.addAttribute("", localName, nodeName, "CDATA", val, true);
      }
    }
    catch (SAXException e)
    {
    }
  }
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:40,代码来源:ElemAttribute.java

示例3: execute

import org.apache.xalan.transformer.TransformerImpl; //导入方法依赖的package包/类
/**
 * Send a message to diagnostics.
 * The xsl:message instruction sends a message in a way that
 * is dependent on the XSLT transformer. The content of the xsl:message
 * instruction is a template. The xsl:message is instantiated by
 * instantiating the content to create an XML fragment. This XML
 * fragment is the content of the message.
 *
 * @param transformer non-null reference to the the current transform-time state.
 *
 * @throws TransformerException
 */
public void execute(
        TransformerImpl transformer)
          throws TransformerException
{

  String data = transformer.transformToString(this);

  transformer.getMsgMgr().message(this, data, m_terminate);
  
  if(m_terminate)
    transformer.getErrorListener().fatalError(new TransformerException(XSLMessages.createMessage(XSLTErrorResources.ER_STYLESHEET_DIRECTED_TERMINATION, null))); //"Stylesheet directed termination"));
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:25,代码来源:ElemMessage.java

示例4: execute

import org.apache.xalan.transformer.TransformerImpl; //导入方法依赖的package包/类
/**
 * Create a processing instruction in the result tree.
 * The content of the xsl:processing-instruction element is a
 * template for the string-value of the processing instruction node.
 * @see <a href="http://www.w3.org/TR/xslt#section-Creating-Processing-Instructions">section-Creating-Processing-Instructions in XSLT Specification</a>
 *
 * @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();
  int sourceNode = xctxt.getCurrentNode();
  
  String piName = m_name_atv == null ? null : m_name_atv.evaluate(xctxt, sourceNode, this);
  
  // Ignore processing instruction if name is null
  if (piName == null) return;

  if (piName.equalsIgnoreCase("xml"))
  {
   	transformer.getMsgMgr().warn(
      this, XSLTErrorResources.WG_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML,
            new Object[]{ Constants.ATTRNAME_NAME, piName });
return;
  }
  
  // Only check if an avt was used (ie. this wasn't checked at compose time.)
  // Ignore processing instruction, if invalid
  else if ((!m_name_atv.isSimple()) && (!XML11Char.isXML11ValidNCName(piName)))
  {
   	transformer.getMsgMgr().warn(
      this, XSLTErrorResources.WG_PROCESSINGINSTRUCTION_NOTVALID_NCNAME,
            new Object[]{ Constants.ATTRNAME_NAME, piName });
return;    	
  }

  // Note the content model is:
  // <!ENTITY % instructions "
  // %char-instructions;
  // | xsl:processing-instruction
  // | xsl:comment
  // | xsl:element
  // | xsl:attribute
  // ">
  String data = transformer.transformToString(this);

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


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