Example usage for com.liferay.portal.kernel.xml DocumentException DocumentException

List of usage examples for com.liferay.portal.kernel.xml DocumentException DocumentException

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.xml DocumentException DocumentException.

Prototype

public DocumentException(Throwable cause) 

Source Link

Usage

From source file:com.liferay.portlet.dynamicdatamapping.util.DDMXMLImpl.java

License:Open Source License

public String formatXML(String xml) throws DocumentException, IOException {

    // This is only supposed to format your xml, however, it will also
    // unwantingly change © and other characters like it into their
    // respective readable versions

    xml = StringUtil.replace(xml, "&#", "[$SPECIAL_CHARACTER$]");

    try {//from   w  ww .j ava2s.co  m
        xml = XMLFormatter.toString(xml, _XML_INDENT);
    } catch (org.dom4j.DocumentException de) {
        throw new DocumentException(de.getMessage());
    }

    xml = StringUtil.replace(xml, "[$SPECIAL_CHARACTER$]", "&#");

    return xml;
}