public AtmosphereConfig parse(AtmosphereConfig config, String filename) throws FileNotFoundException { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); try { return parse(config, factory.newDocumentBuilder().parse(filename)); } catch (SAXException e) { logger.error(e.getMessage(), e); throw new RuntimeException(e); } catch (IOException e) { logger.error(e.getMessage(), e); throw new RuntimeException(e); } catch (ParserConfigurationException e) { logger.error(e.getMessage(), e); throw new RuntimeException(e); } }
/** * Generate HTML for the entire MainDocumentPart. * @return */ public org.w3c.dom.Document export() { ByteArrayOutputStream outStream = new ByteArrayOutputStream(DEFAULT_OUTPUT_SIZE); Document ret = null; try { Docx4J.toHTML(htmlSettings, outStream, Docx4J.FLAG_EXPORT_PREFER_NONXSL); ret = XmlUtils.getNewDocumentBuilder().parse(new ByteArrayInputStream(outStream.toByteArray())); } catch (Docx4JException e) { log.error("Exception exporting document: " + e.getMessage(), e); } catch (SAXException e) { log.error("Exception parsing document: " + e.getMessage(), e); } catch (IOException e) { log.error("Exception parsing document: " + e.getMessage(), e); } return ret; }
sourceOrderXmlDom = DOCUMENT_BUILDER.parse(sourceOrderXmlFile); } catch (SAXException e) { System.err.println("ERROR caught exception parsing input file: " + e.getMessage() + "\n"); e.printStackTrace();
} catch (IOException e) { System.out.println("An IOException has occurred while reading the " + "XML descriptors (" + e.getMessage() + ")."); } catch (SAXException e) { System.out.println("A SAXException has occurred while reading the " + "XML descriptors (" + e.getMessage() + ")."); } catch (IPlanetEjbc.EjbcException e) { System.out.println("An error has occurred while executing the ejbc "
private void parse(InputSource in, ContentHandler handler) throws IOException, ParserException { try { Document d = BUILDER_FACTORY.newDocumentBuilder().parse(in); buildCalendar(d, handler); } catch (ParserConfigurationException e) { throw new CalendarException(e); } catch (SAXException e) { if (e instanceof SAXParseException) { SAXParseException pe = (SAXParseException) e; throw new ParserException("Could not parse XML", pe.getLineNumber(), e); } throw new ParserException(e.getMessage(), -1, e); } }
result = e.getMessage(); } catch (final IOException e) { s_logger.debug("IOException: " + e.getMessage()); result = e.getMessage(); } catch (final ParserConfigurationException e) { s_logger.debug("ParserConfigurationException: " + e.getMessage()); result = e.getMessage(); } catch (final SAXException e) { s_logger.debug("SAXException: " + e.getMessage()); result = e.getMessage(); } catch (final TransformerConfigurationException e) { s_logger.debug("TransformerConfigurationException: " + e.getMessage());
elem = ReaderUtils.loadConfig(inputSource); } catch (ParserConfigurationException e) { throw new ValidationException("Problem parsing " + name + ":" + e.getMessage(), e); } catch (SAXException e) { throw new ValidationException( "XML problem with " + name + ":" + e.getMessage(), e);
public AtmosphereConfig parse(AtmosphereConfig config, InputStream stream) throws FileNotFoundException { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); try { return parse(config, factory.newDocumentBuilder().parse(stream)); } catch (SAXException e) { logger.error(e.getMessage(), e); throw new RuntimeException(e); } catch (IOException e) { logger.error(e.getMessage(), e); throw new RuntimeException(e); } catch (ParserConfigurationException e) { logger.error(e.getMessage(), e); throw new RuntimeException(e); } }
throw (BuildException) t; throw new BuildException(exc.getMessage(), t); } catch (FileNotFoundException exc) { throw new BuildException(exc); throw new BuildException("Encoding of project file is invalid.", exc); } catch (IOException exc) { throw new BuildException("Error reading project file: " + exc.getMessage(), exc); } finally { FileUtils.close(inputStream);
private void parse(InputSource in, ContentHandler handler) throws IOException, ParserException { try { Document d = BUILDER_FACTORY.newDocumentBuilder().parse(in); buildCalendar(d, handler); } catch (ParserConfigurationException e) { throw new CalendarException(e); } catch (SAXException e) { if (e instanceof SAXParseException) { SAXParseException pe = (SAXParseException) e; throw new ParserException("Could not parse XML", pe.getLineNumber(), e); } throw new ParserException(e.getMessage(), -1, e); } }
/** assert that input is well formed xml * @param xmlStream stream of content to check. */ public static void assertWellFormedXML(InputStream xmlStream) { try { assertNotNull("null document returned",DomHelper.newDocument(xmlStream)); } catch (ParserConfigurationException e) { Assert.fail("Problem with parser:" + e.getMessage()); } catch (SAXException e) { Assert.fail("xmlDocument is not well formed:" + e.getMessage()); } catch (IOException e) { Assert.fail("Problem reading document:" + e.getMessage()); } }
private static Document parseDocument(final InputStream stream, final DocumentBuilder builder) throws IOException { try { return builder.parse(stream); } catch (final SAXException ex) { throw new IOException(ex.getMessage(), ex); } }
private void readFile(String blastFile) throws IOException, ParseException{ logger.info("Start reading " + blastFile); try { blastDoc = XMLHelper.loadXML(blastFile); } catch (SAXException ex) { logger.error("A parsing error has occurred while reading XML blast file"); throw new ParseException(ex.getMessage(),0); } catch (ParserConfigurationException ex) { logger.error("Internal XML parser non properly configured"); throw new ParseException(ex.getMessage(),0); } logger.info("Read finished"); }
/** * Create a {@link DocumentBuilderFactory} element from WEB-INF/web.xml * * @param stream */ public WebDotXmlReader(InputStream stream) { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); try { parse(factory.newDocumentBuilder().parse(stream)); } catch (SAXException e) { logger.error(e.getMessage(), e); throw new RuntimeException(e); } catch (IOException e) { logger.error(e.getMessage(), e); throw new RuntimeException(e); } catch (ParserConfigurationException e) { logger.error(e.getMessage(), e); throw new RuntimeException(e); } }
throw (BuildException) t; throw new BuildException(exc.getMessage(), t == null ? exc : t); } catch (FileNotFoundException exc) { throw new BuildException(exc); } catch (IOException exc) { throw new BuildException("Error reading project file " + buildFileName + ": " + exc.getMessage(), exc); } finally { FileUtils.close(inputStream);
private void parse(InputSource in, ContentHandler handler) throws IOException, ParserException { try { Document d = BUILDER_FACTORY.newDocumentBuilder().parse(in); buildCalendar(d, handler); } catch (ParserConfigurationException e) { throw new CalendarException(e); } catch (SAXException e) { if (e instanceof SAXParseException) { SAXParseException pe = (SAXParseException) e; throw new ParserException("Could not parse XML", pe.getLineNumber(), e); } throw new ParserException(e.getMessage(), -1, e); } }
public static Document parse(InputStream inputStream) throws IOException { try { return documentBuilderThreadLocal.get().parse(inputStream); } catch (SAXException ex) { throw new IllegalStateException("Error parsing XML document " + ex.getMessage(),ex); } }
private void readFile(String blastFile) throws IOException, ParseException{ logger.info("Start reading " + blastFile); try { blastDoc = XMLHelper.loadXML(blastFile); } catch (SAXException ex) { logger.error("A parsing error has occurred while reading XML blast file"); throw new ParseException(ex.getMessage(),0); } catch (ParserConfigurationException ex) { logger.error("Internal XML parser non properly configured"); throw new ParseException(ex.getMessage(),0); } logger.info("Read finished"); }
private void writeUpdatedTMX (TiledMap tiledMap, FileHandle tmxFileHandle) throws IOException { Document doc; DocumentBuilder docBuilder; DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); try { docBuilder = docFactory.newDocumentBuilder(); doc = docBuilder.parse(tmxFileHandle.read()); Node map = doc.getFirstChild(); while (map.getNodeType() != Node.ELEMENT_NODE || map.getNodeName() != "map") { if ((map = map.getNextSibling()) == null) { throw new GdxRuntimeException("Couldn't find map node!"); } } setProperty(doc, map, "atlas", settings.tilesetOutputDirectory + "/" + settings.atlasOutputName + ".atlas"); TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = transformerFactory.newTransformer(); DOMSource source = new DOMSource(doc); outputDir.mkdirs(); StreamResult result = new StreamResult(new File(outputDir, tmxFileHandle.name())); transformer.transform(source, result); } catch (ParserConfigurationException e) { throw new RuntimeException("ParserConfigurationException: " + e.getMessage()); } catch (SAXException e) { throw new RuntimeException("SAXException: " + e.getMessage()); } catch (TransformerConfigurationException e) { throw new RuntimeException("TransformerConfigurationException: " + e.getMessage()); } catch (TransformerException e) { throw new RuntimeException("TransformerException: " + e.getMessage()); } }
"SAXException while parsing '" + descriptorFileName + "'. This probably indicates badly-formed XML." + " Details: " + se.getMessage(), se); } catch (IOException ioe) { "IOException while parsing'" + descriptorFileName + "'. This probably indicates that the descriptor" + " doesn't exist. Details: " + ioe.getMessage(), ioe);