change the root (Element)node of a w3c dom document
I am in the process of changing a dom4j implementation to a the w3c dom. I am not able to find many of the equivalent calls.
for example, there is a case when I want to take a html fragment which starts with a <div>, and add the surrounding html tags, starting with <html><head></head><body>......</body></html>.
I can create new tags with Document.createElement(name), but I don't see any way to set the new <html> tag as the root element, nor any way to change the parent node of the <div> tag. In fact, it would be nice if I can change the <div> tag to a <body> tag. but I don't see any api to change tag name either.
How are you suppose to accomplish the adding of surrounding tags to an existing html fragment using w3c dom?
8/22/2022 - Mon
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!