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


Java DTM.DOCUMENT_FRAGMENT_NODE属性代码示例

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


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

示例1: execute

/**
   * Execute the function.  The function must return
   * a valid object.
   * @param xctxt The current execution context.
   * @return A valid XObject.
   *
   * @throws javax.xml.transform.TransformerException
   */
  public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException
  {

    int whereNode = getArg0AsNode(xctxt);
    String fileLocation = null;

    if (DTM.NULL != whereNode)
    {
      DTM dtm = xctxt.getDTM(whereNode);
      
      // %REVIEW%
      if (DTM.DOCUMENT_FRAGMENT_NODE ==  dtm.getNodeType(whereNode))
      {
        whereNode = dtm.getFirstChild(whereNode);
      }

      if (DTM.NULL != whereNode)
      {        
        fileLocation = dtm.getDocumentBaseURI();
//        int owner = dtm.getDocument();
//        fileLocation = xctxt.getSourceTreeManager().findURIFromDoc(owner);
      }
    }

    return new XString((null != fileLocation) ? fileLocation : "");
  }
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:34,代码来源:FuncDoclocation.java

示例2: getHead

/**
 * Get the head of the most likely list of associations to check, based on 
 * the name and type of the targetNode argument.
 *
 * @param xctxt The XPath runtime context.
 * @param targetNode The target node that will be checked for a match.
 * @param dtm The dtm owner for the target node.
 *
 * @return The head of a linked list that contains all possible match pattern to 
 * template associations.
 */
public TemplateSubPatternAssociation getHead(XPathContext xctxt, 
                                             int targetNode, DTM dtm)
{
  short targetNodeType = dtm.getNodeType(targetNode);
  TemplateSubPatternAssociation head;

  switch (targetNodeType)
  {
  case DTM.ELEMENT_NODE :
  case DTM.ATTRIBUTE_NODE :
    head = (TemplateSubPatternAssociation) m_patternTable.get(
      dtm.getLocalName(targetNode));
    break;
  case DTM.TEXT_NODE :
  case DTM.CDATA_SECTION_NODE :
    head = m_textPatterns;
    break;
  case DTM.ENTITY_REFERENCE_NODE :
  case DTM.ENTITY_NODE :
    head = (TemplateSubPatternAssociation) m_patternTable.get(
      dtm.getNodeName(targetNode)); // %REVIEW% I think this is right
    break;
  case DTM.PROCESSING_INSTRUCTION_NODE :
    head = (TemplateSubPatternAssociation) m_patternTable.get(
      dtm.getLocalName(targetNode));
    break;
  case DTM.COMMENT_NODE :
    head = m_commentPatterns;
    break;
  case DTM.DOCUMENT_NODE :
  case DTM.DOCUMENT_FRAGMENT_NODE :
    head = m_docPatterns;
    break;
  case DTM.NOTATION_NODE :
  default :
    head = (TemplateSubPatternAssociation) m_patternTable.get(
      dtm.getNodeName(targetNode)); // %REVIEW% I think this is right
  }

  return (null == head) ? m_wildCardPatterns : head;
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:52,代码来源:TemplateList.java

示例3: execute

/**
 * The xsl:copy element provides an easy way of copying the current node.
 * Executing this function creates a copy of the current node into the
 * result tree.
 * <p>The namespace nodes of the current node are automatically
 * copied as well, but the attributes and children of the node are not
 * automatically copied. The content of the xsl:copy element is a
 * template for the attributes and children of the created node;
 * the content is instantiated only for nodes of types that can have
 * attributes or children (i.e. root nodes and element nodes).</p>
 * <p>The root node is treated specially because the root node of the
 * result tree is created implicitly. When the current node is the
 * root node, xsl:copy will not create a root node, but will just use
 * the content template.</p>
 *
 * @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();
    
  try
  {
    int sourceNode = xctxt.getCurrentNode();
    xctxt.pushCurrentNode(sourceNode);
    DTM dtm = xctxt.getDTM(sourceNode);
    short nodeType = dtm.getNodeType(sourceNode);

    if ((DTM.DOCUMENT_NODE != nodeType) && (DTM.DOCUMENT_FRAGMENT_NODE != nodeType))
    {
      SerializationHandler rthandler = transformer.getSerializationHandler();

      // TODO: Process the use-attribute-sets stuff
      ClonerToResultTree.cloneToResultTree(sourceNode, nodeType, dtm, 
                                           rthandler, false);

      if (DTM.ELEMENT_NODE == nodeType)
      {
        super.execute(transformer);
        SerializerUtils.processNSDecls(rthandler, sourceNode, nodeType, dtm);
        transformer.executeChildTemplates(this, true);
        
        String ns = dtm.getNamespaceURI(sourceNode);
        String localName = dtm.getLocalName(sourceNode);
        transformer.getResultTreeHandler().endElement(ns, localName,
                                                      dtm.getNodeName(sourceNode));
      }
    }
    else
    {
      super.execute(transformer);
      transformer.executeChildTemplates(this, true);
    }
  }
  catch(org.xml.sax.SAXException se)
  {
    throw new TransformerException(se);
  }
  finally
  {
    xctxt.popCurrentNode();
  }
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:67,代码来源:ElemCopy.java

示例4: getNodeTypeTest

/**
 * Tell what node type to test, if not DTMFilter.SHOW_ALL.
 *
 * @param whatToShow Bit set defined mainly by 
 *        {@link org.apache.xml.dtm.DTMFilter}.
 * @return the node type for the whatToShow.  Since whatToShow can specify 
 *         multiple types, it will return the first bit tested that is on, 
 *         so the caller of this function should take care that this is 
 *         the function they really want to call.  If none of the known bits
 *         are set, this function will return zero.
 */
public static int getNodeTypeTest(int whatToShow)
{
  // %REVIEW% Is there a better way?
  if (0 != (whatToShow & DTMFilter.SHOW_ELEMENT))
    return DTM.ELEMENT_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_ATTRIBUTE))
    return DTM.ATTRIBUTE_NODE;
    
  if (0 != (whatToShow & DTMFilter.SHOW_TEXT))
    return DTM.TEXT_NODE;
    
  if (0 != (whatToShow & DTMFilter.SHOW_DOCUMENT))
    return DTM.DOCUMENT_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_DOCUMENT_FRAGMENT))
    return DTM.DOCUMENT_FRAGMENT_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_NAMESPACE))
    return DTM.NAMESPACE_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_COMMENT))
    return DTM.COMMENT_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_PROCESSING_INSTRUCTION))
    return DTM.PROCESSING_INSTRUCTION_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_DOCUMENT_TYPE))
    return DTM.DOCUMENT_TYPE_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_ENTITY))
    return DTM.ENTITY_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_ENTITY_REFERENCE))
    return DTM.ENTITY_REFERENCE_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_NOTATION))
    return DTM.NOTATION_NODE;
    
  if (0 != (whatToShow & DTMFilter.SHOW_CDATA_SECTION))
    return DTM.CDATA_SECTION_NODE;


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


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