Logo Search packages:      
Sourcecode: cdk version File versions  Download package

Vector org::openscience::cdk::config::elements::ElementPTReader::readElements (  )  [inline]

Triggers the XML parsing of the data file and returns the read Isotopes. It turns of XML validation before parsing.

Returns:
a Vector of Isotope's. Returns an empty vector is some reading error occured.

Definition at line 122 of file ElementPTReader.java.

References org::openscience::cdk::tools::LoggingTool::debug(), org::openscience::cdk::tools::LoggingTool::error(), org::openscience::cdk::config::elements::ElementPTHandler::getElements(), org::openscience::cdk::tools::LoggingTool::info(), and org::openscience::cdk::tools::LoggingTool::warn().

Referenced by org::openscience::cdk::config::ElementPTFactory::ElementPTFactory().

                                 {
        Vector elements = new Vector();
        try {
            parser.setFeature("http://xml.org/sax/features/validation", false);
            logger.info("Deactivated validation");
        } catch (SAXException exception) {
            logger.warn("Cannot deactivate validation: ", exception.getMessage());
            logger.debug(exception);
        }
        ElementPTHandler handler = new ElementPTHandler();
        parser.setContentHandler(handler);
        try {
            parser.parse(new InputSource(input));
            elements = handler.getElements();
        } catch (IOException exception) {
            logger.error("IOException: ", exception.getMessage());
            logger.debug(exception);
        } catch (SAXException saxe) {
            logger.error("SAXException: ", saxe.getClass().getName());
            logger.error(saxe.getMessage());
            logger.debug(saxe);
        }
        return elements;
    }


Generated by  Doxygen 1.6.0   Back to index