package daruma.xml.util;

import java.util.ArrayList;

import org.w3c.dom.Node;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;

public class NodeArrayList extends ArrayList<Node>
{
	private	static final long serialVersionUID = 0L;

	public	NodeArrayList( NodeList  nodeList ,  boolean  elementOnly )
	{
		for( int  i = 0  ;  i < nodeList.getLength()  ;  ++ i )
		{
			if ( ! elementOnly
			  || nodeList.item(i) instanceof Element )
			{
				super.add( nodeList.item(i) );
			}
		}
	}

	public	NodeArrayList( NodeList  nodeList )
	{
		this( nodeList , false );
	}

	public	NodeArrayList( Element  element )
	{
		this( element.getChildNodes() , false );
	}

	public	NodeArrayList( Element  element ,  boolean  elementOnly )
	{
		this( element.getChildNodes() , elementOnly );
	}
}
