I have a requirement where I need to create 2 XMLs with only one Element value (TextNode) being different and put on different MQ queues. I have already created one XML and put on a queue. Now how do I replace the Element value within that DOM Object.
You'll find the problem easier when you realize the non-obvious way that DOM works. Your question ("How do I replace the Element value") is meaningless because an Element doesn't have a value. But what you want to modify is actually the Text node that is the Element's only child.
So navigate to the <NAME> element, then to its first child, which should be a Text node. Call setValue("XYZ") on that node and you're done.