本文整理匯總了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);
}