本文整理汇总了Java中org.jaxen.Navigator.isComment方法的典型用法代码示例。如果您正苦于以下问题:Java Navigator.isComment方法的具体用法?Java Navigator.isComment怎么用?Java Navigator.isComment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jaxen.Navigator
的用法示例。
在下文中一共展示了Navigator.isComment方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: matches
import org.jaxen.Navigator; //导入方法依赖的package包/类
public boolean matches(Object node,
ContextSupport contextSupport)
{
Navigator nav = contextSupport.getNavigator();
return nav.isComment( node );
}
示例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 "";
}
示例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;
}
示例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 "";
}
示例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 "";
}