Writing Subchild with DOM
-
Well, at some point you must read you document, i.e. go from one node to the other. At the end of the loop you should do something like
domNode = domeNode.nextSibling()
. If you don't do so, you're endlessly reading the first node of your document, as I've told you before. -
Ah! Thank you! @JohanSolo Now it goes through the loop properly, but the contents of the header is still empty. I just debugged, found out it never goes into
if(domElement.text() == "HEADER3")
I am not sure about hierarchy in the code. but the hierarchy in my XML file is as shown in this XML file
@JohanSolo I have edited the code accordingly
-
Yes! @JohanSolo Now it goes inside the loop, but does not write the contents inside HEADER3. This time i have no idea why. I have updated the code. Please do take a look.
-