/** * Construct a dom Element from a string. A utility function for creating * DOM elements when needed for other builder functions. * * @param xmlString * XML for an element. * @return w3c.dom.Element representation the provided XML. */ public static org.w3c.dom.Element domElement(String xmlString) { org.w3c.dom.Element element = null; try { ByteArrayInputStream bais = new ByteArrayInputStream( xmlString.getBytes(Charset.forName("UTF-8"))); element = getFactory().newDocumentBuilder().parse(bais) .getDocumentElement(); } catch (SAXException e) { throw new MarkLogicIOException( "Could not make Element from xmlString" + xmlString, e); } catch (IOException e) { throw new MarkLogicIOException( "Could not make Element from xmlString" + xmlString, e); } catch (ParserConfigurationException e) { throw new MarkLogicIOException( "Could not make Element from xmlString" + xmlString, e); } return element; }
/** * Construct a dom Element from a string. A utility function for creating * DOM elements when needed for other builder functions. * * @param xmlString * XML for an element. * @return w3c.dom.Element representation the provided XML. */ public static org.w3c.dom.Element domElement(String xmlString) { org.w3c.dom.Element element = null; try { ByteArrayInputStream bais = new ByteArrayInputStream( xmlString.getBytes(Charset.forName("UTF-8"))); element = getFactory().newDocumentBuilder().parse(bais) .getDocumentElement(); } catch (SAXException e) { throw new MarkLogicIOException( "Could not make Element from xmlString" + xmlString, e); } catch (IOException e) { throw new MarkLogicIOException( "Could not make Element from xmlString" + xmlString, e); } catch (ParserConfigurationException e) { throw new MarkLogicIOException( "Could not make Element from xmlString" + xmlString, e); } return element; }