Java Code Examples for org.w3c.dom.traversal.NodeFilter#SHOW_ALL

The following examples show how to use org.w3c.dom.traversal.NodeFilter#SHOW_ALL . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: XSLTProcessorMethodInvoker.java    From alfresco-repository with GNU Lesser General Public License v3.0 4 votes vote down vote up
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());
    }
}
 
Example 2
Source File: AbstractSpringBeanFilter.java    From citrus-admin with Apache License 2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
public int getWhatToShow() {
    return NodeFilter.SHOW_ALL;
}
 
Example 3
Source File: NodeSet.java    From jdk1.8-source-analysis with Apache License 2.0 2 votes vote down vote up
/**
 *  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;
}
 
Example 4
Source File: NodeSet.java    From TencentKona-8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 *  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;
}
 
Example 5
Source File: NodeSet.java    From jdk8u60 with GNU General Public License v2.0 2 votes vote down vote up
/**
 *  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;
}
 
Example 6
Source File: NodeSet.java    From JDKSourceCode1.8 with MIT License 2 votes vote down vote up
/**
 *  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;
}
 
Example 7
Source File: NodeSet.java    From openjdk-jdk8u with GNU General Public License v2.0 2 votes vote down vote up
/**
 *  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;
}
 
Example 8
Source File: NodeSet.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 2 votes vote down vote up
/**
 *  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;
}
 
Example 9
Source File: NodeSet.java    From Bytecoder with Apache License 2.0 2 votes vote down vote up
/**
 *  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;
}
 
Example 10
Source File: NodeSet.java    From openjdk-jdk9 with GNU General Public License v2.0 2 votes vote down vote up
/**
 *  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;
}
 
Example 11
Source File: NodeSet.java    From hottub with GNU General Public License v2.0 2 votes vote down vote up
/**
 *  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;
}
 
Example 12
Source File: NodeSet.java    From openjdk-8-source with GNU General Public License v2.0 2 votes vote down vote up
/**
 *  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;
}
 
Example 13
Source File: NodeSet.java    From openjdk-8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 *  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;
}
 
Example 14
Source File: NodeSet.java    From j2objc with Apache License 2.0 2 votes vote down vote up
/**
 *  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;
}