2 * Svjatoslav Commons - shared library of common functionality.
3 * Copyright ©2012-2013, 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 2 of the GNU General Public License
7 * as published by the Free Software Foundation.
9 package eu.svjatoslav.commons.data.xml;
11 import java.io.IOException;
12 import java.io.InputStream;
14 import javax.xml.parsers.DocumentBuilder;
15 import javax.xml.parsers.DocumentBuilderFactory;
16 import javax.xml.parsers.ParserConfigurationException;
18 import org.w3c.dom.Document;
19 import org.xml.sax.SAXException;
21 public class XmlHelper {
23 public static XmlElement parseXml(final InputStream inputStream)
24 throws SAXException, IOException, ParserConfigurationException {
26 final DocumentBuilderFactory builderFactory = DocumentBuilderFactory
29 final DocumentBuilder builder = builderFactory.newDocumentBuilder();
31 final Document document = builder.parse(inputStream);
33 final XmlElement xmlElement = new XmlElement(
34 document.getDocumentElement());