Hi,
I think this can be done by System.setProperty(...), and I thought with:
System.setProperty( "org.xml.sax.driver", "org.apache.xerces.parsers.SAXParser" );
But I tried it and it does not work, maybe I did something wrong.
I tried another one, and the following should work:
System.setProperty( "javax.xml.parsers.SAXParserFactory",
"org.apache.xerces.jaxp.SAXParserFactoryImpl" );
Then you get a "org.apache.xerces.jaxp.SAXParserImpl" Parser.
If no property is set, the application uses the default parser: the first one it finds
in your classpath.
You can test it by your own, try the following with and without setting the System property:
// =========
import javax.xml.parsers.*;
public class ParserTest { public static void main(String[] argv) throws Exception { System.setProperty( "javax.xml.parsers.SAXParserFactory", "org.apache.xerces.jaxp.SAXParserFactoryImpl" ); SAXParserFactory factory = SAXParserFactory.newInstance(); SAXParser parser = factory.newSAXParser(); System.out.println("Parser Class: " + parser.getClass().getName()); } }
// ===========
Greetings,
Marko
At 11:32 19.11.2002 +0100, you wrote:
I serched a little, and I found one difference between calling the fop.bat and processing servlet .
The fop.bat use
org.apache.xerces.parsers.SAXParser
while servlet code uses
oracle.xml.parser.v2.SAXParser
The library xmlparserv2.jar is necessary, without it whole JDeveloper won't run. All FOP libraries are in front of this library in my project, but servlet still uses parser from xmlparserv2.jar .
My question is this : Can I somehow choose, which parser (from which library) to use ? Some example would be welcomed. I am still a beginner in this field. Thanks.
[EMAIL PROTECTED]
rcz.cz Komu: [EMAIL PROTECTED]
Kopie:
18.11.2002 Předmět: Strange error when upgrading from 0.20.3 to 0.20.4
12:01
Odpovězte
prosím
uživateli
fop-user
I am trying to upgrade FOP from version 0.20.3 to 0.20.4 . I use Oracle's JDeveloper 9i
To my project I added all libraries, which I found in fop.bat :
fop.jar batik.jar xalan-2.3.1.jar xercesImpl-2.0.1.jar xml-apis.jar avalon-framework-cvs-20020315.jar logkit-1.0.jar
When I process my FO file by fop.bat, everything is ok. When I do this in servlet, following error appears:
[INFO]: building formatting object tree [INFO]: [1] - the logging stops here
java.lang.NullPointerException int org.apache.fop.render.pdf.fonts.LazyFont.getAscender(int) int org.apache.fop.layout.FontState.getAscender() void org.apache.fop.layout.LineArea.(org.apache.fop.layout.FontState, int, int, int, int, int, org.apache.fop.layout.LineArea) void org.apache.fop.layout.BlockArea.start() org.apache.fop.fo.Status org.apache.fop.fo.flow.Block.layout(org.apache.fop.layout.Area) org.apache.fop.fo.Status org.apache.fop.fo.flow.Flow.layout(org.apache.fop.layout.Area, org.apache.fop.fo.pagination.Region) org.apache.fop.fo.Status org.apache.fop.fo.flow.Flow.layout(org.apache.fop.layout.Area) void org.apache.fop.fo.pagination.PageSequence.format(org.apache.fop.layout.AreaTree)
void org.apache.fop.apps.StreamRenderer.render(org.apache.fop.fo.pagination.PageSequence)
void org.apache.fop.fo.FOTreeBuilder.endElement(java.lang.String, java.lang.String, java.lang.String) java.lang.String oracle.xml.parser.v2.NonValidatingParser.parseElement() NonValidatingParser.java:1112 void oracle.xml.parser.v2.NonValidatingParser.parseRootElement() NonValidatingParser.java:287 void oracle.xml.parser.v2.NonValidatingParser.parseDocument() NonValidatingParser.java:254 void oracle.xml.parser.v2.XMLParser.parse(org.xml.sax.InputSource) XMLParser.java:141 void org.apache.fop.apps.Driver.render(org.xml.sax.XMLReader, org.xml.sax.InputSource) void org.apache.fop.apps.Driver.run() void or.jbo.html.beans.ReportShowBean.kresli() ReportShowBean.java:554 void _dt. _ReportShowDT._jspService(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) ReportShowDT.jsp:23 void oracle.jsp.runtime.HttpJsp.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse) HttpJsp.java:119 void oracle.jsp.runtimev2.JspPageTable.service(javax.servlet.http.HttpServletRequest,
javax.servlet.http.HttpServletResponse, java.lang.String) JspPageTable.java:302 void oracle.jsp.runtimev2.JspServlet.internalService(javax.servlet.http.HttpServletRequest,
javax.servlet.http.HttpServletResponse) JspServlet.java:407 void oracle.jsp.runtimev2.JspServlet.service(javax.servlet.http.HttpServletRequest,
javax.servlet.http.HttpServletResponse) JspServlet.java:328 void javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse) HttpServlet.java:336 void com.evermind.server.http.ServletRequestDispatcher.invoke(javax.servlet.ServletRequest,
javax.servlet.ServletResponse) ServletRequestDispatcher.java:684 void com.evermind.server.http.ServletRequestDispatcher.forwardInternal(javax.servlet.ServletRequest,
javax.servlet.http.HttpServletResponse) ServletRequestDispatcher.java:269 boolean com.evermind.server.http.HttpRequestHandler.processRequest(com.evermind.server.ApplicationServerThread,
com.evermind.server.http.EvermindHttpServletRequest, com.evermind.server.http.EvermindHttpServletResponse, java.io.InputStream, java.io.OutputStream, boolean) HttpRequestHandler.java:735 void com.evermind.server.http.HttpRequestHandler.run(java.lang.Thread) HttpRequestHandler.java:243 void com.evermind.util.ThreadPoolThread.run() ThreadPoolThread.java:64
Any suggestions what's wrong ? Thanks.