use of org.jdom.output.Format in project yamcs-studio by yamcs.
the class XMLUtil method getXMLOutputter.
/**
* Create and configure an XMLOutputter object.
*
* @param prettyFormat
* @return the XMLOutputter
*/
private static XMLOutputter getXMLOutputter(boolean prettyFormat) {
Format format = Format.getRawFormat();
if (prettyFormat)
// $NON-NLS-1$
format.setIndent(" ");
// Always use Unix-style line endings.
format.setLineSeparator("\n");
XMLOutputter xmlOutputter = new XMLOutputter();
xmlOutputter.setFormat(format);
return xmlOutputter;
}
use of org.jdom.output.Format in project entando-core by entando.
the class PageModelDOM method getXMLDocument.
public String getXMLDocument() {
XMLOutputter out = new XMLOutputter();
Format format = Format.getPrettyFormat();
format.setIndent("\t");
out.setFormat(format);
return out.outputString(this._doc);
}
use of org.jdom.output.Format in project entando-core by entando.
the class WidgetTypeDOM method getXMLDocument.
public String getXMLDocument() {
XMLOutputter out = new XMLOutputter();
Format format = Format.getPrettyFormat();
format.setIndent("");
out.setFormat(format);
return out.outputString(this.getDoc());
}
use of org.jdom.output.Format in project entando-core by entando.
the class DataSourceDumpReport method toXml.
public String toXml() {
try {
Document doc = new Document();
Element rootElement = new Element(ROOT_ELEMENT);
this.addElement(DATE_ELEMENT, DateConverter.getFormattedDate(this.getDate(), DATE_FORMAT), rootElement);
this.addElement(REQUIRED_TIME_ELEMENT, String.valueOf(this.getRequiredTime()), rootElement);
this.addElement(SUBFOLDER_NAME_ELEMENT, this.getSubFolderName(), rootElement);
Element components = new Element(COMPONENTS_HISTORY_ELEMENT);
rootElement.addContent(components);
List<ComponentInstallationReport> componentsHistory = this.getComponentsHistory();
for (int i = 0; i < componentsHistory.size(); i++) {
ComponentInstallationReport componentHistory = componentsHistory.get(i);
Element element = componentHistory.toJdomElement();
components.addContent(element);
}
List<String> dataSourceNames = new ArrayList<String>();
dataSourceNames.addAll(this.getDataSourcesReports().keySet());
for (int i = 0; i < dataSourceNames.size(); i++) {
String dataSourceName = dataSourceNames.get(i);
Element dataSourceElement = new Element(DATASOURCE_ELEMENT);
rootElement.addContent(dataSourceElement);
dataSourceElement.setAttribute(NAME_ATTRIBUTE, dataSourceName);
List<TableDumpReport> tableReports = this.getDataSourcesReports().get(dataSourceName);
BeanComparator comparator = new BeanComparator("tableName");
Collections.sort(tableReports, comparator);
for (int j = 0; j < tableReports.size(); j++) {
TableDumpReport tableDumpReport = tableReports.get(j);
dataSourceElement.addContent(tableDumpReport.toJdomElement());
}
}
doc.setRootElement(rootElement);
XMLOutputter out = new XMLOutputter();
Format format = Format.getPrettyFormat();
format.setIndent("\t");
out.setFormat(format);
return out.outputString(doc);
} catch (Throwable t) {
_logger.error("Error creating XML", t);
throw new RuntimeException("Error creating XML", t);
}
}
use of org.jdom.output.Format in project entando-core by entando.
the class LangDOM method getXMLDocument.
/**
* Restutuisce l'xml del documento.
* @return L'xml del documento.
*/
public String getXMLDocument() {
XMLOutputter out = new XMLOutputter();
Format format = Format.getPrettyFormat();
out.setFormat(format);
String xml = out.outputString(this.doc);
return xml;
}
Aggregations