01: package ru.emdev.EmForge.wiki;
02:
03: import java.io.IOException;
04: import java.io.Writer;
05:
06: import org.apache.commons.lang.StringUtils;
07: import org.jdom.Element;
08: import org.jdom.output.XMLOutputter;
09:
10: public class EmForgeXMLOutputter extends XMLOutputter {
11:
12: @Override
13: protected void printElement(Writer out, Element element, int level,
14: NamespaceStack namespaces) throws IOException {
15: if (StringUtils.equalsIgnoreCase(element.getName(), "pre")) {
16: // special processing for pre element - we shoudl insert also <code> around pre content
17: Element pre = new Element("pre");
18: Element code = new Element("code");
19:
20: code.addContent(element.cloneContent());
21: pre.addContent(code);
22:
23: super.printElement(out, pre, level, namespaces);
24: } else {
25: super.printElement(out, element, level, namespaces);
26: }
27: }
28: }
|