troubleshooting Question

change the root (Element)node of a w3c dom document

Avatar of bhomass
bhomass asked on
6 Comments1 Solution931 ViewsLast Modified:
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?
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 6 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros