org.apereo.portal.xml.XmlUtilitiesImpl.getXmlOutputFactory()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(2.9k)|赞(0)|评价(0)|浏览(98)

本文整理了Java中org.apereo.portal.xml.XmlUtilitiesImpl.getXmlOutputFactory()方法的一些代码示例,展示了XmlUtilitiesImpl.getXmlOutputFactory()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XmlUtilitiesImpl.getXmlOutputFactory()方法的具体详情如下:
包路径:org.apereo.portal.xml.XmlUtilitiesImpl
类名称:XmlUtilitiesImpl
方法名:getXmlOutputFactory

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();
}

相关文章