We want to get startDocument callback in following scenarios: - When any input xml file is parsed before doing transformation. - Or when any file is opened using document function of XSLT.
Even after registering our own ContentHandler object in xmlReader object, we aren't getting any callbacks. While debugging the xalan code, I found that before parsing the input XML file, xalan is overriding the user supplied ContentHandler object, LexicalHandler object and DTDHandler object. Is there any way/workaround to get the callbacks? Any help would be appreciated. The code that we are using is as follows: String inputFilePath = "C:\\Users\\harshg.ADOBENET\\Desktop\\BugFiles\\document\\entity.xml"; String xslFilePath = "C:\\Users\\harshg.ADOBENET\\Desktop\\BugFiles\\document\\vendor.xsl"; String outputFilePath = "C:/Users/harshg.ADOBENET/Desktop/BugFiles/document/Data-out1.xml"; //1) Created the XMLReader and registered the ContentHandler as follows: XMLReader m_xmlReader = SAXParserFactory.newInstance().newSAXParser().getXMLReader(); m_xmlReader.setContentHandler(new FMSAXEventHandler()); //2) Created the TransformerFactory as follows: System.setProperty("javax.xml.transform.TransformerFactory", "org.apache.xalan.processor.TransformerFactoryImpl"); TransformerFactory m_tFactory = TransformerFactory.newInstance(); m_tFactory.setURIResolver(new FMURIResolver()); //3) Created the transformer as follows: Transformer transformer = m_tFactory.newTransformer(new StreamSource(new File(xslFilePath).toURI().toURL().toExternalForm())); //4) Transforming the input file as follows: transformer.transform(new SAXSource(m_xmlReader, new InputSource(new File(inputFilePath).toURI().toURL().toExternalForm())), new StreamResult(new OutputStreamWriter(new FileOutputStream(outputFilePath), "UTF-8"))); Thanks! Harsh Gupta Adobe Systems -- View this message in context: http://old.nabble.com/ContentHandler.startDocument-callback-not-coming%2C-while-transforming-the-input-XML-File.-tp33999640p33999640.html Sent from the Xalan - J - Users mailing list archive at Nabble.com.