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        /**
024         * Runs an XML parser against a specified file.
025         * @param args First argument is name of file
026         */
027        public static void main(String args[])
028        {
029                Vector<String> v;
030                File inputFile = new File(args[0]);
031                bradleyross.common.XmlParser parser = 
032                                new bradleyross.common.XmlParser();
033                parser.setDebugLevel(2);
034                v = parser.listTags(inputFile);
035                String itemList[] = new String[v.size()];
036                itemList = v.toArray(itemList);
037                for (int i = 0; i < itemList.length; i++)
038                { System.out.println(itemList[i]); }
039        }
040}