001package bradleyross.demonstrations;
002import java.io.File;
003import java.util.Vector;
004/**
005* Reads a file containing an XML document
006* and searches for strings having a given
007* sequence of tags.
008* <p>The first parameter is the name of the
009*    file from which the information is to be
010*    obtained.</p>
011* <p>The second parameter is the tag list to be
012*    checked for.  In this case parsing of the tags
013*    is case sensitive.</p>
014* <p>Example:</p>
015* <p><code>java bradleyross.demonstrations.parseFile test.txt "&lt;html&gt;&lt;body&gt;"</code></p>
016* <p>This will give the contents of <code>body</code> tags contained
017*    within <code>html</code> tags.</p>
018* <p>This application requires the appropriate XML jars, such as
019*    <code>xml-apis.jar</code> and <code>xercesImpl.jar</code>, to be in the
020*    CLASSPATH.</p>
021* @see bradleyross.common.XmlParser
022* @author Bradley Ross
023*/
024public class parseFile
025   {
026   public static void main(String args[])
027      {
028      Vector<String> v;
029      File inputFile = new File(args[0]);
030      bradleyross.common.XmlParser parser = 
031          new bradleyross.common.XmlParser();
032      v = parser.parseString(inputFile, args[1]);
033      String itemList[] = new String[v.size()];
034      itemList = v.toArray(itemList);
035      for (int i = 0; i < itemList.length; i++)
036         { System.out.println(itemList[i]); }
037      }
038   }