Search in sources :

Example 1 with XmlDataType

use of net.sourceforge.sqlexplorer.dataset.XmlDataType in project tdq-studio-se by Talend.

the class XmlPreviewer method getXml.

private Element getXml(Object data) throws ExplorerException {
    try {
        if (data == null)
            return null;
        if (data instanceof XmlDataType)
            return ((XmlDataType) data).getRootElement();
        String text = data.toString();
        if (text == null)
            return null;
        SAXReader reader = new SAXReader();
        return reader.read(new StringReader(text)).getRootElement();
    } catch (DocumentException e) {
        throw new ExplorerException(e);
    }
}
Also used : ExplorerException(net.sourceforge.sqlexplorer.ExplorerException) XmlDataType(net.sourceforge.sqlexplorer.dataset.XmlDataType) SAXReader(org.dom4j.io.SAXReader) DocumentException(org.dom4j.DocumentException) StringReader(java.io.StringReader)

Aggregations

StringReader (java.io.StringReader)1 ExplorerException (net.sourceforge.sqlexplorer.ExplorerException)1 XmlDataType (net.sourceforge.sqlexplorer.dataset.XmlDataType)1 DocumentException (org.dom4j.DocumentException)1 SAXReader (org.dom4j.io.SAXReader)1