- * Parses an XML document from a string.
- *
- * @param aDocument
- * document.
- *
- * @return
- *
- */
- public static Document read(String aDocument) throws XMLException {
- ByteArrayInputStream is = new ByteArrayInputStream(aDocument.getBytes());
-
- return read(is);
- }
-
- /**
- * Parses an XML document from a stream.
- *
- * @param aIs
- * Input stream.
- *
- * @return
- *
- */
- public static Document read(InputStream aIs) throws XMLException {
- try {
- DocumentBuilder builder = DocumentBuilderFactory.newInstance()
- .newDocumentBuilder();
-
- return builder.parse(aIs);
- } catch (SAXException e) {
- throw new XMLException(e.getMessage(), e);
- } catch (IOException e) {
- throw new XMLException(e.getMessage(), e);
- } catch (ParserConfigurationException e) {
- throw new XMLException(e.getMessage(), e);
- } finally {
- try {
- aIs.close();
- } catch (Exception e) {
- LOG.log(Level.WARNING, "Error closing XML file", e);
- }
- }
- }
-
- /**
- * Reads and validates a document against a schema.
- *
- * @param aIs
- * Input stream.
- * @param aSchema
- * Schema.
- *
- * @return Parsed and validated document.
- *
+ * Gets a dom level 3 implementation.
+ * @return Dom implementation.
+ * @throws ClassNotFoundException
+ * @throws InstantiationException
+ * @throws IllegalAccessException