本文整理汇总了Java中org.ofbiz.base.util.UtilXml.writeXmlDocument方法的典型用法代码示例。如果您正苦于以下问题:Java UtilXml.writeXmlDocument方法的具体用法?Java UtilXml.writeXmlDocument怎么用?Java UtilXml.writeXmlDocument使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.ofbiz.base.util.UtilXml
的用法示例。
在下文中一共展示了UtilXml.writeXmlDocument方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: writeXmlDocument
import org.ofbiz.base.util.UtilXml; //导入方法依赖的package包/类
public static boolean writeXmlDocument(String str, Node node, String encoding, boolean omitXmlDeclaration, boolean indent, int indentAmount) {
try {
File file = FileUtil.getFile(str);
if (file != null) {
FileOutputStream os = new FileOutputStream(file);
UtilXml.writeXmlDocument(node, os, encoding, omitXmlDeclaration, indent, indentAmount);
os.close();
return true;
} else {
Debug.logError("Unable to create XML document " + str, module);
}
} catch (Exception e) {
Debug.logError(e, "Error while writing XML document " + str, module);
}
return false;
}
示例2: toString
import org.ofbiz.base.util.UtilXml; //导入方法依赖的package包/类
@Override
public String toString() {
try {
return UtilXml.writeXmlDocument(document);
} catch (IOException e) {
Debug.logError(e, module);
throw new IllegalStateException("Unable to write document as String");
}
}
示例3: serialize
import org.ofbiz.base.util.UtilXml; //导入方法依赖的package包/类
public static String serialize(Object object) throws SerializeException, FileNotFoundException, IOException {
Document document = UtilXml.makeEmptyXmlDocument("ofbiz-ser");
Element rootElement = document.getDocumentElement();
rootElement.appendChild(serializeSingle(object, document));
return UtilXml.writeXmlDocument(document);
}
示例4: toXmlString
import org.ofbiz.base.util.UtilXml; //导入方法依赖的package包/类
public static String toXmlString(Node node, String encoding, boolean omitXmlDeclaration, boolean indent, int indentAmount) {
try {
ByteArrayOutputStream os = new ByteArrayOutputStream();
UtilXml.writeXmlDocument(node, os, encoding, omitXmlDeclaration, indent, indentAmount);
os.close();
return os.toString();
} catch (Exception e) {
Debug.logError(e, "Error while creating XML String ", module);
}
return null;
}
示例5: writeResponse
import org.ofbiz.base.util.UtilXml; //导入方法依赖的package包/类
public void writeResponse(HttpServletResponse response, Writer writer) throws IOException {
ByteArrayOutputStream os = new ByteArrayOutputStream();
try {
UtilXml.writeXmlDocument(os, this.responseDocument, "UTF-8", true, true);
} catch (Exception e) {
throw new IOException(e.getMessage());
}
response.setContentLength(os.size());
writer.write(os.toString("UTF-8"));
}
示例6: getViewXml
import org.ofbiz.base.util.UtilXml; //导入方法依赖的package包/类
public String getViewXml(String entityName) throws IOException {
Document doc = UtilXml.makeEmptyXmlDocument();
Element viewElement = getViewElement(doc, entityName);
return UtilXml.writeXmlDocument(viewElement);
}
示例7: serialize
import org.ofbiz.base.util.UtilXml; //导入方法依赖的package包/类
public static String serialize(Object object) throws SerializeException, FileNotFoundException, IOException {
Document document = UtilXml.makeEmptyXmlDocument("ofbiz-ser");
Element rootElement = document.getDocumentElement();
rootElement.appendChild(XmlSerializer.serializeSingle(object, document));
return UtilXml.writeXmlDocument(document);
}