public Document parse(InputSource inputSource) throws XMLPlatformException { try { return getDocumentBuilder().parse(inputSource); } catch (SAXException e) { throw XMLPlatformException.xmlPlatformParseException(e); } catch (IOException e) { throw XMLPlatformException.xmlPlatformParseException(e); } }
private DocumentBuilder getDocumentBuilder() { try { DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); documentBuilder.setEntityResolver(entityResolver); documentBuilder.setErrorHandler(errorHandler); return documentBuilder; } catch (ParserConfigurationException e) { throw XMLPlatformException.xmlPlatformParseException(e); } }
public JAXPParser(Map<String, Boolean> parserFeatures) { this(); try { if(null != parserFeatures) { for(String parserFeature : parserFeatures.keySet()) { documentBuilderFactory.setFeature(parserFeature, parserFeatures.get(parserFeature)); } } } catch(Exception e) { throw XMLPlatformException.xmlPlatformParseException(e); } }
public Document parse(InputSource inputSource) throws XMLPlatformException { try { return getDocumentBuilder().parse(inputSource); } catch (SAXException e) { throw XMLPlatformException.xmlPlatformParseException(e); } catch (IOException e) { throw XMLPlatformException.xmlPlatformParseException(e); } }
private DocumentBuilder getDocumentBuilder() { try { DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); documentBuilder.setEntityResolver(entityResolver); documentBuilder.setErrorHandler(errorHandler); return documentBuilder; } catch (ParserConfigurationException e) { throw XMLPlatformException.xmlPlatformParseException(e); } } }
public Document parse(InputSource inputSource) throws XMLPlatformException { try { return getDocumentBuilder().parse(inputSource); } catch (SAXException e) { throw XMLPlatformException.xmlPlatformParseException(e); } catch (IOException e) { throw XMLPlatformException.xmlPlatformParseException(e); } }
private DocumentBuilder getDocumentBuilder() { try { DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); documentBuilder.setEntityResolver(entityResolver); documentBuilder.setErrorHandler(errorHandler); return documentBuilder; } catch (ParserConfigurationException e) { throw XMLPlatformException.xmlPlatformParseException(e); } }
/** * Parses given input source. * * @param inputSource input source to parse * @return parsed document * @throws XMLPlatformException exception occurred while parsing input source */ public Document parse(InputSource inputSource) throws XMLPlatformException { try { return getDocumentBuilder().parse(inputSource); } catch (SAXException e) { throw XMLPlatformException.xmlPlatformParseException(e); } catch (IOException e) { throw XMLPlatformException.xmlPlatformParseException(e); } }
/** * Parses given input source. * * @param inputSource input source to parse * @return parsed document * @throws XMLPlatformException exception occurred while parsing input source */ @Override public Document parse(InputSource inputSource) throws XMLPlatformException { try { return getDocumentBuilder().parse(inputSource); } catch (SAXException e) { throw XMLPlatformException.xmlPlatformParseException(e); } catch (IOException e) { throw XMLPlatformException.xmlPlatformParseException(e); } }
/** * This constructor provides way to specify features for parser. * * @param parserFeatures features for parser */ public JAXPParser(Map<String, Boolean> parserFeatures) { this(); try { if(null != parserFeatures) { for(Entry<String, Boolean> entry : parserFeatures.entrySet()) { documentBuilderFactory.setFeature(entry.getKey(), entry.getValue()); } } } catch(Exception e) { throw XMLPlatformException.xmlPlatformParseException(e); } }
public Document parse(InputStream inputStream) throws XMLPlatformException { try { return getDocumentBuilder().parse(inputStream); } catch (SAXParseException e) { throw XMLPlatformException.xmlPlatformSAXParseException(e); } catch (SAXException e) { throw XMLPlatformException.xmlPlatformParseException(e); } catch (IOException e) { throw XMLPlatformException.xmlPlatformParseException(e); } }
public Document parse(InputStream inputStream) throws XMLPlatformException { try { return getDocumentBuilder().parse(inputStream); } catch (SAXParseException e) { throw XMLPlatformException.xmlPlatformSAXParseException(e); } catch (SAXException e) { throw XMLPlatformException.xmlPlatformParseException(e); } catch (IOException e) { throw XMLPlatformException.xmlPlatformParseException(e); } }
public Document parse(InputStream inputStream) throws XMLPlatformException { try { return getDocumentBuilder().parse(inputStream); } catch (SAXParseException e) { throw XMLPlatformException.xmlPlatformSAXParseException(e); } catch (SAXException e) { throw XMLPlatformException.xmlPlatformParseException(e); } catch (IOException e) { throw XMLPlatformException.xmlPlatformParseException(e); } }
/** * This constructor provides way to specify features for parser. * * @param parserFeatures features for parser */ public JAXPParser(Map<String, Boolean> parserFeatures) { this(); loadDocumentBuilderFactory(); try { if(null != parserFeatures) { for(Entry<String, Boolean> entry : parserFeatures.entrySet()) { documentBuilderFactory.setFeature(entry.getKey(), entry.getValue()); } } } catch(Exception e) { throw XMLPlatformException.xmlPlatformParseException(e); } }
public Document parse(Source source) throws XMLPlatformException { try { TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = transformerFactory.newTransformer(); SAXResult saxResult = new SAXResult(); SAXDocumentBuilder builder = new SAXDocumentBuilder(); saxResult.setHandler(builder); transformer.transform(source, saxResult); return builder.getDocument(); } catch (TransformerException e) { throw XMLPlatformException.xmlPlatformParseException(e); } }
private DocumentBuilder getDocumentBuilder() { try { if (null == documentBuilder) { if (null == documentBuilderFactory) { loadDocumentBuilderFactory(); } documentBuilder = documentBuilderFactory.newDocumentBuilder(); documentBuilder.setEntityResolver(entityResolver); documentBuilder.setErrorHandler(errorHandler); } else { documentBuilder.reset(); } return documentBuilder; } catch (ParserConfigurationException e) { throw XMLPlatformException.xmlPlatformParseException(e); } } }
public Document parse(File file) throws XMLPlatformException { try { return getDocumentBuilder().parse(file); } catch (SAXParseException e) { throw XMLPlatformException.xmlPlatformSAXParseException(e); } catch (SAXException e) { throw XMLPlatformException.xmlPlatformParseException(e); } catch (IOException e) { throw XMLPlatformException.xmlPlatformFileNotFoundException(file, e); } }
public Document parse(File file) throws XMLPlatformException { try { return getDocumentBuilder().parse(file); } catch (SAXParseException e) { throw XMLPlatformException.xmlPlatformSAXParseException(e); } catch (SAXException e) { throw XMLPlatformException.xmlPlatformParseException(e); } catch (IOException e) { throw XMLPlatformException.xmlPlatformFileNotFoundException(file, e); } }
public Document parse(File file) throws XMLPlatformException { try { return getDocumentBuilder().parse(file); } catch (SAXParseException e) { throw XMLPlatformException.xmlPlatformSAXParseException(e); } catch (SAXException e) { throw XMLPlatformException.xmlPlatformParseException(e); } catch (IOException e) { throw XMLPlatformException.xmlPlatformFileNotFoundException(file, e); } }
/** * Parses given file. * * @param file file to parse * @return parsed document * @throws XMLPlatformException exception occurred while parsing given file */ public Document parse(File file) throws XMLPlatformException { try { return getDocumentBuilder().parse(file); } catch (SAXParseException e) { throw XMLPlatformException.xmlPlatformSAXParseException(e); } catch (SAXException e) { throw XMLPlatformException.xmlPlatformParseException(e); } catch (IOException e) { throw XMLPlatformException.xmlPlatformFileNotFoundException(file, e); } }