本文整理了Java中org.apereo.portal.xml.XmlUtilitiesImpl.getXmlOutputFactory()
方法的一些代码示例,展示了XmlUtilitiesImpl.getXmlOutputFactory()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XmlUtilitiesImpl.getXmlOutputFactory()
方法的具体详情如下:
包路径:org.apereo.portal.xml.XmlUtilitiesImpl
类名称:XmlUtilitiesImpl
方法名:getXmlOutputFactory
暂无
代码示例来源:origin: Jasig/uPortal
@Override
public Node convertToDom(XMLEventReader xmlEventReader) throws XMLStreamException {
// Convert the XmlEventReader into a DOM
final XMLOutputFactory xmlOutputFactory = this.getXmlOutputFactory();
final DOMResult sourceDom = new DOMResult(DocumentFactory.getThreadDocument());
final XMLEventWriter sourceWriter = xmlOutputFactory.createXMLEventWriter(sourceDom);
sourceWriter.add(xmlEventReader);
sourceWriter.flush();
sourceWriter.close();
return sourceDom.getNode();
}
代码示例来源:origin: org.jasig.portal/uPortal-utils-core
@Override
public Node convertToDom(XMLEventReader xmlEventReader) throws XMLStreamException {
// Convert the XmlEventReader into a DOM
final XMLOutputFactory xmlOutputFactory = this.getXmlOutputFactory();
final DOMResult sourceDom = new DOMResult(DocumentFactory.getThreadDocument());
final XMLEventWriter sourceWriter = xmlOutputFactory.createXMLEventWriter(sourceDom);
sourceWriter.add(xmlEventReader);
sourceWriter.flush();
sourceWriter.close();
return sourceDom.getNode();
}
代码示例来源:origin: Jasig/uPortal
@Override
public String serializeXMLEvents(List<XMLEvent> xmlEvents, boolean isHtml) {
final XMLOutputFactory outputFactory;
if (isHtml) {
outputFactory = this.getHtmlOutputFactory();
} else {
outputFactory = this.getXmlOutputFactory();
}
final StringWriter writer = new StringWriter();
final XMLEventWriter xmlEventWriter;
try {
xmlEventWriter =
new IndentingXMLEventWriter(outputFactory.createXMLEventWriter(writer));
} catch (XMLStreamException e) {
throw new RuntimeException("Failed to create XMLEventWriter", e);
}
try {
for (final XMLEvent bufferedEvent : xmlEvents) {
xmlEventWriter.add(bufferedEvent);
}
xmlEventWriter.flush();
xmlEventWriter.close();
} catch (XMLStreamException e) {
throw new RuntimeException("Failed to write XMLEvents to XMLEventWriter", e);
}
return writer.toString();
}
代码示例来源:origin: org.jasig.portal/uPortal-utils-core
@Override
public String serializeXMLEvents(List<XMLEvent> xmlEvents, boolean isHtml) {
final XMLOutputFactory outputFactory;
if (isHtml) {
outputFactory = this.getHtmlOutputFactory();
} else {
outputFactory = this.getXmlOutputFactory();
}
final StringWriter writer = new StringWriter();
final XMLEventWriter xmlEventWriter;
try {
xmlEventWriter =
new IndentingXMLEventWriter(outputFactory.createXMLEventWriter(writer));
} catch (XMLStreamException e) {
throw new RuntimeException("Failed to create XMLEventWriter", e);
}
try {
for (final XMLEvent bufferedEvent : xmlEvents) {
xmlEventWriter.add(bufferedEvent);
}
xmlEventWriter.flush();
xmlEventWriter.close();
} catch (XMLStreamException e) {
throw new RuntimeException("Failed to write XMLEvents to XMLEventWriter", e);
}
return writer.toString();
}
内容来源于网络,如有侵权,请联系作者删除!