Hi Madhav,
Thanks for your feedback.
Here is the code,
protected
String stripMessage(String filename) throws XMLException {
try {
File newFile1 = new File(filename+".strip1");
metaDataFile = newFile1.getAbsolutePath();
File newFile2 = new File(filename+".strip2");
messageFile = newFile2.getAbsolutePath();
// Perform stripping of header using SAX Parser
XMLFileSplitter xmlFileSplitter = new XMLFileSplitter();
xmlFileSplitter.setDestFile(metaDataFile);
xmlFileSplitter.setXMLHeader(filename);
xmlFileSplitter.setDataFile(messageFile);
xmlFileSplitter.setMessageTag(messageTag);
if (!xmlDTDPath.trim().equals("")) xmlFileSplitter.setDTDPath
(xmlDTDPath);
SAXParserFactory factory = SAXParserFactory.newInstance();
factory.setValidating(true);
SAXParser saxParser = factory.newSAXParser();
saxParser.parse(filename, xmlFileSplitter);
Log.info("File contains meta data = " + metaDataFile);
Log.info("File name contains message = " + messageFile);
Log.info("End stripMessage()");
} catch (SAXParseException se){
Log.error("SAXParseException: " + se.getMessage());
throw new XMLException ("","Error parsing xml file using SAX
parser",+ se);
} catch(SAXException s){
Log.error("SAXException: " + s.getMessage());
} catch(ParserConfigurationException pe){
Log.error("ParserConfigurationException: " + pe.getMessage());
} catch(IOException io){
Log.error("IOException: " + io.getMessage());
} catch(Exception e){
e.printStackTrace();
Log.error("Exception: " + e.getMessage());
}
return metaDataFile;
}
Here is the XMLFileSplitter for resolve entity,
public InputSource resolveEntity(String publicId, String systemId)
throws SAXException
{
Log.info("Configure DTD Path...");
Log.info("PublicID = " + publicId);
Log.info("SystemID = " + systemId);
//int x = systemId.lastIndexOf(File.separator);
// change dtd definition only if xmldtdPath is supplied
if ((xmlDtdPath != null) && !(xmlDtdPath.trim().equals(""))) {
int x = systemId.lastIndexOf("/");
String dtdname = systemId.substring(x+1, systemId.length());
Log.info("DTDName = " + dtdname);
getFileSep();
String newDTDurl = "file:\\" + xmlDtdPath + fileSep + dtdname;
Log.info("New DTDPath = " + newDTDurl);
return new InputSource(newDTDurl);
}
else
{
return new InputSource(systemId);
}
thanks in advance for your time.
best regards,
ravi.

[ November 05, 2004: Message edited by: Ravikumar Jambunathan ]