public static Document parseXmlStream(InputStream xml) throws IOException {
		createFactories();

		// Create the document builder.
		Document doc = null;

		if(xml != null) {
			DocumentBuilder builder = null;
			try {
				builder = Utilities.dbFactory.newDocumentBuilder();
			} catch(ParserConfigurationException e) {
				throw new IOException("Unable to create XML builder.", e);
			}

			try {
				doc = builder.parse(xml);
			} catch(SAXException e) {
				throw new IOException("Unable to parse XML document.", e);
			}
		}

		return doc;
	}