2

I'm trying to access an XML file using DOM. One node is already commented out. How do I uncomment it using java code?

1 Answer 1

1

A comment is a special node in DOM. See the Comment class. A comment could indeed contain anything, including wrongly formatted code. So there is not such thing as toggle comment/uncomment in DOM, even if that's what we are used to do as developper.

So to uncomment, I guess you will need to remove the node, and create a regular DOM node that correspond to your need. You may need to parse the comment content returned by Comment#getData().

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.