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


Java Navigator.isProcessingInstruction方法代码示例

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


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

示例1: matches

import org.jaxen.Navigator; //导入方法依赖的package包/类
public boolean matches(Object node,
                       ContextSupport support)
{
    
    Navigator nav = support.getNavigator();
    if ( nav.isProcessingInstruction( node ) )
    {
        String name = getName();
        if ( name == null || name.length() == 0 )
        {
            return true;
        }
        else
        {
            return name.equals( nav.getProcessingInstructionTarget( node ) );
        }
    }

    return false;
    
}
 
开发者ID:jaxen-xpath,项目名称:jaxen,代码行数:22,代码来源:DefaultProcessingInstructionNodeStep.java

示例2: evaluate

import org.jaxen.Navigator; //导入方法依赖的package包/类
/**
 * Returns the local-name of <code>list.get(0)</code>
 * 
 * @param list a list of nodes
 * @param nav the <code>Navigator</code> used to retrieve the local name
 * 
 * @return the local-name of <code>list.get(0)</code>
 * 
 * @throws FunctionCallException if <code>list.get(0)</code> is not a node
 */
public static String evaluate(List list,
                              Navigator nav) throws FunctionCallException
{
    if ( ! list.isEmpty() )
    {            
        Object first = list.get(0);

        if (first instanceof List)
        {
            return evaluate( (List) first,
                             nav );
        }
        else if ( nav.isElement( first ) )
        {
            return nav.getElementName( first );
        }
        else if ( nav.isAttribute( first ) )
        {
            return nav.getAttributeName( first );
        }
        else if ( nav.isProcessingInstruction( first ) )
        {
            return nav.getProcessingInstructionTarget( first );
        }
        else if ( nav.isNamespace( first ) )
        {
            return nav.getNamespacePrefix( first );
        }
        else if ( nav.isDocument( first ) )
        {
            return "";
        }
        else if ( nav.isComment( first ) )
        {
            return "";
        }
        else if ( nav.isText( first ) )
        {
            return "";
        }
        else {
            throw new FunctionCallException("The argument to the local-name function must be a node-set");   
        }
    }

    return "";
}
 
开发者ID:jaxen-xpath,项目名称:jaxen,代码行数:58,代码来源:LocalNameFunction.java

示例3: evaluate

import org.jaxen.Navigator; //导入方法依赖的package包/类
/** 
 * Returns the number value of <code>obj</code>.
 *
 * @param obj the object to be converted to a number
 * @param nav the <code>Navigator</code> used to calculate the string-value
 *     of node-sets
 * 
 * @return a <code>Double</code>
 */
public static Double evaluate(Object obj, Navigator nav)
{
    if( obj instanceof Double )
    {
        return (Double) obj;
    }
    else if ( obj instanceof String )
    {
        String str = (String) obj;
        try
        {
            Double doubleValue = new Double( str );        
            return doubleValue;
        }
        catch (NumberFormatException e)
        {
            return NaN;
        }
    }
    else if ( obj instanceof List || obj instanceof Iterator )
    {
      return evaluate( StringFunction.evaluate( obj, nav ), nav );
    }
    else if ( nav.isElement( obj ) || nav.isAttribute( obj ) 
            || nav.isText( obj ) || nav.isComment( obj ) || nav.isProcessingInstruction( obj ) 
            || nav.isDocument( obj ) || nav.isNamespace( obj ))
    {
        return evaluate( StringFunction.evaluate( obj, nav ), nav );
    }
    else if ( obj instanceof Boolean )
      {
      if ( Boolean.TRUE.equals(obj) )
      {
          return new Double( 1 );
      }
      else
      {
          return new Double( 0 );
      }
    }    
    return NaN;
}
 
开发者ID:jaxen-xpath,项目名称:jaxen,代码行数:52,代码来源:NumberFunction.java

示例4: evaluate

import org.jaxen.Navigator; //导入方法依赖的package包/类
/**
 * Returns the namespace URI of <code>list.get(0)</code>
 * 
 * @param list a list of nodes
 * @param nav the <code>Navigator</code> used to retrieve the namespace
 * 
 * @return the namespace URI of <code>list.get(0)</code>
 * 
 * @throws FunctionCallException if <code>list.get(0)</code> is not a node
 */
public static String evaluate(List list,
                              Navigator nav) throws FunctionCallException
{
    if ( ! list.isEmpty() )
    {
        Object first = list.get(0);

        if ( first instanceof List )
        {
            return evaluate( (List) first,
                             nav );
        }
        else if ( nav.isElement( first ) )
        {
            return nav.getElementNamespaceUri( first );
        }
        else if ( nav.isAttribute( first ) )
        {
            String uri = nav.getAttributeNamespaceUri( first );
            if (uri == null) return "";
            return uri;
        }
        else if ( nav.isProcessingInstruction( first ) )
        {
            return "";
        }
        else if ( nav.isNamespace( first ) )
        {
            return "";
        }
        else if ( nav.isDocument( first ) )
        {
            return "";
        }
        else if ( nav.isComment( first ) )
        {
            return "";
        }
        else if ( nav.isText( first ) )
        {
            return "";
        }
        else {
            throw new FunctionCallException(
              "The argument to the namespace-uri function must be a node-set");   
        }

    }

    return "";

}
 
开发者ID:jaxen-xpath,项目名称:jaxen,代码行数:63,代码来源:NamespaceUriFunction.java

示例5: evaluate

import org.jaxen.Navigator; //导入方法依赖的package包/类
/**
 * Returns the name of <code>list.get(0)</code>
 * 
 * @param list a list of nodes
 * @param nav the <code>Navigator</code> used to retrieve the name
 * 
 * @return the name of <code>list.get(0)</code>
 * 
 * @throws FunctionCallException if <code>list.get(0)</code> is not a node
 */
public static String evaluate(List list,
                              Navigator nav) throws FunctionCallException
{
    if ( ! list.isEmpty() )
    {            
        Object first = list.get(0);

        if (first instanceof List)
        {
            return evaluate( (List) first,
                             nav );
        }
        else if ( nav.isElement( first ) )
        {
            return nav.getElementQName( first );
        }
        else if ( nav.isAttribute( first ) )
        {
            return nav.getAttributeQName( first );
        }
        else if ( nav.isProcessingInstruction( first ) )
        {
            return nav.getProcessingInstructionTarget( first );
        }
        else if ( nav.isNamespace( first ) )
        {
            return nav.getNamespacePrefix( first );
        }
        else if ( nav.isDocument( first ) )
        {
            return "";
        }
        else if ( nav.isComment( first ) )
        {
            return "";
        }
        else if ( nav.isText( first ) )
        {
            return "";
        }
        else {
            throw new FunctionCallException("The argument to the name function must be a node-set");   
        }
    }

    return "";

}
 
开发者ID:jaxen-xpath,项目名称:jaxen,代码行数:59,代码来源:NameFunction.java


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