本文整理了Java中org.apache.axiom.om.OMNode.detach()
方法的一些代码示例,展示了OMNode.detach()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。OMNode.detach()
方法的具体详情如下:
包路径:org.apache.axiom.om.OMNode
类名称:OMNode
方法名:detach
[英]Removes a node (and all of its children) from its containing parent.
Removes a node from its parent. Partially complete nodes will be completed before they are detached from the model. A node cannot be detached until its next sibling has been identified, so that the next sibling and parent can be updated appropriately. Please note that this will not handle the namespaces. For example, if there you have used a namespace within the detaching node and which is defined outside the detaching node, user has to handle it manually.
[中]从包含节点的父节点中删除节点(及其所有子节点)。
从其父节点移除节点。部分完成的节点将在从模型中分离之前完成。在确定下一个同级节点之前,无法分离节点,以便可以适当更新下一个同级节点和父节点。请注意,这不会处理名称空间。例如,如果您在分离节点内使用了名称空间,并且该名称空间是在分离节点外定义的,则用户必须手动处理该名称空间。
代码示例来源:origin: org.apache.axis2/axis2-saaj
public final void detachNode() {
omTarget.detach();
}
代码示例来源:origin: apache/axis2-java
public final void detachNode() {
omTarget.detach();
}
代码示例来源:origin: org.apache.ws.commons.axiom/axiom-api
public void remove() {
if (!nextCalled) {
throw new IllegalStateException("next() has not yet been called");
}
// Make sure that we know the next node before removing the current one
hasNext();
currentNode.detach();
nextCalled = false;
}
}
代码示例来源:origin: org.springframework.ws/org.springframework.ws
/** Removes the contents (i.e. children) of the container. */
public static void removeContents(OMContainer container) {
for (Iterator<?> iterator = container.getChildren(); iterator.hasNext();) {
OMNode child = (OMNode) iterator.next();
child.detach();
}
}
代码示例来源:origin: org.apache.ws.commons.axiom/axiom-common-impl
public void remove() {
if (!nextCalled) {
throw new IllegalStateException("next() has not yet been called");
}
// Make sure that we know the next node before removing the current one
hasNext();
if (currentNode instanceof OMNode) {
((OMNode)currentNode).detach();
}
nextCalled = false;
}
}
代码示例来源:origin: org.apache.ws.commons.axiom/om-aspects
public void remove() {
if (!nextCalled) {
throw new IllegalStateException("next() has not yet been called");
}
// Make sure that we know the next node before removing the current one
hasNext();
if (currentNode instanceof OMNode) {
((OMNode)currentNode).detach();
}
nextCalled = false;
}
}
代码示例来源:origin: stackoverflow.com
OMNode child = omElement.getFirstOMChild();
while ( child != null )
{
if ( child instanceof OMText )
{
// process 'child' text here
final OMNode nextSibling = child.getNextOMSibling();
child.detach(); // detach from OM to keep memory usage low
child = nextSibling;
}
}
代码示例来源:origin: org.paxml/paxml-core
/**
* Replace a node with another one.
*
* @param oldNode
* old node
* @param newNode
* new node
* @return the old node that is detached
*/
public static OMNode replaceNode(OMNode oldNode, OMNode newNode) {
oldNode.insertSiblingAfter(newNode);
return oldNode.detach();
}
代码示例来源:origin: org.paxml/PaxmlCore
/**
* Replace a node with another one.
*
* @param oldNode
* old node
* @param newNode
* new node
* @return the old node that is detached
*/
public static OMNode replaceNode(OMNode oldNode, OMNode newNode) {
oldNode.insertSiblingAfter(newNode);
return oldNode.detach();
}
代码示例来源:origin: org.apache.synapse/synapse-core
/**
* Return the set of detached elements specified by the XPath over the given envelope
*
* @param envelope SOAPEnvelope from which the elements will be extracted
* @param expression SynapseXPath expression describing the elements to be extracted
* @return List detached OMElements in the envelope matching the expression
* @throws JaxenException if the XPath expression evaluation fails
*/
public static List<OMNode> getDetachedMatchingElements(SOAPEnvelope envelope, MessageContext synCtxt,
SynapseXPath expression)
throws JaxenException {
List<OMNode> elementList = new ArrayList<OMNode>();
Object o = expression.evaluate(envelope, synCtxt);
if (o instanceof OMNode) {
elementList.add(((OMNode) o).detach());
} else if (o instanceof List) {
for (Object elem : (List) o) {
if (elem instanceof OMNode) {
elementList.add(((OMNode) elem).detach());
}
}
}
return elementList;
}
代码示例来源:origin: wso2/wso2-synapse
/**
* Return the set of detached elements specified by the XPath over the given envelope
*
* @param envelope SOAPEnvelope from which the elements will be extracted
* @param expression SynapseXPath expression describing the elements to be extracted
* @return List detached OMElements in the envelope matching the expression
* @throws JaxenException if the XPath expression evaluation fails
*/
public static List<OMNode> getDetachedMatchingElements(SOAPEnvelope envelope, MessageContext synCtxt,
SynapseXPath expression)
throws JaxenException {
List<OMNode> elementList = new ArrayList<OMNode>();
Object o = expression.evaluate(envelope, synCtxt);
if (o instanceof OMNode) {
elementList.add(((OMNode) o).detach());
} else if (o instanceof List) {
for (Object elem : (List) o) {
if (elem instanceof OMNode) {
elementList.add(((OMNode) elem).detach());
}
}
}
return elementList;
}
代码示例来源:origin: wso2/wso2-synapse
public boolean mediate(MessageContext synCtx) {
SynapseLog synLog = getLog(synCtx);
OMNode node = source.selectOMNode(synCtx, synLog);
node.detach();
synCtx.setProperty(property, node);
return true;
}
代码示例来源:origin: wso2/wso2-synapse
if (o instanceof OMNode) {
resultContainer.setParent(((OMNode) o).getParent());
elementList.add(((OMNode) o).detach());
} else if (o instanceof List) {
List oList = (List) o;
elementList.add(((OMNode) elem).detach());
代码示例来源:origin: wso2/wso2-synapse
public boolean mediate(MessageContext synCtx) {
SynapseLog synLog = getLog(synCtx);
OMNode replacement = (OMNode)synCtx.getProperty(property);
OMNode node = target.selectOMNode(synCtx, synLog);
node.insertSiblingAfter(replacement);
node.detach();
synCtx.setProperty(property, null);
return true;
}
代码示例来源:origin: org.paxml/PaxmlCore
static void processExpressions(ITag tag, IParserContext context) {
if (!(tag instanceof ExpressionTag)) {
// make sure all text nodes are converted to <expression> tags
OMElement ele = context.getElement();
for (OMNode child : AxiomUtils.getNodes(ele)) {
if (child.getType() == OMNode.TEXT_NODE) {
OMText textNode = (OMText) child;
String text = textNode.getText();
if (StringUtils.isNotBlank(text)) {
OMElement expTag = createExpressionTag(text, ele.getLineNumber());
child.insertSiblingAfter(expTag);
child.detach();
}
}
}
}
}
代码示例来源:origin: org.paxml/paxml-core
static void processExpressions(ITag tag, IParserContext context) {
if (!(tag instanceof ExpressionTag)) {
// make sure all text nodes are converted to <expression> tags
OMElement ele = context.getElement();
for (OMNode child : AxiomUtils.getNodes(ele)) {
if (child.getType() == OMNode.TEXT_NODE) {
OMText textNode = (OMText) child;
String text = textNode.getText();
if (StringUtils.isNotBlank(text)) {
OMElement expTag = createExpressionTag(text, ele.getLineNumber());
child.insertSiblingAfter(expTag);
child.detach();
}
}
}
}
}
代码示例来源:origin: org.apache.abdera/abdera-parser
public void setText(String text) {
complete();
if (text != null) {
OMNode child = this.getFirstOMChild();
while (child != null) {
if (child.getType() == OMNode.TEXT_NODE) {
child.detach();
}
child = child.getNextOMSibling();
}
getOMFactory().createOMText(this, text);
} else
_removeAllChildren();
// return (T)this;
}
代码示例来源:origin: org.apache.abdera/abdera-parser
public <T extends Element> T setText(Content.Type type, String value) {
complete();
init(type);
if (value != null) {
OMNode child = this.getFirstOMChild();
while (child != null) {
if (child.getType() == OMNode.TEXT_NODE) {
child.detach();
}
child = child.getNextOMSibling();
}
getOMFactory().createOMText(this, value);
} else
_removeAllChildren();
return (T)this;
}
代码示例来源:origin: org.apache.abdera/abdera-parser
public <T extends Element> T setText(Text.Type type, String value) {
complete();
init(type);
if (value != null) {
OMNode child = this.getFirstOMChild();
while (child != null) {
if (child.getType() == OMNode.TEXT_NODE) {
child.detach();
}
child = child.getNextOMSibling();
}
getOMFactory().createOMText(this, value);
} else
_removeAllChildren();
return (T)this;
}
代码示例来源:origin: org.bluestemsoftware.open.eoa.ext/open-eoa-aspect-axiom
/**
* Creates a text node with the given value and adds it to the element.
*
* @see org.apache.axiom.om.OMElement#setText(String)
*/
public void setText(String text) {
if (this.isReadonly()) {
String msg = DOMMessageFormatter.formatMessage(
DOMMessageFormatter.DOM_DOMAIN,
"NO_MODIFICATION_ALLOWED_ERR", null);
throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
msg);
}
// if we already have other text nodes remove them
OMNode child = this.getFirstOMChild();
while (child != null) {
if (child.getType() == OMNode.TEXT_NODE) {
child.detach();
}
child = child.getNextOMSibling();
}
TextImpl textNode = (TextImpl) (this.ownerNode)
.createTextNode(text);
this.addChild(textNode);
}
内容来源于网络,如有侵权,请联系作者删除!