-1

How to use exclamation mark in XML file.

Can someone please help what is the escape character for (!)...

the password contain exclamation mark so that i'm facing an issue on XML file.

<password value="Example!"/>

thanks in advance

  • Hello, and welcome to SO. Could you please post a little piece of code to help us understand better which issue you are facing? In XML the exclamation mark is used as prefix for declaration elements, such as `!DOCTYPE` and comments ``. – Daemon Painter Nov 28 '19 at 07:53
  • thanks for your reply. please find the sample code – Karthikeyen Nov 28 '19 at 07:59
  • Thanks for the code, you should not put it here in the comments, though. Edit your original question to include it. This time, I'll do it with you. Also, have a look at this other [link](https://stackoverflow.com/questions/57185977/xml-what-does-exclamation-mark-mean-in-some-text) as well. As far as I can see, there is nothing wrong with that snippet, except maybe a missing whitespace between the closing double quote and the slash. Please, could you describe the issue you are facing as well? Are you parsing this to HTML? – Daemon Painter Nov 28 '19 at 08:00
  • "i'm facing an issue on XML file" — **What** issue are you facing? – Quentin Nov 28 '19 at 08:47
  • Why is this question tagged [tag:html]? There's no mention of HTML or anything to do with webpages in the question other than that tag. – Quentin Nov 28 '19 at 08:47
  • showing as red color in password tag. and while executing its throughout login failed error because of exclamation. – Karthikeyen Nov 28 '19 at 09:11

1 Answers1

0

As far as I know, there is no need to escape the exclamation mark in xml. There are a number of caveats for characters and their usage, and I refer you to this answer on escaping xml.

In summary, there are only five characters to escape

"   &quot;
'   &apos;
<   &lt;
>   &gt;
&   &amp;

and you should avoid -- in comment strings.

Daemon Painter
  • 3,208
  • 3
  • 29
  • 44