on 06-08-2005 8:42 PM
I am trying to get a sax parser to work in nw04 but not having much luck. The sap documentation indicates that I need to define system properties as follows.
javax.xml.parsers.DocumentBuilderFactory=
com.sap.engine.lib.jaxp.DocumentBuilderFactoryImpl
javax.xml.parsers.SAXParserFactory=
com.sap.engine.lib.jaxp.SAXParserFactoryImpl
javax.xml.transform.TransformerFactory=
com.sap.engine.lib.jaxp.TransformerFactoryImpl
But regardless of whether or not I do, I get the following exception.
org.xml.sax.SAXException: System property org.xml.sax.driver not specified
I cannot find a value for this system property that works.
I am writing a standalone dc application. My sample code is as follows.
import java.io.FileReader;
import org.xml.sax.*;
import org.xml.sax.helpers.*;
public class MyHandler extends DefaultHandler {
...
public static void main(String[] args) throws Exception{
System.setProperty
("javax.xml.parsers.DocumentBuilderFactory",
"com.sap.engine.lib.jaxp.DocumentBuilderFactoryImpl");
System.setProperty
"javax.xml.parsers.SAXParserFactory",
"com.sap.engine.lib.jaxp.SAXParserFactoryImpl.apache.xerces.parsers.SAXParser");
System.setProperty
"javax.xml.transform.TransformerFactory",
"com.sap.engine.lib.jaxp.TransformerFactoryImpl");
XMLReader xr = XMLReaderFactory.createXMLReader();
MyHandler handler = new MyHandler();
xr.setContentHandler(handler);
xr.setErrorHandler(handler);
FileReader r = new FileReader("/roses.xml");
xr.parse(new InputSource(r));
}
}
Donald
I was able to get it to work without setting any of the properties that I mentioned, just by selecting a different classloader. The JAXPSAXExample2 example code worked like a charm.
Donald
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.