What failure or error message do you get?

Fred Baube wrote:
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();
      }
  }





--
Geert Bevin                       Uwyn bvba
"Use what you need"               Avenue de Scailmont 34
http://www.uwyn.com               7170 Manage, Belgium
gbevin[remove] at uwyn dot com    Tel +32 64 84 80 03

PGP Fingerprint : 4E21 6399 CD9E A384 6619  719A C8F4 D40D 309F D6A9
Public PGP key  : available at servers pgp.mit.edu, wwwkeys.pgp.net
_______________________________________________
Rife-users mailing list
[email protected]
http://www.uwyn.com/mailman/listinfo/rife-users

Reply via email to