本文整理了Java中org.apache.axiom.om.OMFactory.createOMDocument()
方法的一些代码示例,展示了OMFactory.createOMDocument()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。OMFactory.createOMDocument()
方法的具体详情如下:
包路径:org.apache.axiom.om.OMFactory
类名称:OMFactory
方法名:createOMDocument
[英]Creates a new OMDocument.
[中]创建一个新文档。
代码示例来源:origin: org.objectweb.petals/petals-ws
/**
*
* @return
*/
public static OMDocument createEmptyDocument() {
OMFactory factory = OMAbstractFactory.getOMFactory();
return factory.createOMDocument();
}
}
代码示例来源:origin: org.paxml/paxml-core
/**
* Create a new empty document.
*
* @return the doc
*/
public static OMDocument newDocument() {
return getOMFactory().createOMDocument();
}
代码示例来源:origin: org.paxml/PaxmlCore
/**
* Create a new empty document.
* @return the doc
*/
public static OMDocument newDocument() {
return getOMFactory().createOMDocument();
}
/**
代码示例来源:origin: org.wso2.xkms/xkms
public static Document getDOOMDocument() {
return (Document) DOOMAbstractFactory.getOMFactory().createOMDocument();
}
代码示例来源:origin: org.wso2.carbon.data/org.wso2.carbon.dataservices.core
private static OMElement generateRequestSuccessElement() {
OMFactory fac = OMAbstractFactory.getOMFactory();
OMElement result = fac.createOMElement(new QName(DBConstants.WSO2_DS_NAMESPACE,
DBConstants.REQUEST_STATUS_WRAPPER_ELEMENT));
result.setText(DBConstants.REQUEST_STATUS_SUCCESSFUL_MESSAGE);
OMDocument doc = fac.createOMDocument();
doc.addChild(result);
return doc.getOMDocumentElement();
}
代码示例来源:origin: org.wso2.carbon.data/org.wso2.carbon.dataservices.core
public static OMElement wrapBoxCarringResponse(OMElement result) {
OMFactory fac = OMAbstractFactory.getOMFactory();
OMElement wrapperElement = fac.createOMElement(new QName(DBConstants.WSO2_DS_NAMESPACE,
DBConstants.DATA_SERVICE_REQUEST_BOX_RESPONSE_WRAPPER_ELEMENT));
if (result != null) {
wrapperElement.addChild(result);
}
OMDocument doc = fac.createOMDocument();
doc.addChild(wrapperElement);
return doc.getOMDocumentElement();
}
代码示例来源:origin: org.ballerinalang/ballerina-core
/**
* Create a comment type BXML.
*
* @param content Comment content
* @return BXML Comment type BXML
*/
public static BXML<?> createXMLComment(String content) {
OMComment omComment = OM_FACTORY.createOMComment(OM_FACTORY.createOMDocument(), content);
return new BXMLItem(omComment);
}
代码示例来源:origin: org.ballerinalang/ballerina-core
/**
* Create a processing instruction type BXML.
*
* @param tartget PI target
* @param data PI data
* @return BXML Processing instruction type BXML
*/
public static BXML<?> createXMLProcessingInstruction(String tartget, String data) {
OMProcessingInstruction omText = OM_FACTORY.createOMProcessingInstruction(OM_FACTORY.createOMDocument(),
tartget, data);
return new BXMLItem(omText);
}
代码示例来源:origin: org.wso2.maven/org.wso2.maven.capp
public String serialize() throws Exception {
String result = null;
OMDocument document = factory.createOMDocument();
OMElement documentElement = getDocumentElement();
document.addChild(documentElement);
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
try {
prettify(documentElement, outputStream);
} catch (Exception e) {
throw new MojoExecutionException("Error serializing",e);
}
result = outputStream.toString();
return result;
}
代码示例来源:origin: org.wso2.maven/org.wso2.maven.capp
public String serialize() {
String result = null;
OMDocument document = factory.createOMDocument();
OMElement documentElement = getDocumentElement();
document.addChild(documentElement);
try {
result = getPretifiedString(documentElement);
} catch (Exception e) {
e.printStackTrace();
return null;
}
return result;
}
代码示例来源:origin: org.apache.synapse/synapse-core
OMDocument omDocument = omFactory.createOMDocument();
omDocument.addChild(result);
代码示例来源:origin: org.wso2.carbon.data/org.wso2.carbon.dataservices.core
private OMElement createEventMessage(DataService dataService, String queryId, OMElement data) {
OMFactory fac = DBUtils.getOMFactory();
OMElement result = fac.createOMElement(
new QName(DBConstants.EventNotification.MESSAGE_WRAPPER));
OMElement serviceNameEl = fac.createOMElement(
new QName(DBConstants.EventNotification.SERVICE_NAME));
serviceNameEl.setText(dataService.getName());
result.addChild(serviceNameEl);
OMElement queryIdEl = fac.createOMElement(
new QName(DBConstants.EventNotification.QUERY_ID));
queryIdEl.setText(queryId);
result.addChild(queryIdEl);
OMElement timeEl = fac.createOMElement(
new QName(DBConstants.EventNotification.TIME));
timeEl.setText(Calendar.getInstance().getTime().toString());
result.addChild(timeEl);
OMElement contentEl = fac.createOMElement(
new QName(DBConstants.EventNotification.CONTENT));
contentEl.addChild(data);
result.addChild(contentEl);
/* clone required, or else the content in 'content' element is missing in result */
result = result.cloneOMElement();
OMDocument doc = fac.createOMDocument();
doc.addChild(result);
return doc.getOMDocumentElement();
}
代码示例来源:origin: wso2/wso2-synapse
OMDocument omDocument = omFactory.createOMDocument();
omDocument.addChild(result);
代码示例来源:origin: org.ballerinalang/ballerina-core
OMDocument doc = OM_FACTORY.createOMDocument();
doc.addChild(omNode);
return new BXMLItem(omNode);
代码示例来源:origin: org.wso2.maven/maven-synapse-plugin
/**
* {@inheritDoc}
*/
public CAppArtifactDependency export(OMElement artifactDefinition, CAppArtifactDependency synapseArtifactClone, File workDir)
throws Exception {
// Create the temporary directory.
workDir.mkdirs();
// Serialize the sequence definition.
String artifactName = getArtifactName(artifactDefinition);
File artifactContentFile = new File(workDir, String.format("%s.xml", artifactName));
FileOutputStream fos = null;
try {
fos = new FileOutputStream(artifactContentFile);
OMFactory omFactory = OMAbstractFactory.getOMFactory();
OMDocument omDocument = omFactory.createOMDocument();
omDocument.addChild(artifactDefinition);
omDocument.serialize(fos);
} finally {
IOUtils.closeQuietly(fos);
}
// Create the sequence artifact.
MavenProject dummyMavenProject = MavenUtils.createMavenProject(synapseArtifactClone.getcAppArtifact().getProject().getGroupId(), artifactName, synapseArtifactClone.getVersion(), getArtifactType());
CAppArtifactDependency cAppArtifactDependency = new CAppArtifactDependency(dummyMavenProject, getArtifactType(), synapseArtifactClone.getServerRole());
cAppArtifactDependency.setDummyDependency(true);
cAppArtifactDependency.setArtifactFiles(new File[]{artifactContentFile});
cAppArtifactDependency.getcAppArtifact().setFile(artifactContentFile.getName());
return cAppArtifactDependency;
}
代码示例来源:origin: org.wso2.carbon.data/org.wso2.carbon.dataservices.core
/**
* This method accesses a resource defined in the data service.
* @param dataService The DataService object which represents the data service.
* @param resourcePath The resource path of the data service resource.
* @param params The parameters destined for the resource.
* @param accessMethod The HTTP access method defined in the data service resource.
* @return returns the XML result if it exists.
* @throws DataServiceFault thrown if an error condition occurs in accessing the resource.
*/
public static OMElement accessResource(DataService dataService,
String resourcePath, Map<String, ParamValue> params,
String accessMethod) throws DataServiceFault {
OMElement result = (new SingleDataServiceRequest(dataService, Resource
.generateRequestName(resourcePath, accessMethod),
params)).dispatch();
OMDocument doc = DBUtils.getOMFactory().createOMDocument();
doc.addChild(result);
return doc.getOMDocumentElement();
}
代码示例来源:origin: org.wso2.carbon.data/org.wso2.carbon.dataservices.core
private OMElement createOMElementFromInputParams(InternalParamCollection params) {
OMFactory fac = DBUtils.getOMFactory();
OMDocument doc = fac.createOMDocument();
OMElement retEl = fac.createOMElement(new QName(this.getQueryId()));
OMElement scalarEl;
List<OMElement> arrayEl;
ParamValue paramValue;
for (InternalParam param : params.getParams()) {
paramValue = param.getValue();
if (paramValue.getValueType() == ParamValue.PARAM_VALUE_SCALAR ||
paramValue.getValueType() == ParamValue.PARAM_VALUE_UDT) {
scalarEl = fac.createOMElement(new QName(param.getName()));
scalarEl.setText(paramValue.getScalarValue());
retEl.addChild(scalarEl);
} else if (paramValue.getValueType() == ParamValue.PARAM_VALUE_ARRAY) {
arrayEl = this.createOMElementsFromArrayValue(param.getName(), paramValue, fac);
for (OMElement el : arrayEl) {
retEl.addChild(el);
}
}
}
doc.addChild(retEl);
return doc.getOMDocumentElement();
}
代码示例来源:origin: org.wso2.carbon.data/org.wso2.carbon.dataservices.core
/**
* This method invokes a single operation defined in the given data service.
* @param dataService The DataService object which represents the data service.
* @param operationName The name of the operation.
* @param params The parameters destined for the operation.
* @return returns the XML result if it exists.
* @throws DataServiceFault thrown if an error condition occurs in executing the operation.
* @see DSTools#invokeOperation(DataService, String, List)
*/
public static OMElement invokeOperation(DataService dataService,
String operationName, Map<String, ParamValue> params)
throws DataServiceFault {
if (DataServiceRequest.isBoxcarringRequest(operationName)) {
return callBoxcarringOp(dataService, operationName, params);
}
OMElement result = (new SingleDataServiceRequest(dataService, operationName,
params)).dispatch();
if (result == null) {
return null;
}
/* result must have a parent, or there are problems when it comes to XPath expressions etc.. */
OMDocument doc = DBUtils.getOMFactory().createOMDocument();
doc.addChild(result);
return doc.getOMDocumentElement();
}
代码示例来源:origin: org.wso2.carbon.data/org.wso2.carbon.dataservices.core
dataService.getResource(resourceId)));
fac.createOMDocument().addChild(dataEl);
return dataEl;
内容来源于网络,如有侵权,请联系作者删除!