本文整理了Java中org.apache.axiom.om.OMElement.insertSiblingAfter()
方法的一些代码示例,展示了OMElement.insertSiblingAfter()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。OMElement.insertSiblingAfter()
方法的具体详情如下:
包路径:org.apache.axiom.om.OMElement
类名称:OMElement
方法名:insertSiblingAfter
暂无
代码示例来源:origin: org.apache.rampart/rampart-core
public static Element insertSiblingAfter(RampartMessageData rmd,
Element child, Element sibling) {
if (child == null) {
return appendChildToSecHeader(rmd, sibling);
} else {
if (child.getOwnerDocument().equals(sibling.getOwnerDocument())) {
if (child.getParentNode() == null
&& !child.getLocalName().equals("UsernameToken")) {
rmd.getSecHeader().getSecurityHeader().appendChild(child);
}
((OMElement) child).insertSiblingAfter((OMElement) sibling);
return sibling;
} else {
Element newSib = (Element) child.getOwnerDocument().importNode(
sibling, true);
((OMElement) child).insertSiblingAfter((OMElement) newSib);
return newSib;
}
}
}
代码示例来源:origin: org.wso2.carbon/org.wso2.carbon.rulecep.adapters
private void handleFirstChild(OMElement firstChild,
OMElement result,
ResourceDescription description) {
if (!firstChild.getQName().equals(description.getParentElementQName())) {
firstChild.insertSiblingAfter(result);
firstChild.detach();
} else {
firstChild.addChild(result);
}
}
}
代码示例来源:origin: org.wso2.carbon/org.wso2.carbon.rulecep.adapters
private void handleFirstChild(OMElement firstChild,
OMElement result,
ResourceDescription description) {
if (!firstChild.getQName().equals(description.getParentElementQName())) {
firstChild.insertSiblingAfter(result);
firstChild.detach();
} else {
firstChild.addChild(result);
}
}
}
代码示例来源:origin: org.apache.synapse/synapse-core
private void insertElement(ArrayList<OMNode> sourceNodeList, OMElement e, SynapseLog synLog) {
if (action.equals(ACTION_REPLACE)) {
boolean isInserted = false;
for (OMNode elem : sourceNodeList) {
if (elem instanceof OMElement) {
e.insertSiblingAfter(elem);
isInserted = true;
} else if (elem instanceof OMText) {
e.setText(((OMText) elem).getText());
} else {
synLog.error("Invalid Source object to be inserted.");
}
}
if (isInserted) {
e.detach();
}
} else if (action.equals(ACTION_ADD_CHILD)) {
for (OMNode elem : sourceNodeList) {
if (elem instanceof OMElement) {
e.addChild(elem);
}
}
} else if (action.equals(ACTION_ADD_SIBLING)) {
for (OMNode elem : sourceNodeList) {
if (elem instanceof OMElement) {
e.insertSiblingAfter(elem);
}
}
}
}
代码示例来源:origin: org.wso2.carbon.appmgt/org.wso2.carbon.appmgt.gateway
public static void setFaultPayload(MessageContext messageContext, OMElement payload) {
OMElement firstChild = messageContext.getEnvelope().getBody().getFirstElement();
if (firstChild != null) {
firstChild.insertSiblingAfter(payload);
firstChild.detach();
} else {
messageContext.getEnvelope().getBody().addChild(payload);
}
}
代码示例来源:origin: org.apache.synapse/synapse-extensions
/**
* Set the SOAP body payload from XML
*
* @param payload Message payload
* @throws ScriptException For errors in converting xml To OM
* @throws OMException For errors in OM manipulation
*/
public void setPayloadXML(Object payload) throws OMException, ScriptException {
SOAPBody body = mc.getEnvelope().getBody();
OMElement firstChild = body.getFirstElement();
OMElement omElement = xmlHelper.toOMElement(payload);
if (firstChild == null) {
body.addChild(omElement);
} else {
firstChild.insertSiblingAfter(omElement);
firstChild.detach();
}
}
代码示例来源:origin: wso2/wso2-synapse
/**
* Set the SOAP body payload from XML.
*
* @param payload Message payload
* @throws ScriptException For errors in converting xml To OM
* @throws OMException For errors in OM manipulation
*/
public void setPayloadXML(Object payload) throws OMException, ScriptException {
SOAPBody body = mc.getEnvelope().getBody();
OMElement firstChild = body.getFirstElement();
OMElement omElement = xmlHelper.toOMElement(payload);
if (firstChild == null) {
body.addChild(omElement);
} else {
firstChild.insertSiblingAfter(omElement);
firstChild.detach();
}
}
代码示例来源:origin: wso2/wso2-synapse
for (OMNode elem : sourceNodeList) {
if (elem instanceof OMElement) {
e.insertSiblingAfter(elem);
代码示例来源:origin: wso2/wso2-synapse
/**
* Set the SOAP body payload from XML.
*
* @param payload Message payload
* @throws ScriptException For errors in converting xml To OM
* @throws OMException For errors in OM manipulation
*/
@Override
public void setPayloadXML(Object payload) throws OMException, ScriptException {
SOAPBody body = mc.getEnvelope().getBody();
OMElement firstChild = body.getFirstElement();
OMElement omElement = xmlHelper.toOMElement(payload);
if (firstChild == null) {
body.addChild(omElement);
} else {
firstChild.insertSiblingAfter(omElement);
firstChild.detach();
}
}
代码示例来源:origin: usnistgov/iheos-toolkit2
public OMElement getBody() {
OMElement sor = MetadataSupport.firstChildWithLocalName(metadataEle, "SubmitObjectsRequest");
if (sor == null) {
String msg = "MtomBuilder: cannot find SubmitObjectsRequest child in PnR";
logger.error(msg);
throw new ToolkitRuntimeException(msg);
}
for (String id : documentMap.getIds()) {
Document document = documentMap.getDocument(id);
javax.activation.DataHandler dataHandler = new javax.activation.DataHandler(document.getDataSource());
OMText t = MetadataSupport.om_factory.createOMText(dataHandler, true);
t.setOptimize(true);
OMElement documentEle = MetadataSupport.om_factory.createOMElement("Document", MetadataSupport.xdsB);
documentEle.addAttribute("id", id, null);
documentEle.addChild(t);
// metadataEle.addChild(documentEle);
sor.insertSiblingAfter(documentEle);
}
return metadataEle;
}
代码示例来源:origin: org.paxml/PaxmlCore
public void visit(OMElement ele, String name, String value) {
if (filter == null || filter.accept(ele, name, value)) {
OMElement constEle = createDataTag(name, value, ele.getLineNumber());
if (firstPushedSub == null) {
OMNode firstChild = ele.getFirstOMChild();
if (firstChild != null) {
firstChild.insertSiblingBefore(constEle);
} else {
ele.addChild(constEle);
}
firstPushedSub = constEle;
} else {
firstPushedSub.insertSiblingAfter(constEle);
}
}
}
代码示例来源:origin: org.paxml/paxml-core
public void visit(OMElement ele, String name, String value) {
if (filter == null || filter.accept(ele, name, value)) {
OMElement constEle = createDataTag(name, value, ele.getLineNumber());
if (firstPushedSub == null) {
OMNode firstChild = ele.getFirstOMChild();
if (firstChild != null) {
firstChild.insertSiblingBefore(constEle);
} else {
ele.addChild(constEle);
}
firstPushedSub = constEle;
} else {
firstPushedSub.insertSiblingAfter(constEle);
}
}
}
代码示例来源:origin: usnistgov/iheos-toolkit2
nameEle.insertSiblingAfter(ve);
descEle.insertSiblingAfter(ve);
代码示例来源:origin: org.wso2.carbon.appmgt/org.wso2.carbon.appmgt.gateway
public static void send401(MessageContext messageContext, String reason) {
// TODO : remove reason from the method signature since we don't send a reason for 401.
org.apache.axis2.context.MessageContext axis2MessageContext = ((Axis2MessageContext) messageContext).getAxis2MessageContext();
OMFactory fac = OMAbstractFactory.getOMFactory();
OMNamespace ns = fac.createOMNamespace("http://wso2.org/appm", "appm");
OMElement payload = fac.createOMElement("error", ns);
payload.setText("Unauthorized access");
OMElement firstChild = messageContext.getEnvelope().getBody().getFirstElement();
if (firstChild != null) {
firstChild.insertSiblingAfter(payload);
firstChild.detach();
} else {
messageContext.getEnvelope().getBody().addChild(payload);
}
axis2MessageContext.setProperty(NhttpConstants.HTTP_SC, HttpStatus.SC_UNAUTHORIZED);
messageContext.setResponse(true);
messageContext.setProperty("RESPONSE", "true");
messageContext.setTo(null);
axis2MessageContext.removeProperty("NO_ENTITY_BODY");
axis2MessageContext.setProperty(Constants.Configuration.MESSAGE_TYPE, "application/xml");
axis2MessageContext.removeProperty(Constants.Configuration.CONTENT_TYPE);
Axis2Sender.sendBack(messageContext);
}
代码示例来源:origin: org.wso2.carbon/org.wso2.carbon.rulecep.adapters
targetOMNode.insertSiblingAfter(ElementHelper.importOMElement(
(OMElement) value, OMAbstractFactory.getOMFactory()));
targetOMNode.detach();
代码示例来源:origin: org.wso2.carbon.appmgt/org.wso2.carbon.appmgt.gateway
public static void send200(MessageContext messageContext, OMElement payload) {
org.apache.axis2.context.MessageContext axis2MessageContext = ((Axis2MessageContext) messageContext).getAxis2MessageContext();
OMElement firstChild = messageContext.getEnvelope().getBody().getFirstElement();
if (firstChild != null) {
firstChild.insertSiblingAfter(payload);
firstChild.detach();
} else {
messageContext.getEnvelope().getBody().addChild(payload);
}
axis2MessageContext.setProperty(NhttpConstants.HTTP_SC, HttpStatus.SC_OK);
messageContext.setResponse(true);
messageContext.setProperty("RESPONSE", "true");
messageContext.setTo(null);
axis2MessageContext.removeProperty("NO_ENTITY_BODY");
axis2MessageContext.setProperty(Constants.Configuration.MESSAGE_TYPE, "application/xml");
axis2MessageContext.removeProperty(Constants.Configuration.CONTENT_TYPE);
Axis2Sender.sendBack(messageContext);
}
代码示例来源:origin: org.wso2.carbon/org.wso2.carbon.rulecep.adapters
} else if (targetNode instanceof OMElement) {
OMElement targetOMNode = (OMElement) targetNode;
targetOMNode.insertSiblingAfter((OMNode) value);
targetOMNode.detach();
return true;
内容来源于网络,如有侵权,请联系作者删除!