gpt4 book ai didi

org.fcrepo.utilities.XmlTransformUtility.getTransformer()方法的使用及代码示例

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

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

XmlTransformUtility.getTransformer介绍

暂无

代码示例

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

public static Transformer getTransformer() throws Exception {
  return getTransformer(null);
}
public static Transformer getTransformer(Source src) throws Exception {

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

public static Transformer getTransformer() throws Exception {
  return getTransformer(null);
}
public static Transformer getTransformer(Source src) throws Exception {

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

public void serialize(OutputStream out) throws Exception {
    final Transformer idTransform = XmlTransformUtility.getTransformer();
    Source input = new DOMSource(doc);
    Result output = new StreamResult(out);
    idTransform.transform(input, output);
  }
}

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

public void serialize(OutputStream out) throws Exception {
    final Transformer idTransform = XmlTransformUtility.getTransformer();
    Source input = new DOMSource(doc);
    Result output = new StreamResult(out);
    idTransform.transform(input, output);
  }
}

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

public static void prettyPrintWithTransformer(Document doc, OutputStream out) {
  try {
    final Transformer serializer = XmlTransformUtility.getTransformer();
    //Setup indenting to "pretty print"
    serializer.setOutputProperty(OutputKeys.INDENT, "yes");
    serializer
        .setOutputProperty("{http://xml.apache.org/xslt}indent-amount",
                  "2");
    DOMSource xmlSource = new DOMSource(doc);
    StreamResult outputTarget = new StreamResult(out);
    serializer.transform(xmlSource, outputTarget);
  } catch (Exception e) {
    logger.error(e.getMessage());
    throw new RuntimeException(e);
  }
}

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

public static void prettyPrintWithTransformer(Document doc, OutputStream out) {
  try {
    final Transformer serializer = XmlTransformUtility.getTransformer();
    //Setup indenting to "pretty print"
    serializer.setOutputProperty(OutputKeys.INDENT, "yes");
    serializer
        .setOutputProperty("{http://xml.apache.org/xslt}indent-amount",
                  "2");
    DOMSource xmlSource = new DOMSource(doc);
    StreamResult outputTarget = new StreamResult(out);
    serializer.transform(xmlSource, outputTarget);
  } catch (Exception e) {
    logger.error(e.getMessage());
    throw new RuntimeException(e);
  }
}

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

public String getXMLResult() throws Exception {
  Writer w = new StringWriter();
  PrintWriter out = new PrintWriter(w);
  final Transformer transformer = XmlTransformUtility.getTransformer();
  Properties transProps = new Properties();
  transProps.put("method", "xml");
  transProps.put("indent", "yes");
  transformer.setOutputProperties(transProps);
  transformer
      .transform(new DOMSource(rootElement), new StreamResult(out));
  out.close();
  return w.toString();
}

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

public String getXMLResult() throws Exception {
  Writer w = new StringWriter();
  PrintWriter out = new PrintWriter(w);
  final Transformer transformer = XmlTransformUtility.getTransformer();
  Properties transProps = new Properties();
  transProps.put("method", "xml");
  transProps.put("indent", "yes");
  transformer.setOutputProperties(transProps);
  transformer
      .transform(new DOMSource(rootElement), new StreamResult(out));
  out.close();
  return w.toString();
}

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

/**
 * Convert the given DOM to an UTF-8 XML String.
 *
 * @param dom                the Document to convert.
 * @param withXmlDeclaration if true, an XML-declaration is prepended.
 * @return the dom as an XML String.
 * @throws TransformerException if the dom could not be converted.
 */
// TODO: Consider optimizing this with ThreadLocal Transformers
public static String domToString(Node dom, boolean withXmlDeclaration)
    throws Exception {
  Transformer t = XmlTransformUtility.getTransformer();
  t.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
  if (withXmlDeclaration) {
    t.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no");
  } else {
    t.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
  }
  t.setOutputProperty(OutputKeys.METHOD, "xml");
  /* Transformer */
  StringWriter sw = new StringWriter();
  t.transform(new DOMSource(dom), new StreamResult(sw));
  return sw.toString();
}

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

/**
 * Convert the given DOM to an UTF-8 XML String.
 *
 * @param dom                the Document to convert.
 * @param withXmlDeclaration if true, an XML-declaration is prepended.
 * @return the dom as an XML String.
 * @throws TransformerException if the dom could not be converted.
 */
// TODO: Consider optimizing this with ThreadLocal Transformers
public static String domToString(Node dom, boolean withXmlDeclaration)
    throws Exception {
  Transformer t = XmlTransformUtility.getTransformer();
  t.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
  if (withXmlDeclaration) {
    t.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no");
  } else {
    t.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
  }
  t.setOutputProperty(OutputKeys.METHOD, "xml");
  /* Transformer */
  StringWriter sw = new StringWriter();
  t.transform(new DOMSource(dom), new StreamResult(sw));
  return sw.toString();
}

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

transformer = XmlTransformUtility.getTransformer(ss); // xformPath
} else {
  transformer.reset();

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

transformer = XmlTransformUtility.getTransformer(ss); // xformPath
} else {
  transformer.reset();

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

@Test
public void testTransformer() throws Exception {
  Transformer t = XmlTransformUtility.getTransformer();
  t.setOutputProperty(OutputKeys.INDENT, "yes");
  t.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
}

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

XmlTransformUtility.getTransformer(preprocessorSource);
ptransformer.setParameter("phase", phase);
ptransformer.transform(rulesSource, new StreamResult(out));

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

XmlTransformUtility.getTransformer(preprocessorSource);
ptransformer.setParameter("phase", phase);
ptransformer.transform(rulesSource, new StreamResult(out));

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

/**
 * Default constructor.
 *
 * @throws PEPException
 */
public ListDatastreams()
    throws PEPException {
  super();
  try {
    xFormer = XmlTransformUtility.getTransformer();
  } catch (Exception e) {
    throw new PEPException("Error initialising SearchFilter", e);
  }
  tidy = new Tidy();
  tidy.setShowWarnings(false);
  tidy.setQuiet(true);
}

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

/**
 * Default constructor.
 *
 * @throws PEPException
 */
public FindObjects()
    throws PEPException {
  super();
  try {
    xFormer = XmlTransformUtility.getTransformer();
  } catch (Exception e) {
    throw new PEPException("Error initialising SearchFilter", e);
  }
  tidy = new Tidy();
  tidy.setShowWarnings(false);
  tidy.setQuiet(true);
}

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