gpt4 book ai didi

org.fcrepo.utilities.xml.XercesXmlSerializers.writeXmlNoSpace()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-27 04:03:05 26 4
gpt4 key购买 nike

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

XercesXmlSerializers.writeXmlNoSpace介绍

[英]Serialize the dom Document with no preserved space between elements, but without indenting, line wrapping, omission of XML declaration, or omission of doctype
[中]序列化dom文档,元素之间不留空格,但不缩进、换行、省略XML声明或省略doctype

代码示例

代码示例来源:origin: fcrepo3/fcrepo

public static InputStream fedoraXMLHashFormat(byte[] data) throws Exception {
  ReadableCharArrayWriter writer = new ReadableCharArrayWriter();
  Document doc =
    XmlTransformUtility.parseNamespaceAware(new ByteArrayInputStream(data));
  XercesXmlSerializers.writeXmlNoSpace(doc, "UTF-8", writer);
  writer.close();
  BufferedReader br =
      new BufferedReader(writer.toReader());
  String line = null;
  ReadableByteArrayOutputStream outStream = new ReadableByteArrayOutputStream();
  OutputStreamWriter sb = new OutputStreamWriter(outStream, "UTF-8");
  while ((line = br.readLine()) != null) {
    line = line.trim();
    sb.write(line);
  }
  sb.close();
  return outStream.toInputStream();
}

代码示例来源:origin: fcrepo3/fcrepo

public static byte[] fedoraXMLHashFormat(byte[] data) throws Exception {
  ReadableCharArrayWriter writer = new ReadableCharArrayWriter();
  DocumentBuilder builder = XmlTransformUtility.borrowDocumentBuilder();
  try {
    Document doc = builder.parse(new ByteArrayInputStream(data));
    XercesXmlSerializers.writeXmlNoSpace(doc, "UTF-8", writer);
    writer.close();
  } finally {
    XmlTransformUtility.returnDocumentBuilder(builder);
  }
  BufferedReader br =
      new BufferedReader(writer.toReader());
  String line = null;
  ReadableByteArrayOutputStream outStream = new ReadableByteArrayOutputStream();
  OutputStreamWriter sb = new OutputStreamWriter(outStream, "UTF-8");
  while ((line = br.readLine()) != null) {
    line = line.trim();
    sb.write(line);
  }
  sb.close();
  return outStream.toByteArray();
}

代码示例来源:origin: org.fcrepo/fcrepo-server

builder = XmlTransformUtility.borrowDocumentBuilder();
  Document doc = builder.parse(new ByteArrayInputStream(xmlContent));
  XercesXmlSerializers.writeXmlNoSpace(doc, m_encoding, out);
  out.close();
} finally {

代码示例来源:origin: fcrepo3/fcrepo

builder = XmlTransformUtility.borrowDocumentBuilder();
  Document doc = builder.parse(new ByteArrayInputStream(xmlContent));
  XercesXmlSerializers.writeXmlNoSpace(doc, m_encoding, out);
  out.close();
} finally {

代码示例来源:origin: fcrepo3/fcrepo

@SuppressWarnings("deprecation")
private void testWriteXmlNoSpace(Document doc) throws Exception {
  StringWriter sout = new StringWriter();
  SunXmlSerializers.writeXmlNoSpace(doc, "UTF-8", sout);
  String proprietary = sout.toString();
  sout = new StringWriter();
  XercesXmlSerializers.writeXmlNoSpace(doc, "UTF-8", sout);
  String standard = sout.toString();
  if (!proprietary.equals(standard)) {
    System.out.println("<<<<");
    System.out.println(proprietary);
    System.out.println(">>>>");
    System.out.println(standard);
  }
  assertEquals(proprietary, standard);
}

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com