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


Java DTM.getNodeNameX方法代码示例

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


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

示例1: getPath

import org.apache.xml.dtm.DTM; //导入方法依赖的package包/类
public static String getPath(DTM dtm, int node) {
  String pre;
  switch (dtm.getNodeType(node)) {
    case Node.DOCUMENT_NODE:
      return "/";
    case Node.ELEMENT_NODE:
      pre = getPath(dtm, dtm.getParent(node));
      return (pre.equals("/") ? "" : pre) +
             "/" + dtm.getNodeName(node) + "[" + getNumberSimple(dtm, node) + "]";
    case Node.ATTRIBUTE_NODE:
      return getPath(dtm, dtm.getParent(node)) + "/@" + dtm.getNodeNameX(node);
    case Node.TEXT_NODE:
      pre = getPath(dtm, dtm.getParent(node));
      return (pre.equals("/") ? "" : pre) +
             "/text()[" + getNumberSimple(dtm, node) + "]";
    case Node.COMMENT_NODE:
      pre = getPath(dtm, dtm.getParent(node));
      return (pre.equals("/") ? "" : pre) +
             "/comment()[" + getNumberSimple(dtm, node) + "]";
    case Node.PROCESSING_INSTRUCTION_NODE:
      pre = getPath(dtm, dtm.getParent(node));
      return (pre.equals("/") ? "" : pre) +
             "/processing-instruction()[" + getNumberSimple(dtm, node) + "]";
  }
  return "?";
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:XalanSupport.java

示例2: isDefinedNSDecl

import org.apache.xml.dtm.DTM; //导入方法依赖的package包/类
/**
 * Returns whether a namespace is defined
 *
 *
 * @param attr Namespace attribute node
 * @param dtm The DTM that owns attr.
 *
 * @return True if the namespace is already defined in
 * list of namespaces
 */
public static boolean isDefinedNSDecl(
    SerializationHandler serializer,
    int attr,
    DTM dtm)
{

    if (DTM.NAMESPACE_NODE == dtm.getNodeType(attr))
    {

        // String prefix = dtm.getPrefix(attr);
        String prefix = dtm.getNodeNameX(attr);
        String uri = serializer.getNamespaceURIFromPrefix(prefix);
        //      String uri = getURI(prefix);

        if ((null != uri) && uri.equals(dtm.getStringValue(attr)))
            return true;
    }

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

示例3: ensureNamespaceDeclDeclared

import org.apache.xml.dtm.DTM; //导入方法依赖的package包/类
/**
 * This function checks to make sure a given prefix is really
 * declared.  It might not be, because it may be an excluded prefix.
 * If it's not, it still needs to be declared at this point.
 * TODO: This needs to be done at an earlier stage in the game... -sb
 *
 * NEEDSDOC @param dtm
 * NEEDSDOC @param namespace
 *
 * @throws org.xml.sax.SAXException
 */
public static void ensureNamespaceDeclDeclared(
    SerializationHandler handler,
    DTM dtm,
    int namespace)
    throws org.xml.sax.SAXException
{

    String uri = dtm.getNodeValue(namespace);
    String prefix = dtm.getNodeNameX(namespace);

    if ((uri != null && uri.length() > 0) && (null != prefix))
    {
        String foundURI;
        NamespaceMappings ns = handler.getNamespaceMappings();
        if (ns != null)
        {

            foundURI = ns.lookupNamespace(prefix);
            if ((null == foundURI) || !foundURI.equals(uri))
            {
                handler.startPrefixMapping(prefix, uri, false);
            }
        }
    }
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:37,代码来源:SerializerUtils.java

示例4: execute

import org.apache.xml.dtm.DTM; //导入方法依赖的package包/类
/**
 * 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 context = getArg0AsNode(xctxt);
  XObject val;

  if (DTM.NULL != context)
  {
    DTM dtm = xctxt.getDTM(context);
    String qname = dtm.getNodeNameX(context);
    val = (null == qname) ? XString.EMPTYSTRING : new XString(qname);
  }
  else
  {
    val = XString.EMPTYSTRING;
  }

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


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