How to write a text value into an XUI document

Keith Berard shows the importance of the "text node" Last Updated: 2006-06-18

Hmm, I'm guessing the issues is that you're not creating a text node as the first child under the parent? Here's a working example in C#. In this case, the xuiTextBox is set to a xui node.

private void SetDisplayText(string text, string textBoxId) { Epic.IDOMElement xuiTextBox = xuiDoc.GetElementById(textBoxId); if (xuiTextBox != null) { if (xuiTextBox.FirstChild == null) { xuiTextBox.AppendChild(xuiDoc.CreateElement("value")); }    Epic.IDOMElement valNode = (Epic.IDOMElement) xuiTextBox.FirstChild; if (valNode.FirstChild != null) { valNode.RemoveChild(valNode.FirstChild); }    valNode.AppendChild(xuiDoc.CreateTextNode(text)); } }

Also, retrieving the value is accomplished as follows:

private string GetTextboxValue(Epic.IDOMElement textBox) { if (textBox != null && textBox.FirstChild != null) { Epic.IDOMNode valNode = textBox.FirstChild; if (valNode.FirstChild != null) { return valNode.FirstChild.NodeValue.ToString; }  }   return null; }

Sorry for the c#. It should convert to java pretty easily however. (I'm also being extra careful to avoid nulls, which may or may not be necessary)