public OMText createOMText(OMContainer parent, char[] charArary, int type) { ElementImpl parentElem = (ElementImpl) parent; TextImpl txt = new TextImpl((DocumentImpl) parentElem .getOwnerDocument(), charArary, this); parentElem.addChild(txt); return txt; }
/** * Creates a new OMDOM Text node with the given value and appends it to the given parent * element. * * @see org.apache.axiom.om.OMFactory#createOMText( org.apache.axiom.om.OMElement,String) */ public OMText createOMText(OMContainer parent, String text) { ElementImpl parentElem = (ElementImpl) parent; TextImpl txt = new TextImpl((DocumentImpl) parentElem .getOwnerDocument(), text, this); parentElem.addChild(txt); return txt; }
/** * 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); }