How can I set variables in an XML document in Java?
Suppose I have the following XML document in a file on disk:
<?xml version="1.0" encoding="UTF-8"?>
<document>
<entity type="normal" id="1">${foo}</entity>
</document>
Then I use an org.w3c.dom.DocumentBuilder to parse this into an
org.w3c.dom.Document. Let's say I store this Document in the variable
doc. How can I do something like this:
doc.setVariable("foo", "bar");
so the document the Document represents ends up as this?
<?xml version="1.0" encoding="UTF-8"?>
<document>
<entity type="normal" id="1">bar</entity>
</document>
Joona Palaste