Pretty simple question - I have an attribute that I would like to have double quotes in. How do I escape them? I\'ve tried
Wouldn't that be "
in xml? i.e.
"hi "mom" lol"
**edit: ** tested; works fine:
declare @xml xml
set @xml = '<transaction><item value="hi "mom" lol"
ItemId="106" ItemType="2" instanceId="215923801" dataSetId="1" /></transaction>'
select @xml.value('(//item/@value)[1]','varchar(50)')
tSql escapes a double quote with another double quote. So if you wanted it to be part of your sql string literal you would do this:
declare @xml xml
set @xml = "<transaction><item value=""hi"" /></transaction>"
If you want to include a quote inside a value in the xml itself, you use an entity, which would look like this:
declare @xml xml
set @xml = "<transaction><item value=""hi "mom" lol"" /></transaction>"
In Jelly.core to test a literal string one would use:
<core:when test="${ name == 'ABC' }">
But if I have to check for string "Toy's R Us":
<core:when test="${ name == &quot;Toy's R Us&quot; }">
It would be like this, if the double quotes were allowed inside:
<core:when test="${ name == "Toy's R Us" }">
Cannot comment anymore but voted it up and wanted to let folks know that "
works very well for the xml config files when forming regex expressions for RegexTransformer in Solr like so: regex=".*img src="(.*)".*"
using the escaped version instead of double-quotes.