I am trying to use XMLFilter s, however with little luck! Any help would be
appreiciated. From what I understand an XMLFilter recieves notifications from
other XMLFilters (XMLReaders). The only thing that is required is to register a
parent for the XMLFilter. However the following example doesnt work for me!

class MyFilter extends XMLFilterImpl
{
  MyFilter(XMLReader parent)
  {
    super(parent);
  }
  public void startElement(String s1, String s2, String s3, Attributes atts)
  {
    System.out.println ("called start element of filter: "+ s1);
   }
}

class Test implements ContentHandler
{
  public static void main (String args[])
  {
     String uri = args[0];
     String parserClass= "org.apache.xerces.parsers.SAXParser";
     Test t = new Test();
      XMLReader parser = XMLReaderFactory.createXMLReader(parserClass);
     parser.setContentHandler(t);
     MyFilter filter = new MyFilter(parser);
     parser.parse(uri);
  }

 public void startElement(String s1, String s2, String s3, Attributes atts)
  {
    System.out.println ("called start element from Test : "+ s1);
   }
..................all other interface methods.................
}

Only the startElement of the Test class ever gets called.. MyFilter doesnt
recieve any notifications from the parser. Do I have to explicity invoke methods
from the
Test class on MyFilter? How can I use filters in SAX to distribute the parsing
process for cohessive handling of events and actions.

thanks
Ismail



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to