本文整理汇总了Java中org.ofbiz.base.util.UtilXml.makeEmptyXmlDocument方法的典型用法代码示例。如果您正苦于以下问题:Java UtilXml.makeEmptyXmlDocument方法的具体用法?Java UtilXml.makeEmptyXmlDocument怎么用?Java UtilXml.makeEmptyXmlDocument使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.ofbiz.base.util.UtilXml
的用法示例。
在下文中一共展示了UtilXml.makeEmptyXmlDocument方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: PcChargeApi
import org.ofbiz.base.util.UtilXml; //导入方法依赖的package包/类
public PcChargeApi(boolean isFile) {
// initialize the document
String initialElement = rootElement;
if (!isFile) {
initialElement = reqElement;
}
this.document = UtilXml.makeEmptyXmlDocument(initialElement);
Element root = this.document.getDocumentElement();
if (isFile) {
root.setAttribute("xmlns", xschema);
this.req = UtilXml.addChildElement(root, reqElement, document);
} else {
this.req = root;
}
this.mode = MODE_IN;
}
示例2: createUspsRequestDocument
import org.ofbiz.base.util.UtilXml; //导入方法依赖的package包/类
private static Document createUspsRequestDocument(String rootElement, boolean passwordRequired, Delegator delegator, String shipmentGatewayConfigId, String resource) {
Document requestDocument = UtilXml.makeEmptyXmlDocument(rootElement);
Element requestElement = requestDocument.getDocumentElement();
requestElement.setAttribute("USERID", getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId,
"accessUserId", resource, "shipment.usps.access.userid", ""));
if (passwordRequired) {
requestElement.setAttribute("PASSWORD", getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId,
"accessPassword", resource, "shipment.usps.access.password", ""));
}
return requestDocument;
}
示例3: createAccessRequestDocument
import org.ofbiz.base.util.UtilXml; //导入方法依赖的package包/类
public static Document createAccessRequestDocument(Delegator delegator, String shipmentGatewayConfigId,
String serviceConfigProps) {
Document accessRequestDocument = UtilXml.makeEmptyXmlDocument("AccessRequest");
Element accessRequestElement = accessRequestDocument.getDocumentElement();
String accessLicenseNumber = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "accessLicenseNumber", serviceConfigProps, "shipment.ups.access.license.number", "");
String userId = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "accessUserId", serviceConfigProps, "shipment.ups.access.user.id", "");
String password = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "accessPassword", serviceConfigProps, "shipment.ups.access.password", "");
UtilXml.addChildElementValue(accessRequestElement, "AccessLicenseNumber",accessLicenseNumber, accessRequestDocument);
UtilXml.addChildElementValue(accessRequestElement, "UserId", userId, accessRequestDocument);
UtilXml.addChildElementValue(accessRequestElement, "Password", password, accessRequestDocument);
return accessRequestDocument;
}
示例4: createAccessRequestDocument
import org.ofbiz.base.util.UtilXml; //导入方法依赖的package包/类
public static Document createAccessRequestDocument(Delegator delegator, String shipmentGatewayConfigId, String resource) {
Document eCommerceRequestDocument = UtilXml.makeEmptyXmlDocument("eCommerce");
Element eCommerceRequestElement = eCommerceRequestDocument.getDocumentElement();
eCommerceRequestElement.setAttribute("version", getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "headVersion", resource, "shipment.dhl.head.version"));
eCommerceRequestElement.setAttribute("action", getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "headAction", resource, "shipment.dhl.head.action"));
Element requestorRequestElement = UtilXml.addChildElement(eCommerceRequestElement, "Requestor", eCommerceRequestDocument);
UtilXml.addChildElementValue(requestorRequestElement, "ID", getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "accessUserId", resource, "shipment.dhl.access.userid"),
eCommerceRequestDocument);
UtilXml.addChildElementValue(requestorRequestElement, "Password", getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "accessPassword", resource, "shipment.dhl.access.password"),
eCommerceRequestDocument);
return eCommerceRequestDocument;
}
示例5: makeXmlDocument
import org.ofbiz.base.util.UtilXml; //导入方法依赖的package包/类
public static Document makeXmlDocument(Collection<GenericValue> values) {
Document document = UtilXml.makeEmptyXmlDocument("entity-engine-xml");
if (document == null) return null;
addToXmlDocument(values, document);
return document;
}
示例6: 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);
}
示例7: simpleTypeConvertTest
import org.ofbiz.base.util.UtilXml; //导入方法依赖的package包/类
public static void simpleTypeConvertTest(String label, Object toConvert, String type, Object wanted) throws GeneralException {
basicTest(label, toConvert);
assertEquals(label + ":null target type", toConvert, simpleTypeConvert(toConvert, null, null, null, null, true));
assertEquals(label + ":null source object", (Object) null, simpleTypeConvert(null, type, null, null, null, true));
assertEquals(label, wanted, simpleTypeConvert(toConvert, type, null, null, null, true));
if (toConvert instanceof String) {
String str = (String) toConvert;
Document doc = UtilXml.makeEmptyXmlDocument();
assertEquals(label + ":text-node proxy", wanted, simpleTypeConvert(doc.createTextNode(str), type, null, null, null, true));
}
}
示例8: createRequestDocument
import org.ofbiz.base.util.UtilXml; //导入方法依赖的package包/类
private static Document createRequestDocument(String paymentConfig, Delegator delegator) {
// EngineDocList
Document requestDocument = UtilXml.makeEmptyXmlDocument("EngineDocList");
Element engineDocListElement = requestDocument.getDocumentElement();
UtilXml.addChildElementValue(engineDocListElement, "DocVersion", "1.0", requestDocument);
// EngineDocList.EngineDoc
Element engineDocElement = UtilXml.addChildElement(engineDocListElement, "EngineDoc", requestDocument);
UtilXml.addChildElementValue(engineDocElement, "ContentType", "OrderFormDoc", requestDocument);
String sourceId = EntityUtilProperties.getPropertyValue(paymentConfig, "payment.clearcommerce.sourceId", delegator);
if (UtilValidate.isNotEmpty(sourceId)) {
UtilXml.addChildElementValue(engineDocElement, "SourceId", sourceId, requestDocument);
}
String groupId = EntityUtilProperties.getPropertyValue(paymentConfig, "payment.clearcommerce.groupId", delegator);
if (UtilValidate.isNotEmpty(groupId)) {
UtilXml.addChildElementValue(engineDocElement, "GroupId", groupId, requestDocument);
}
// EngineDocList.EngineDoc.User
Element userElement = UtilXml.addChildElement(engineDocElement, "User", requestDocument);
UtilXml.addChildElementValue(userElement, "Name",
EntityUtilProperties.getPropertyValue(paymentConfig, "payment.clearcommerce.username", "", delegator), requestDocument);
UtilXml.addChildElementValue(userElement, "Password",
EntityUtilProperties.getPropertyValue(paymentConfig, "payment.clearcommerce.password", "", delegator), requestDocument);
UtilXml.addChildElementValue(userElement, "Alias",
EntityUtilProperties.getPropertyValue(paymentConfig, "payment.clearcommerce.alias", "", delegator), requestDocument);
String effectiveAlias = EntityUtilProperties.getPropertyValue(paymentConfig, "payment.clearcommerce.effectiveAlias", delegator);
if (UtilValidate.isNotEmpty(effectiveAlias)) {
UtilXml.addChildElementValue(userElement, "EffectiveAlias", effectiveAlias, requestDocument);
}
// EngineDocList.EngineDoc.Instructions
Element instructionsElement = UtilXml.addChildElement(engineDocElement, "Instructions", requestDocument);
String pipeline = "PaymentNoFraud";
if (EntityUtilProperties.propertyValueEqualsIgnoreCase(paymentConfig, "payment.clearcommerce.enableFraudShield", "Y", delegator)) {
pipeline = "Payment";
}
UtilXml.addChildElementValue(instructionsElement, "Pipeline", pipeline, requestDocument);
// EngineDocList.EngineDoc.OrderFormDoc
Element orderFormDocElement = UtilXml.addChildElement(engineDocElement, "OrderFormDoc", requestDocument);
// default to "P" for Production Mode
String mode = EntityUtilProperties.getPropertyValue(paymentConfig, "payment.clearcommerce.processMode", "P", delegator);
UtilXml.addChildElementValue(orderFormDocElement, "Mode", mode, requestDocument);
return requestDocument;
}
示例9: 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);
}
示例10: transform
import org.ofbiz.base.util.UtilXml; //导入方法依赖的package包/类
@Deprecated
public static Document transform(Map<String, Object> context, Map<String, Object> params)
throws GeneralException, IOException, TransformerConfigurationException, TransformerException {
Document outputDocument = null;
TransformerFactory tFactory = TransformerFactory.newInstance();
Templates translet = null;
String templateName = (String)context.get("templateName");
if (UtilValidate.isNotEmpty(templateName)) {
translet = xslTemplatesCache.get(templateName);
}
if (translet == null) {
String templateUrl = (String)context.get("templateUrl");
String templateString = (String)context.get("templateString");
Document templateDocument = (Document)context.get("templateDocument");
Source templateSource = getSource(templateDocument, templateUrl, templateString);
translet = tFactory.newTemplates(templateSource);
if (UtilValidate.isNotEmpty(templateName)) {
translet = xslTemplatesCache.putIfAbsentAndGet(templateName, translet);
}
}
if (translet != null) {
Transformer transformer = translet.newTransformer();
if (params != null) {
for (Map.Entry<String, Object> entry: params.entrySet()) {
String key = entry.getKey();
Object val = entry.getValue();
transformer.setParameter(key, val);
}
}
DOMResult outputResult = new DOMResult(UtilXml.makeEmptyXmlDocument());
String inputUrl = (String)context.get("inputUrl");
String inputString = (String)context.get("inputString");
Document inputDocument = (Document)context.get("inputDocument");
Source inputSource = getSource(inputDocument, inputUrl, inputString);
transformer.transform(inputSource, outputResult);
Node nd = outputResult.getNode();
outputDocument = (Document)nd;
}
return outputDocument;
}
示例11: ResponseHelper
import org.ofbiz.base.util.UtilXml; //导入方法依赖的package包/类
public ResponseHelper() {
this.responseDocument = UtilXml.makeEmptyXmlDocument();
}
示例12: 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);
}