You can use "
From the XML specification:
To allow attribute values to contain both single and double quotes, the apostrophe or single-quote character (') may be represented as "'", and the double-quote character (") as """.
A double quote character ("
) can be escaped as "
, but here's the rest of the story...
In XML attributes delimited by double quotes:
<EscapeNeeded name="Pete "Maverick" Mitchell"/>
In XML textual content:
<NoEscapeNeeded>He said, "Don't quote me."</NoEscapeNeeded>
In XML attributes delimited by single quotes ('
):
<NoEscapeNeeded name='Pete "Maverick" Mitchell'/>
Similarly, ('
) require no escaping if ("
) are used for the attribute value delimiters:
<NoEscapeNeeded name="Pete 'Maverick' Mitchell"/>
The String conversion page on the Coder's Toolbox site is handy for encoding more than a small amount of HTML or XML code for inclusion as a value in an XML element.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With