本文整理汇总了Java中org.jdom2.output.XMLOutputter.setXMLOutputProcessor方法的典型用法代码示例。如果您正苦于以下问题:Java XMLOutputter.setXMLOutputProcessor方法的具体用法?Java XMLOutputter.setXMLOutputProcessor怎么用?Java XMLOutputter.setXMLOutputProcessor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jdom2.output.XMLOutputter
的用法示例。
在下文中一共展示了XMLOutputter.setXMLOutputProcessor方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: outputXHTMLDocument
import org.jdom2.output.XMLOutputter; //导入方法依赖的package包/类
public static byte[] outputXHTMLDocument(Document document)
{
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try
{
document.setDocType(Constants.DOCTYPE_XHTML.clone());
XMLOutputter outputter = new XMLOutputter();
Format xmlFormat = Format.getPrettyFormat();
outputter.setFormat(xmlFormat);
outputter.setXMLOutputProcessor(new XHTMLOutputProcessor());
outputter.output(document, baos);
}
catch (IOException e)
{
logger.error("", e);
}
return baos.toByteArray();
}
示例2: repair
import org.jdom2.output.XMLOutputter; //导入方法依赖的package包/类
public static String repair(String originalHtml)
{
String content = null;
try
{
HtmlCleaner cleaner = createHtmlCleaner();
//wir probieren es erstmal mit UTF-8
TagNode rootNode = cleaner.clean(originalHtml);
Document jdomDocument = new JDomSerializer(cleaner.getProperties(), false).createJDom(rootNode);
jdomDocument.setDocType(Constants.DOCTYPE_XHTML.clone());
XMLOutputter outputter = new XMLOutputter();
Format xmlFormat = Format.getPrettyFormat();
outputter.setFormat(xmlFormat);
outputter.setXMLOutputProcessor(new XHTMLOutputProcessor());
content = outputter.outputString(jdomDocument);
}
catch (IllegalAddException e)
{
logger.error("", e);
}
return content;
}
示例3: okAction
import org.jdom2.output.XMLOutputter; //导入方法依赖的package包/类
public void okAction(ActionEvent actionEvent) throws IOException
{
for (Element headElement : headElements.keySet())
{
for (StylesheetResource stylesheetResource : stylesheetResources)
{
Resource resource = headElements.get(headElement);
if (stylesheetResource.isIncluded())
{
Element styleElement = new Element("link", Constants.NAMESPACE_XHTML);
styleElement.setAttribute("href", resource.relativize(stylesheetResource.getStylesheet()));
styleElement.setAttribute("rel", "stylesheet");
styleElement.setAttribute("type", "text/css");
headElement.addContent(styleElement);
}
Document document = headElement.getDocument();
XMLOutputter outputter = new XMLOutputter();
Format xmlFormat = Format.getPrettyFormat();
outputter.setFormat(xmlFormat);
outputter.setXMLOutputProcessor(new XHTMLOutputProcessor());
ByteArrayOutputStream bos = new ByteArrayOutputStream();
outputter.output(document, bos);
resource.setData(bos.toByteArray());
editorManager.refreshEditorCode(resource);
}
}
editorManager.refreshPreview();
stage.close();
}