Hi everyone,
I need to create XML that looks like this whenever the value of "tag"
is "" (the empty string):
<root>
<tag></tag>
</root>
I've tried the following:
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document d = db.newDocument();
Element root = d.createElement("root");
Element tag = d.createElement("tag");
d.appendChild(root);
root.appendChild(tag);
Text text = d.createTextNode("\t");
tag.appendChild(text);
but I always end up with XML like this:
<root>
<tag/>
</root>
Is there a way to force empty text nodes to get "denormalized" ?
Thanks,
Ian.