org.w3c.dom.traversal.NodeFilter#SHOW_ALL源码实例Demo

下面列出了org.w3c.dom.traversal.NodeFilter#SHOW_ALL 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

public Object invokeMethod(final String id, Object[] arguments) throws Exception
{
    if (!PROCESSOR_METHODS.containsKey(id))
    {
        throw new NullPointerException("unable to find method " + id);
    }

    final TemplateProcessorMethod method = PROCESSOR_METHODS.get(id);
    arguments = this.convertArguments(arguments);
    log.debug("invoking " + id + " with " + arguments.length);

    Object result = method.exec(arguments);
    log.debug(id + " returned a " + result);
    if (result == null)
    {
        return null;
    }
    else if (result.getClass().isArray() && Node.class.isAssignableFrom(result.getClass().getComponentType()))
    {
        log.debug("converting " + result + " to a node iterator");
        final Node[] array = (Node[]) result;
        return new NodeIterator()
        {
            private int index = 0;
            private boolean detached = false;

            public void detach()
            {
                if (log.isDebugEnabled())
                    log.debug("detaching NodeIterator");
                this.detached = true;
            }

            public boolean getExpandEntityReferences()
            {
                return true;
            }

            public int getWhatToShow()
            {
                return NodeFilter.SHOW_ALL;
            }

            public Node getRoot()
            {
                return (array.length == 0 ? null : array[0].getOwnerDocument().getDocumentElement());
            }

            public NodeFilter getFilter()
            {
                return new NodeFilter()
                {
                    public short acceptNode(final Node n)
                    {
                        return NodeFilter.FILTER_ACCEPT;
                    }
                };
            }

            public Node nextNode() throws DOMException
            {
                if (log.isDebugEnabled())
                    log.debug("NodeIterator.nextNode(" + index + ")");
                if (this.detached)
                    throw new DOMException(DOMException.INVALID_STATE_ERR, null);
                return index == array.length ? null : array[index++];
            }

            public Node previousNode() throws DOMException
            {
                if (log.isDebugEnabled())
                    log.debug("NodeIterator.previousNode(" + index + ")");
                if (this.detached)
                    throw new DOMException(DOMException.INVALID_STATE_ERR, null);
                return index == -1 ? null : array[index--];
            }
        };
    }
    else if (result instanceof String || result instanceof Number || result instanceof Node)
    {
        log.debug("returning " + result + " as is");
        return result;
    }
    else
    {
        throw new IllegalArgumentException("unable to convert " + result.getClass().getName());
    }
}
 
源代码2 项目: citrus-admin   文件: AbstractSpringBeanFilter.java
/**
 * {@inheritDoc}
 */
public int getWhatToShow() {
    return NodeFilter.SHOW_ALL;
}
 
源代码3 项目: jdk1.8-source-analysis   文件: NodeSet.java
/**
 *  This attribute determines which node types are presented via the
 * iterator. The available set of constants is defined in the
 * <code>NodeFilter</code> interface. For NodeSets, the mask has been
 * hardcoded to show all nodes except EntityReference nodes, which have
 * no equivalent in the XPath data model.
 *
 * @return integer used as a bit-array, containing flags defined in
 * the DOM's NodeFilter class. The value will be
 * <code>SHOW_ALL & ~SHOW_ENTITY_REFERENCE</code>, meaning that
 * only entity references are suppressed.
 */
public int getWhatToShow()
{
  return NodeFilter.SHOW_ALL & ~NodeFilter.SHOW_ENTITY_REFERENCE;
}
 
源代码4 项目: TencentKona-8   文件: NodeSet.java
/**
 *  This attribute determines which node types are presented via the
 * iterator. The available set of constants is defined in the
 * <code>NodeFilter</code> interface. For NodeSets, the mask has been
 * hardcoded to show all nodes except EntityReference nodes, which have
 * no equivalent in the XPath data model.
 *
 * @return integer used as a bit-array, containing flags defined in
 * the DOM's NodeFilter class. The value will be
 * <code>SHOW_ALL & ~SHOW_ENTITY_REFERENCE</code>, meaning that
 * only entity references are suppressed.
 */
public int getWhatToShow()
{
  return NodeFilter.SHOW_ALL & ~NodeFilter.SHOW_ENTITY_REFERENCE;
}
 
源代码5 项目: jdk8u60   文件: NodeSet.java
/**
 *  This attribute determines which node types are presented via the
 * iterator. The available set of constants is defined in the
 * <code>NodeFilter</code> interface. For NodeSets, the mask has been
 * hardcoded to show all nodes except EntityReference nodes, which have
 * no equivalent in the XPath data model.
 *
 * @return integer used as a bit-array, containing flags defined in
 * the DOM's NodeFilter class. The value will be
 * <code>SHOW_ALL & ~SHOW_ENTITY_REFERENCE</code>, meaning that
 * only entity references are suppressed.
 */
public int getWhatToShow()
{
  return NodeFilter.SHOW_ALL & ~NodeFilter.SHOW_ENTITY_REFERENCE;
}
 
源代码6 项目: JDKSourceCode1.8   文件: NodeSet.java
/**
 *  This attribute determines which node types are presented via the
 * iterator. The available set of constants is defined in the
 * <code>NodeFilter</code> interface. For NodeSets, the mask has been
 * hardcoded to show all nodes except EntityReference nodes, which have
 * no equivalent in the XPath data model.
 *
 * @return integer used as a bit-array, containing flags defined in
 * the DOM's NodeFilter class. The value will be
 * <code>SHOW_ALL & ~SHOW_ENTITY_REFERENCE</code>, meaning that
 * only entity references are suppressed.
 */
public int getWhatToShow()
{
  return NodeFilter.SHOW_ALL & ~NodeFilter.SHOW_ENTITY_REFERENCE;
}
 
源代码7 项目: openjdk-jdk8u   文件: NodeSet.java
/**
 *  This attribute determines which node types are presented via the
 * iterator. The available set of constants is defined in the
 * <code>NodeFilter</code> interface. For NodeSets, the mask has been
 * hardcoded to show all nodes except EntityReference nodes, which have
 * no equivalent in the XPath data model.
 *
 * @return integer used as a bit-array, containing flags defined in
 * the DOM's NodeFilter class. The value will be
 * <code>SHOW_ALL & ~SHOW_ENTITY_REFERENCE</code>, meaning that
 * only entity references are suppressed.
 */
public int getWhatToShow()
{
  return NodeFilter.SHOW_ALL & ~NodeFilter.SHOW_ENTITY_REFERENCE;
}
 
源代码8 项目: openjdk-jdk8u-backup   文件: NodeSet.java
/**
 *  This attribute determines which node types are presented via the
 * iterator. The available set of constants is defined in the
 * <code>NodeFilter</code> interface. For NodeSets, the mask has been
 * hardcoded to show all nodes except EntityReference nodes, which have
 * no equivalent in the XPath data model.
 *
 * @return integer used as a bit-array, containing flags defined in
 * the DOM's NodeFilter class. The value will be
 * <code>SHOW_ALL & ~SHOW_ENTITY_REFERENCE</code>, meaning that
 * only entity references are suppressed.
 */
public int getWhatToShow()
{
  return NodeFilter.SHOW_ALL & ~NodeFilter.SHOW_ENTITY_REFERENCE;
}
 
源代码9 项目: Bytecoder   文件: NodeSet.java
/**
 *  This attribute determines which node types are presented via the
 * iterator. The available set of constants is defined in the
 * <code>NodeFilter</code> interface. For NodeSets, the mask has been
 * hardcoded to show all nodes except EntityReference nodes, which have
 * no equivalent in the XPath data model.
 *
 * @return integer used as a bit-array, containing flags defined in
 * the DOM's NodeFilter class. The value will be
 * <code>SHOW_ALL & ~SHOW_ENTITY_REFERENCE</code>, meaning that
 * only entity references are suppressed.
 */
public int getWhatToShow()
{
  return NodeFilter.SHOW_ALL & ~NodeFilter.SHOW_ENTITY_REFERENCE;
}
 
源代码10 项目: openjdk-jdk9   文件: NodeSet.java
/**
 *  This attribute determines which node types are presented via the
 * iterator. The available set of constants is defined in the
 * <code>NodeFilter</code> interface. For NodeSets, the mask has been
 * hardcoded to show all nodes except EntityReference nodes, which have
 * no equivalent in the XPath data model.
 *
 * @return integer used as a bit-array, containing flags defined in
 * the DOM's NodeFilter class. The value will be
 * <code>SHOW_ALL & ~SHOW_ENTITY_REFERENCE</code>, meaning that
 * only entity references are suppressed.
 */
public int getWhatToShow()
{
  return NodeFilter.SHOW_ALL & ~NodeFilter.SHOW_ENTITY_REFERENCE;
}
 
源代码11 项目: hottub   文件: NodeSet.java
/**
 *  This attribute determines which node types are presented via the
 * iterator. The available set of constants is defined in the
 * <code>NodeFilter</code> interface. For NodeSets, the mask has been
 * hardcoded to show all nodes except EntityReference nodes, which have
 * no equivalent in the XPath data model.
 *
 * @return integer used as a bit-array, containing flags defined in
 * the DOM's NodeFilter class. The value will be
 * <code>SHOW_ALL & ~SHOW_ENTITY_REFERENCE</code>, meaning that
 * only entity references are suppressed.
 */
public int getWhatToShow()
{
  return NodeFilter.SHOW_ALL & ~NodeFilter.SHOW_ENTITY_REFERENCE;
}
 
源代码12 项目: openjdk-8-source   文件: NodeSet.java
/**
 *  This attribute determines which node types are presented via the
 * iterator. The available set of constants is defined in the
 * <code>NodeFilter</code> interface. For NodeSets, the mask has been
 * hardcoded to show all nodes except EntityReference nodes, which have
 * no equivalent in the XPath data model.
 *
 * @return integer used as a bit-array, containing flags defined in
 * the DOM's NodeFilter class. The value will be
 * <code>SHOW_ALL & ~SHOW_ENTITY_REFERENCE</code>, meaning that
 * only entity references are suppressed.
 */
public int getWhatToShow()
{
  return NodeFilter.SHOW_ALL & ~NodeFilter.SHOW_ENTITY_REFERENCE;
}
 
源代码13 项目: openjdk-8   文件: NodeSet.java
/**
 *  This attribute determines which node types are presented via the
 * iterator. The available set of constants is defined in the
 * <code>NodeFilter</code> interface. For NodeSets, the mask has been
 * hardcoded to show all nodes except EntityReference nodes, which have
 * no equivalent in the XPath data model.
 *
 * @return integer used as a bit-array, containing flags defined in
 * the DOM's NodeFilter class. The value will be
 * <code>SHOW_ALL & ~SHOW_ENTITY_REFERENCE</code>, meaning that
 * only entity references are suppressed.
 */
public int getWhatToShow()
{
  return NodeFilter.SHOW_ALL & ~NodeFilter.SHOW_ENTITY_REFERENCE;
}
 
源代码14 项目: j2objc   文件: NodeSet.java
/**
 *  This attribute determines which node types are presented via the
 * iterator. The available set of constants is defined in the
 * <code>NodeFilter</code> interface. For NodeSets, the mask has been
 * hardcoded to show all nodes except EntityReference nodes, which have
 * no equivalent in the XPath data model.
 *
 * @return integer used as a bit-array, containing flags defined in
 * the DOM's NodeFilter class. The value will be 
 * <code>SHOW_ALL & ~SHOW_ENTITY_REFERENCE</code>, meaning that
 * only entity references are suppressed.
 */
public int getWhatToShow()
{
  return NodeFilter.SHOW_ALL & ~NodeFilter.SHOW_ENTITY_REFERENCE;
}