+ private DOMSource readDOMSource() throws IOException {
+ String xml = readObject().toString();
+ try {
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ factory.setNamespaceAware(true);
+ Element node = factory.newDocumentBuilder().parse(
+ new InputSource(new StringReader(xml))).getDocumentElement();
+ return new DOMSource(node);
+ } catch (SAXException | ParserConfigurationException e) {
+ throw new IOException("Error parsing XML: " + xml, e);
+ }
+ }
+