Sometimes, we want to escape ampersands in XML so they are rendered as entities in HTML.
In this article, we’ll look at how to escape ampersands in XML so they are rendered as entities in HTML.
How to escape ampersands in XML so they are rendered as entities in HTML?
To escape ampersands in XML so they are rendered as entities in HTML, we put &
in our code.
For instance, we write
&
anywhere in our code to render &
in the XML code.
And the same code will be rendered as &
in HTML.
Conclusion
To escape ampersands in XML so they are rendered as entities in HTML, we put &
in our code.