Not necessarily, and it wouldn't be recommended. Admittedly it is likely to prevent DOM-based XSS in the majority of cases (in an HTML output context anyway), but not all as detailed on OWASP...
--- SNIP ---
If that isn’t enough to keep in mind, you have to remember that encodings are lost when you retrieve them using the value attribute of a DOM element.
This page also includes examples.
Furthermore, HTML encoding only applies when the output context is HTML.