I have a problem that I've burned a couple of days on, without 
success.  Now my latest testing makes me wonder if it might be 
a classloader problem related to Rife. 

 Further down in this message is a code fragment that tries to 
set the "lexical-handler" property of a SAX XMLReader, like so:

        reader.setProperty(LEXICAL_HANDLER_PROPERTY,this);

The classes that use this fragment implement SAX's LexcalHandler.

When I execute it inside a simple servlet class like this:

        public class HelloWorldExample extends HttpServlet 
                implements ContentHandler, LexicalHandler 
        {
            public void doGet(HttpServletRequest request,
                HttpServletResponse response)
                throws IOException, ServletException

it is able to set the lexical-handler property of the parser.

But when I execute it in class that is called from a Rife 
Element, like so:

        public class WriterLex extends DefaultHandler2 { 

it _always_ fails on the call


FWIW I've also tried 

        WriterLex implements LexicalHandler {

and a dozen other combinations. 

I've done my best to narrow it down this problem, I've tried 
configuring XMLReaderFactory's and SAXParserFactory's, but 
the call to setProperty(..) consistently fails inside Rife.

Does this sounds like any known problems with classloading ?


fred


the code fragment:

    public static final String SAX_DRIVER_PROPERTY = "org.xml.sax.driver";
    public static final String LEXICAL_HANDLER_PROPERTY =
        "http://xml.org/sax/properties/lexical-handler";;

      try {
        if (System.getProperty(SAX_DRIVER_PROPERTY) == null){
           //The default sax driver is set to xerces's sax driver
           System.setProperty(SAX_DRIVER_PROPERTY, 
"org.apache.xerces.pars\ers.SAXParser");
        }
        reader = XMLReaderFactory.createXMLReader();
        // I also tried "com.sun.org.apache.xerces.internal.parsers.SAXParser"

        System.out.println ("Clsnm: " + reader.getClass().getName());
        reader.setContentHandler (this);
        reader.setProperty (LEXICAL_HANDLER_PROPERTY,this);
        System.out.println ("SUCCESS!");
      }
      catch (Exception e) {
        e.printStackTrace();
      }
  }




-- 
F.Baube           *  
Georgetown/MSFS/1988  *  Think pangalactically. 
fbaube#saunalahti.fi  *  Act locally.
 gsm  +358 41 536 8192 *  
 wmd  60°11'10.8"N 24°57'36.9"E
_______________________________________________
Rife-users mailing list
[email protected]
http://www.uwyn.com/mailman/listinfo/rife-users

Reply via email to