2 * Svjatoslav Commons - shared library of common functionality.
3 * Copyright ©2012-2014, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of version 3 of the GNU Lesser General Public License
7 * or later as published by the Free Software Foundation.
10 package eu.svjatoslav.commons.data.xml;
12 import java.io.IOException;
13 import java.io.InputStream;
15 import javax.xml.parsers.DocumentBuilder;
16 import javax.xml.parsers.DocumentBuilderFactory;
17 import javax.xml.parsers.ParserConfigurationException;
19 import org.w3c.dom.Document;
20 import org.xml.sax.SAXException;
22 public class XmlHelper {
24 public static XmlElement parseXml(final InputStream inputStream)
25 throws SAXException, IOException, ParserConfigurationException {
27 final DocumentBuilderFactory builderFactory = DocumentBuilderFactory
30 final DocumentBuilder builder = builderFactory.newDocumentBuilder();
32 final Document document = builder.parse(inputStream);
34 final XmlElement xmlElement = new XmlElement(
35 document.getDocumentElement());