本文整理了Java中org.apache.axiom.om.OMFactory.createOMAttribute()
方法的一些代码示例,展示了OMFactory.createOMAttribute()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。OMFactory.createOMAttribute()
方法的具体详情如下:
包路径:org.apache.axiom.om.OMFactory
类名称:OMFactory
方法名:createOMAttribute
[英]Create an attribute with the given name and value. If the provided OMNamespace object has a null
prefix, then a prefix will be generated, except if the namespace URI is the empty string, in which case the result is the same as if a null
OMNamespace was given.
[中]使用给定的名称和值创建属性。如果提供的OMNamespace对象具有null
前缀,则将生成一个前缀,除非命名空间URI是空字符串,在这种情况下,结果与给定的null
OMNamespace相同。
代码示例来源:origin: org.apache.axis2/axis2-kernel
/**
* @param localName
* @param ns
* @param value
*/
public void addAttribute(String localName, OMNamespace ns, String value) {
if (attributes == null) {
attributes = new ArrayList<OMAttribute>();
}
attributes.add(OMAbstractFactory.getOMFactory().createOMAttribute(localName, ns, value));
}
代码示例来源:origin: org.apache.axis2/axis2-kernel
protected void setMustUnderstand(OMElement headerElement, OMNamespace omNamespace) {
OMFactory omFactory = OMAbstractFactory.getOMFactory();
OMAttribute mustUnderstandAttribute =
omFactory.createOMAttribute(SOAP12Constants.ATTR_MUSTUNDERSTAND, omNamespace,
"true");
headerElement.addAttribute(mustUnderstandAttribute);
}
代码示例来源:origin: usnistgov/iheos-toolkit2
private OMElement mk_object_ref_list(List uuids) {
OMElement object_ref_list = MetadataSupport.om_factory.createOMElement("ObjectRefList", null);
for (Iterator it=uuids.iterator(); it.hasNext(); ) {
String uuid = (String) it.next();
OMAttribute att = MetadataSupport.om_factory.createOMAttribute("id", null, uuid);
OMElement object_ref = MetadataSupport.om_factory.createOMElement("ObjectRef", null);
object_ref.addAttribute(att);
object_ref_list.addChild(object_ref);
}
return object_ref_list;
}
代码示例来源:origin: org.apache.synapse/synapse-commons
private void addSourceAttribute(String source, OMElement element)
throws EvaluatorException {
if (source != null) {
element.addAttribute(fac.createOMAttribute(EvaluatorConstants.SOURCE, nullNS,
source));
} else {
String msg = "If type is not URL a source value should be specified for " +
"the evaluator";
log.error(msg);
throw new EvaluatorException(msg);
}
}
代码示例来源:origin: org.wso2.ei/org.wso2.ei.samples
private static OMElement getHeader(OMFactory factory) {
OMElement header = factory.createOMElement("header", null);
OMElement msgType = factory.createOMElement("field", null);
msgType.addAttribute(factory.createOMAttribute("id", null, "35"));
factory.createOMText(msgType, "D");
header.addChild(msgType);
OMElement sendingTime = factory.createOMElement("field", null);
sendingTime.addAttribute(factory.createOMAttribute("id", null, "52"));
factory.createOMText(sendingTime, new Date().toString());
header.addChild(sendingTime);
return header;
}
代码示例来源:origin: org.apache.synapse/synapse-core
private void serializeParams(OMElement invokeElem, InvokeMediator mediator) {
Map<String, Value> paramsMap = mediator.getpName2ExpressionMap();
for (Map.Entry<String,Value> entry : paramsMap.entrySet()) {
if (!"".equals(entry.getKey())) {
OMElement paramEl = fac.createOMElement(InvokeMediatorFactory.WITH_PARAM_Q.getLocalPart(),
synNS);
paramEl.addAttribute(fac.createOMAttribute("name", nullNS, entry.getKey()));
//serialize value attribute
new ValueSerializer().serializeValue(entry.getValue(), "value", paramEl);
invokeElem.addChild(paramEl);
}
}
}
代码示例来源:origin: org.apache.synapse/synapse-samples
private static OMElement getHeader(OMFactory factory) {
OMElement header = factory.createOMElement("header", null);
OMElement msgType = factory.createOMElement("field", null);
msgType.addAttribute(factory.createOMAttribute("id", null, "35"));
factory.createOMText(msgType, "D");
header.addChild(msgType);
OMElement sendingTime = factory.createOMElement("field", null);
sendingTime.addAttribute(factory.createOMAttribute("id", null, "52"));
factory.createOMText(sendingTime, new Date().toString());
header.addChild(sendingTime);
return header;
}
代码示例来源:origin: org.wso2.carbon.identity.inbound.auth.sts/org.wso2.carbon.identity.sts.passive
private void addClaimType(OMElement parent, String uri) {
OMElement element = null;
element = parent.getOMFactory().createOMElement(
new QName("http://schemas.xmlsoap.org/ws/2005/05/identity", "ClaimType", "wsid"),
parent);
element.addAttribute(parent.getOMFactory().createOMAttribute("Uri", null, uri));
}
代码示例来源:origin: org.wso2.carbon.identity/org.wso2.carbon.identity.sts.passive
private void addClaimType(OMElement parent, String uri) {
OMElement element = null;
element = parent.getOMFactory().createOMElement(
new QName("http://schemas.xmlsoap.org/ws/2005/05/identity", "ClaimType", "wsid"),
parent);
element.addAttribute(parent.getOMFactory().createOMAttribute("Uri", null, uri));
}
代码示例来源:origin: org.apache.synapse/synapse-core
private void serializeCreateBeanCase(OMElement mediatorElem, BeanMediator mediator) {
if (mediator.getClazz() != null) {
mediatorElem.addAttribute(fac.createOMAttribute(
BeanConstants.CLASS, nullNS, mediator.getClazz().getName()));
} else {
handleException();
}
if (!mediator.isReplace()) {
mediatorElem.addAttribute(fac.createOMAttribute(
BeanConstants.REPLACE, nullNS, Boolean.toString(false)));
}
}
代码示例来源:origin: wso2/wso2-synapse
private void serializeCreateBeanCase(OMElement mediatorElem, BeanMediator mediator) {
if (mediator.getClazz() != null) {
mediatorElem.addAttribute(fac.createOMAttribute(
BeanConstants.CLASS, nullNS, mediator.getClazz().getName()));
} else {
handleException();
}
if (!mediator.isReplace()) {
mediatorElem.addAttribute(fac.createOMAttribute(
BeanConstants.REPLACE, nullNS, Boolean.toString(false)));
}
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-databinding-axiom
@Override
public void appendText(OMElement parentElement, String textData) throws Java2XMLMapperException {
if (textData == null) {
OMNamespace xsi = factory.createOMNamespace("http://www.w3.org/2001/XMLSchema-instance", "xsi");
OMAttribute nil = factory.createOMAttribute("nil", xsi, "true");
parentElement.addAttribute(nil);
} else {
factory.createOMText(parentElement, textData);
}
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-databinding-axiom
private void attachXSINil(OMElement element) {
OMNamespace xsiNS =
element.getOMFactory().createOMNamespace(XSI_TYPE_QNAME.getNamespaceURI(), XSI_TYPE_QNAME.getPrefix());
element.declareNamespace(xsiNS);
OMAttribute attr = element.getOMFactory().createOMAttribute("nil", xsiNS, "true");
element.addAttribute(attr);
}
代码示例来源:origin: org.apache.synapse/synapse-core
public OMElement serializeSpecificMediator(Mediator m) {
if (!(m instanceof TransactionMediator)) {
handleException("Unsupported mediator passed in for serialization : " + m.getType());
}
TransactionMediator mediator = (TransactionMediator) m;
OMElement transaction = fac.createOMElement("transaction", synNS);
transaction.addAttribute(fac.createOMAttribute("action", nullNS, mediator.getAction()));
saveTracingState(transaction, mediator);
return transaction;
}
代码示例来源:origin: org.apache.synapse/synapse-core
private void serializePropertyName(OMElement mediatorElem, BeanMediator mediator) {
if (mediator.getPropertyName() != null) {
mediatorElem.addAttribute(fac.createOMAttribute(
BeanConstants.PROPERTY, nullNS, mediator.getPropertyName()));
} else {
handleException();
}
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-databinding-axiom
@Override
protected OMElement createElement(QName element, String text, TransformationContext context) {
OMElement omElement = AxiomHelper.createOMElement(factory, element);
if (text == null) {
OMNamespace xsi = factory.createOMNamespace("http://www.w3.org/2001/XMLSchema-instance", "xsi");
OMAttribute nil = factory.createOMAttribute("nil", xsi, "true");
omElement.addAttribute(nil);
} else {
factory.createOMText(omElement, text);
}
return omElement;
}
代码示例来源:origin: org.apache.synapse/synapse-core
public OMElement serializeSpecificMediator(Mediator m) {
if (!(m instanceof DBReportMediator)) {
handleException("Unsupported mediator passed in for serialization : " + m.getType());
}
DBReportMediator mediator = (DBReportMediator) m;
OMElement dbReport = fac.createOMElement("dbreport", synNS);
if (mediator.isUseTransaction()) {
dbReport.addAttribute(fac.createOMAttribute("useTransaction", nullNS, "true"));
}
saveTracingState(dbReport, mediator);
serializeDBInformation(mediator, dbReport);
return dbReport;
}
代码示例来源:origin: org.apache.synapse/synapse-core
public static OMElement serializeXPath(SynapseXPath xpath, String expression,
OMElement elem, String attribName) {
OMNamespace nullNS = elem.getOMFactory()
.createOMNamespace(XMLConfigConstants.NULL_NAMESPACE, "");
if (xpath != null && expression != null) {
elem.addAttribute(elem.getOMFactory().createOMAttribute(
attribName, nullNS, expression));
serializeNamespaces(elem, xpath);
} else {
handleException("Couldn't find the xpath in the SynapseXPath");
}
return elem;
}
代码示例来源:origin: org.apache.synapse/synapse-core
public static OMElement serializeXPath(SynapseXPath xpath, OMElement elem, String attribName) {
OMNamespace nullNS = elem.getOMFactory()
.createOMNamespace(XMLConfigConstants.NULL_NAMESPACE, "");
if (xpath != null) {
elem.addAttribute(elem.getOMFactory().createOMAttribute(
attribName, nullNS, xpath.toString()));
serializeNamespaces(elem, xpath);
} else {
handleException("Couldn't find the xpath in the SynapseXPath");
}
return elem;
}
代码示例来源:origin: wso2/wso2-synapse
public static OMElement serializeXPath(SynapseXPath xpath, OMElement elem, String attribName) {
OMNamespace nullNS = elem.getOMFactory()
.createOMNamespace(XMLConfigConstants.NULL_NAMESPACE, "");
if (xpath != null) {
elem.addAttribute(elem.getOMFactory().createOMAttribute(
attribName, nullNS, xpath.toString()));
serializeNamespaces(elem, xpath);
} else {
handleException("Couldn't find the xpath in the SynapseXPath");
}
return elem;
}
内容来源于网络,如有侵权,请联系作者删除!