gpt4 book ai didi

org.apache.cxf.helpers.XMLUtils.newTransformer()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-20 18:03:40 28 4
gpt4 key购买 nike

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

XMLUtils.newTransformer介绍

暂无

代码示例

代码示例来源:origin: org.apache.cxf/cxf-api

public static void generateXMLFile(Element element, Writer writer) {
  try {
    Transformer it = newTransformer();
    it.setOutputProperty(OutputKeys.METHOD, "xml");
    it.setOutputProperty(OutputKeys.INDENT, "yes");
    it.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
    it.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
    it.transform(new DOMSource(element), new StreamResult(writer));
  } catch (Exception e) {
    e.printStackTrace();
  }
}

代码示例来源:origin: org.apache.cxf/cxf-bundle-jaxrs

public static void generateXMLFile(Element element, Writer writer) {
  try {
    Transformer it = newTransformer();
    it.setOutputProperty(OutputKeys.METHOD, "xml");
    it.setOutputProperty(OutputKeys.INDENT, "yes");
    it.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
    it.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
    it.transform(new DOMSource(element), new StreamResult(writer));
  } catch (Exception e) {
    e.printStackTrace();
  }
}

代码示例来源:origin: org.apache.cxf/cxf-common-utilities

public static void generateXMLFile(Element element, Writer writer) {
  try {
    Transformer it = newTransformer();
    it.setOutputProperty(OutputKeys.METHOD, "xml");
    it.setOutputProperty(OutputKeys.INDENT, "yes");
    it.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
    it.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
    it.transform(new DOMSource(element), new StreamResult(writer));
  } catch (Exception e) {
    e.printStackTrace();
  }
}

代码示例来源:origin: org.apache.cxf/cxf-common-utilities

public static String toString(Source source, Properties props) throws TransformerException, IOException {
  StringWriter bos = new StringWriter();
  StreamResult sr = new StreamResult(bos);
  Transformer trans = newTransformer();
  if (props == null) {
    props = new Properties();
    props.put(OutputKeys.OMIT_XML_DECLARATION, "yes");
  }
  trans.setOutputProperties(props);
  trans.transform(source, sr);
  bos.close();
  return bos.toString();
}

代码示例来源:origin: org.apache.cxf/cxf-api

public static String toString(Source source, Properties props) throws TransformerException, IOException {
  StringWriter bos = new StringWriter();
  StreamResult sr = new StreamResult(bos);
  Transformer trans = newTransformer();
  if (props == null) {
    props = new Properties();
    props.put(OutputKeys.OMIT_XML_DECLARATION, "yes");
  }
  trans.setOutputProperties(props);
  trans.transform(source, sr);
  bos.close();
  return bos.toString();
}

代码示例来源:origin: org.apache.cxf/cxf-bundle-jaxrs

public static String toString(Source source, Properties props) throws TransformerException, IOException {
  StringWriter bos = new StringWriter();
  StreamResult sr = new StreamResult(bos);
  Transformer trans = newTransformer();
  if (props == null) {
    props = new Properties();
    props.put(OutputKeys.OMIT_XML_DECLARATION, "yes");
  }
  trans.setOutputProperties(props);
  trans.transform(source, sr);
  bos.close();
  return bos.toString();
}

代码示例来源:origin: org.apache.cxf/cxf-common-utilities

public static void writeTo(Source src,
              OutputStream os,
              int indent,
              String charset,
              String omitXmlDecl) {
  Transformer it;
  try {
    if (StringUtils.isEmpty(charset)) {
      charset = "utf-8"; 
    }
    it = newTransformer(indent);
    it.setOutputProperty(OutputKeys.METHOD, "xml");
    if (indent > -1) {
      it.setOutputProperty(OutputKeys.INDENT, "yes");
      it.setOutputProperty("{http://xml.apache.org/xslt}indent-amount",
                 Integer.toString(indent));
    }
    it.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, omitXmlDecl);
    it.setOutputProperty(OutputKeys.ENCODING, charset);
    it.transform(src, new StreamResult(os));
  } catch (TransformerException e) {
    throw new RuntimeException("Failed to configure TRaX", e);
  }
}
public static void writeTo(Source src,

代码示例来源:origin: org.apache.cxf/cxf-api

public static void writeTo(Source src,
              OutputStream os,
              int indent,
              String charset,
              String omitXmlDecl) {
  Transformer it;
  try {
    if (StringUtils.isEmpty(charset)) {
      charset = "utf-8"; 
    }
    it = newTransformer(indent);
    it.setOutputProperty(OutputKeys.METHOD, "xml");
    if (indent > -1) {
      it.setOutputProperty(OutputKeys.INDENT, "yes");
      it.setOutputProperty("{http://xml.apache.org/xslt}indent-amount",
                 Integer.toString(indent));
    }
    it.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, omitXmlDecl);
    it.setOutputProperty(OutputKeys.ENCODING, charset);
    it.transform(src, new StreamResult(os));
  } catch (TransformerException e) {
    throw new RuntimeException("Failed to configure TRaX", e);
  }
}
public static void writeTo(Source src,

代码示例来源:origin: org.apache.cxf/cxf-api

public static void writeTo(Source src,
              Writer os,
              int indent,
              String charset,
              String omitXmlDecl) {
  Transformer it;
  try {
    if (StringUtils.isEmpty(charset)) {
      charset = "utf-8"; 
    }
    it = newTransformer(indent);
    it.setOutputProperty(OutputKeys.METHOD, "xml");
    if (indent > -1) {
      it.setOutputProperty(OutputKeys.INDENT, "yes");
      it.setOutputProperty("{http://xml.apache.org/xslt}indent-amount",
                 Integer.toString(indent));
    }
    it.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, omitXmlDecl);
    it.setOutputProperty(OutputKeys.ENCODING, charset);
    it.transform(src, new StreamResult(os));
  } catch (TransformerException e) {
    throw new RuntimeException("Failed to configure TRaX", e);
  }
}
public static String toString(Source source) throws TransformerException, IOException {

代码示例来源:origin: org.apache.cxf/cxf-common-utilities

public static void writeTo(Source src,
              Writer os,
              int indent,
              String charset,
              String omitXmlDecl) {
  Transformer it;
  try {
    if (StringUtils.isEmpty(charset)) {
      charset = "utf-8"; 
    }
    it = newTransformer(indent);
    it.setOutputProperty(OutputKeys.METHOD, "xml");
    if (indent > -1) {
      it.setOutputProperty(OutputKeys.INDENT, "yes");
      it.setOutputProperty("{http://xml.apache.org/xslt}indent-amount",
                 Integer.toString(indent));
    }
    it.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, omitXmlDecl);
    it.setOutputProperty(OutputKeys.ENCODING, charset);
    it.transform(src, new StreamResult(os));
  } catch (TransformerException e) {
    throw new RuntimeException("Failed to configure TRaX", e);
  }
}
public static String toString(Source source) throws TransformerException, IOException {

代码示例来源:origin: org.apache.cxf/cxf-bundle-jaxrs

public static void writeTo(Source src,
              Writer os,
              int indent,
              String charset,
              String omitXmlDecl) {
  Transformer it;
  try {
    if (StringUtils.isEmpty(charset)) {
      charset = "utf-8"; 
    }
    it = newTransformer(indent);
    it.setOutputProperty(OutputKeys.METHOD, "xml");
    if (indent > -1) {
      it.setOutputProperty(OutputKeys.INDENT, "yes");
      it.setOutputProperty("{http://xml.apache.org/xslt}indent-amount",
                 Integer.toString(indent));
    }
    it.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, omitXmlDecl);
    it.setOutputProperty(OutputKeys.ENCODING, charset);
    it.transform(src, new StreamResult(os));
  } catch (TransformerException e) {
    throw new RuntimeException("Failed to configure TRaX", e);
  }
}
public static String toString(Source source) throws TransformerException, IOException {

代码示例来源:origin: org.apache.cxf/cxf-bundle-jaxrs

public static void writeTo(Source src,
              OutputStream os,
              int indent,
              String charset,
              String omitXmlDecl) {
  Transformer it;
  try {
    if (StringUtils.isEmpty(charset)) {
      charset = "utf-8"; 
    }
    it = newTransformer(indent);
    it.setOutputProperty(OutputKeys.METHOD, "xml");
    if (indent > -1) {
      it.setOutputProperty(OutputKeys.INDENT, "yes");
      it.setOutputProperty("{http://xml.apache.org/xslt}indent-amount",
                 Integer.toString(indent));
    }
    it.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, omitXmlDecl);
    it.setOutputProperty(OutputKeys.ENCODING, charset);
    it.transform(src, new StreamResult(os));
  } catch (TransformerException e) {
    throw new RuntimeException("Failed to configure TRaX", e);
  }
}
public static void writeTo(Source src,

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