/** The XLinkUser class is a SAX implementation of an XLink parser filter
* This class is for testing purposes only and does not need to be present to use the XLinkFilter, LinkSet, or Link classes with other applications.
* Version 0.12 - Last Modified 11/29/98
* Copyright 1998 Simon St.Laurent 
* No warranty provided - use at your own risk */

//package com.simonstl.sax;

/* Modification history
* 11/23/98 Added parserClass arg - Toivo Lainevool
* 11/29/98 Turned on HTML processing for easier testing - Simon St.Laurent
*/


import org.ccil.cowan.sax.*;
import org.xml.sax.*;
import org.xml.sax.helpers.*;
//import com.microstar.xml.*;
import java.io.IOException;
import java.io.File;


public class XLinkUser extends org.xml.sax.HandlerBase
{
LinkSet theLinkSet;
String URL;

public XLinkUser(String uri, String parserClass)  throws IllegalAccessException, 
	     InstantiationException,
             ClassNotFoundException {
URL=uri;
theLinkSet=new LinkSet();
Parser parser;
XLinkFilter parserFilter;

  parser = ParserFactory.makeParser(parserClass);

  parserFilter=new XLinkFilter(parser);
  parserFilter.setDocumentHandler(this);
  parserFilter.setLinkSet(theLinkSet);
  parserFilter.setHTMLProcessing(true);

try {
   parserFilter.parse(uri);
  } catch (IOException e) {
     e.printStackTrace();
  } catch (SAXException e) {
     e.printStackTrace();
  }
}


  public void endDocument()
      throws SAXException {
	LinkSet testLinks;
	testLinks=theLinkSet ; //.getByURL("russmeet.xml");
	testLinks.printAllLinks();
  }
}