Forum Discussion
Doug_Marquardt
Jul 30, 2022Copper Contributor
XML Conversion For Node Text Containing &
When I cast a string (which is xml) to the xml data type and the node comments contain & it gets converted to &. For example:
Declare @xml xml =
'
<SHOP_INSTRUCTIONS>
Remove & return to stock.
</SHOP_INSTRUCTIONS>
';
Select @xml;
/*
Return This:
<SHOP_INSTRUCTIONS>
Remove & return to stock.
</SHOP_INSTRUCTIONS>
*/
I would expect the conversion to be: Remove & return to stock.
Am I getting the correct results, or what am I missing?
Thanks.
If that's the only error please remove apostrophes here
=IF(V11<15000/12,0,
IF(V11<30000/12, "(V10-(15000/12))*2.5%",
IF(V11<45000/12, "((V10-(30000/12))*10%)+(375/12)",
IF(V11<60000/12, ((V11-(45000/12))*15%)+(1875/12),
IF(V11<200000/12, ((V11-(60000/12))*20%)+(4125/12),
IF(V11<400000/12, ((V11-(200000/12))*22.5%)+(32125/12),
IF(V11<600000/12, "((V10-(400000/12))*25%)+(77125/12)",
IF(V11<700000/12, "((V10-(400000/12))*25%)+(77500/12)",
IF(V11<800000/12, ((V11-(400000/12))*25%)+(79750/12),
IF(V11<900000/12, ((V11-(400000/12))*25%)+(82000/12),
IF(V11<1000000/12,((V11-(400000/12))*25%)+(85000/12),
IF(V11>1000000/12,((V11-(400000/12))*25%)+(90000/12),0
))))))))))))
4 Replies
Sort By
- olafhelperBronze Contributor
Doug_Marquardt , & is just a different (decimal) encoding of & = ampersand.
See List of XML and HTML character entity references - Wikipedia
- Doug_MarquardtCopper Contributor
Yes, I realize that... but if I do this it throws an error:
Declare @xml xml = ' <SHOP_INSTRUCTIONS> Remove & return to stock. </SHOP_INSTRUCTIONS> '; Select @xml; XML parsing: line 3, character 9, illegal name character
So how do I represent & as part of the node text?
- olafhelperBronze ContributorSee the Wikipedia link I posted, one way is &