// private functions private IChemFile readChemFile(IChemFile file) { //logger.debug("Started parsing from input..."); ChemFileCDO cdo = new ChemFileCDO(file); try { parser.setFeature("http://xml.org/sax/features/validation", false); //logger.info("Deactivated validation"); } //UPGRADE_TODO: Class 'org.xml.sax.SAXException' was converted to 'System.Xml.XmlException' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073'" catch (System.Xml.XmlException e) { //logger.warn("Cannot deactivate validation."); return(cdo); } parser.setContentHandler(new CMLHandler((IChemicalDocumentObject)cdo)); parser.setEntityResolver(new CMLResolver()); //UPGRADE_TODO: Method 'org.xml.sax.XMLReader.setErrorHandler' was converted to 'XmlSAXDocumentManager.SetErrorHandler' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_orgxmlsaxXMLReadersetErrorHandler_orgxmlsaxErrorHandler'" parser.setErrorHandler(new CMLErrorHandler()); try { if (input == null) { //logger.debug("Parsing from URL: ", url); parser.parse(url); } else { //logger.debug("Parsing from Reader"); input.BaseStream.Seek(0, SeekOrigin.Begin); parser.parse(new XmlSourceSupport(input)); } } catch (System.IO.IOException e) { //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Throwable.getMessage' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'" System.String error = "Error while reading file: " + e.Message; //logger.error(error); //logger.debug(e); throw new CDKException(error, e); } //UPGRADE_TODO: Class 'org.xml.sax.SAXParseException' was converted to 'System.xml.XmlException' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073'" catch (System.Xml.XmlException saxe) { //UPGRADE_TODO: Class 'org.xml.sax.SAXParseException' was converted to 'System.xml.XmlException' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073'" System.Xml.XmlException spe = (System.Xml.XmlException)saxe; System.String error = "Found well-formedness error in line " + spe.LineNumber; //logger.error(error); //logger.debug(saxe); throw new CDKException(error, saxe); } //UPGRADE_TODO: Class 'org.xml.sax.SAXException' was converted to 'System.Xml.XmlException' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073'" //catch (System.Xml.XmlException saxe) //{ // System.String error = "Error while parsing XML: " + saxe.Message; // //logger.error(error); // //logger.debug(saxe); // throw new CDKException(error, saxe); //} return(cdo); }