public final void detachNode() { omTarget.detach(); }
public final void detachNode() { omTarget.detach(); }
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; } }
/** 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(); } }
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; } }
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; } }
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; } }
/** * 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(); }
/** * 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(); }
/** * 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; }
/** * 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; }
public boolean mediate(MessageContext synCtx) { SynapseLog synLog = getLog(synCtx); OMNode node = source.selectOMNode(synCtx, synLog); node.detach(); synCtx.setProperty(property, node); return true; }
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; }
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(); } } } } }
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(); } } } } }
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; }
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; }
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; }
/** * 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); }