I want to make modifications to an XML document using SQL Server's XML.modify. My problem is my XML document uses some escaped XML so "<" are appearing as "<" and ">" is appearing as ">". I want to know if it would be possible to set the value of an element that is surrounded by escaped XML. An example of what I'm dealing with is below:
Declare @myDoc as xml;
Set @myDoc = '<Root>
<ProductDescription ProductID="1" ProductName="Road Bike">
<Features>
<BikeLight>False</BikeLight>
<BikeHorn>True</BikeHorn>
</Features>
</ProductDescription>
</Root>' ;
I know I can edit the value of the BikeLight element by using
set @myDoc.modify('replace value of (/Root/ProductDescription/Features/BikeLight/text())[1] with "True"')
but trying to do the same with BikeHorn only returns the XML document, unmodified. Is it possible to modify the value of elements surrounded by escaped XML? Any help would be appreciated, thanks. Also, just to note that in my actual code all elements under Features would be surrounded by escaped XML.