001package bradleyross.demonstrations;
002import java.io.File;
003import java.util.Vector;
004/**
005* Reads a file containing an XML document
006* and lists the tags in the document.
007* <p>The first parameter is the name of the
008*    file from which the information is to be
009*    obtained.</p>
010*    
011* <p>Example:</p>
012* <p><code>java bradleyross.demonstrations.getTags test.txt </code></p>
013* <p>This will list the structure of the tags in the file
014*    <code>test.txt</code>.</p>
015* <p>This application requires the appropriate XML jars, such as
016*    <code>xml-apis.jar</code> and <code>xercesImpl.jar</code>, to be in the
017*    CLASSPATH.</p>
018*    @see bradleyross.common.XmlParser
019* @author Bradley Ross
020*/
021public class getTags
022   {
023   public static void main(String args[])
024      {
025      Vector<String> v;
026      File inputFile = new File(args[0]);
027      bradleyross.common.XmlParser parser = 
028          new bradleyross.common.XmlParser();
029      parser.setDebugLevel(2);
030      v = parser.listTags(inputFile);
031      String itemList[] = new String[v.size()];
032      itemList = v.toArray(itemList);
033      for (int i = 0; i < itemList.length; i++)
034         { System.out.println(itemList[i]); }
035      }
036   }