/** * Go through all text nodes below this node, and replace their text with a trimmed version of their text. This changes the * DOM document. * * @param root * root */ public static void trimAllTextNodes(Node root) { Document doc = root.getNodeType() == Node.DOCUMENT_NODE ? (Document) root : root.getOwnerDocument(); NodeIterator it = ((DocumentTraversal) doc).createNodeIterator(root, NodeFilter.SHOW_TEXT, null, false); Text t = null; while ((t = (Text) it.nextNode()) != null) { String s = t.getData(); t.setData(s.trim()); } }
/** * Go through all text nodes below this node, and replace their text with a trimmed version of their text. This changes the * DOM document. * * @param root * root */ public static void trimAllTextNodes(Node root) { Document doc = root.getNodeType() == Node.DOCUMENT_NODE ? (Document) root : root.getOwnerDocument(); NodeIterator it = ((DocumentTraversal) doc).createNodeIterator(root, NodeFilter.SHOW_TEXT, null, false); Text t = null; while ((t = (Text) it.nextNode()) != null) { String s = t.getData(); t.setData(s.trim()); } }
} else { // found the one text element with non-whitespace content text.setData(s);
} else { // found the one text element with non-whitespace content text.setData(s);
encoding.appendChild(text); } else { text.setData(value);
/** * Set the identifier. */ public void setIdentifier(String uuid) { Text node = getFirstNode(elementIdentifier); node.setData(uuid); }
public void run() { if (errors > 0) { errorsText.setData(String.valueOf(errors)); completedPolygon.setAttribute(SVGConstants.SVG_FILL_ATTRIBUTE, SVGGraphSettings.ERROR_COLOUR); } else { errorsText.setData(""); completedPolygon.setAttribute(SVGConstants.SVG_FILL_ATTRIBUTE, SVGGraphSettings.COMPLETED_COLOUR); } } });
public void putTextData(String data) { Text textNode = getTextNode(); if (textNode == null) { textNode = factory.createTextNode(data); // Always add the text node as the first child (fixes bug 93718) element.insertBefore(textNode, element.getFirstChild()); } else { textNode.setData(data); } }
/** * Set the user name. * * @param name sets a text node containing the use name into the user name * element. */ public void setName(String name) { Text node = getFirstNode(elementUsername); node.setData(name); }
/** * Set the user name. * * @param name sets a text node containing the use name into the user name * element. */ public void setName(String name) { Text node = getFirstNode(elementUsername); node.setData(name); }
/** * Set the identifier. */ public void setIdentifier(String uuid) { Text node = getFirstNode(elementIdentifier); node.setData(uuid); }
/** * Set the identifier. */ public void setIdentifier(String uuid) { Text node = getFirstNode(elementIdentifier); node.setData(uuid); }
/** use this util method to set a Text Data in a element. * @param aElement Element for text node * @param aData String contains text */ public void setTextData (Element aElement, String aData) { getText (aElement).setData (aData); }
/** use this util method to set a Text Data in a element * @param aElement Element for text node * @param aData String contains text */ public void setTextData(Element aElement,String aData) { getText(aElement).setData(aData); }
public void notifyChanged(INodeNotifier notifier, int eventType, Object changedFeature, Object oldValue, Object newValue, int pos) { _cachedData = _textNode.getData(); _textNodeForFigure.setData(_cachedData); if (eventType == INodeNotifier.CHANGE) { getFigure().revalidate(); } else { // XXX: been removed? parent EditPart should have handled it. } }
/** * set the token information. * * @param data */ public void setToken(byte[] data) { if (data == null) { throw new IllegalArgumentException("data == null"); } Text node = getFirstNode(); node.setData(Base64.encode(data)); }
/** * set the token information. * * @param data */ public void setToken(byte[] data) { if (data == null) { throw new IllegalArgumentException("data == null"); } Text node = getFirstNode(); node.setData(Base64.encode(data)); }
/** * BASE64-Encode the raw token bytes + store them in a text child node. */ public void encodeRawToken() { if (data == null) { throw new IllegalArgumentException("data == null"); } Text node = getFirstNode(); node.setData(org.apache.xml.security.utils.XMLUtils.encodeToString(data)); }
public SOAPElement addTextNode(String text) throws SOAPException { Node firstChild = target.getFirstChild(); if (firstChild instanceof org.w3c.dom.Text) { ((org.w3c.dom.Text)firstChild).setData(text); } else { // Else this is a header ((OMNode)firstChild).insertSiblingBefore(this.omTarget.getOMFactory().createOMText(text)); } return this; }