|
|
|
|
|
|
|
|
|
|
|
|
Re: XML parser implementation [message #1251439 is a reply to message #1249328] |
Thu, 20 February 2014 08:09 |
Murthy Bhat Messages: 159 Registered: July 2009 |
Senior Member |
|
|
Hello,
I was able to resolve this issue by explicitly setting the system property before calling the sphinx dependent module in the java code and then reset it back. Something like below
//Get the properties for later resetting
String saxParserFactory = System.getProperty("javax.xml.parsers.SAXParserFactory");
String documentBuilderFactory = System.getProperty("javax.xml.parsers.DocumentBuilderFactory");
String transformerFactoryImpl = System.getProperty("javax.xml.transform.TransformerFactory");
//Override the xml properties with the apache.xerces factories
System.setProperty("javax.xml.parsers.DocumentBuilderFactory","org.apache.xerces.jaxp.DocumentBuilderFactoryImpl");
System.setProperty("javax.xml.parsers.SAXParserFactory","org.apache.xerces.jaxp.SAXParserFactoryImpl");
System.setProperty("javax.xml.transform.TransformerFactory","org.apache.xalan.xsltc.trax.TransformerFactoryImpl");
//My Sphinx related code.......
//Reset the old factories back
System.setProperty("javax.xml.parsers.SAXParserFactory",saxParserFactory);
System.setProperty("javax.xml.parsers.DocumentBuilderFactory",documentBuilderFactory);
System.setProperty("javax.xml.transform.TransformerFactory",transformerFactoryImpl);
Though my XML parsing works with this setting, using org.apache.xerces is very slow(~2 sec per xml file). any idea what could be wrong ?
Thanks,
Murthy
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04738 seconds