private static Document resolveXml(String xml) throws DocumentException {
        Document document = null;
        String s = xml == null ? "" : xml.trim();
        if (s.isEmpty()) {
            return document;
        }
        if (!s.startsWith(Constant.XML_HEADER)) {
            s = Constant.XML_HEADER + s;
        }
        document = DocumentHelper.parseText(s);
        return document;
    }