c# - Preserve XML entity references while getting InnerText or InnerXml with XmlDocument -
i trying innertext
or innerxml
of xml node
using xmldocument
, @ same time want preserve & ' "
.
however, if try innerxml
, preserves &
not '
, "
i know exact reason why happening , solution problem.
e.g. suppose have xml node text inside "'cancel' & 'abort'"
, in retrun when read node innerxml
(or innertext
), must give me exact same string output.
but when try this, returns, "'cancel' & 'abort'"
means preserves &
note:
<source>"&cancel'"</source> <target>"&cancel'"</target>
this have in xliff(xml) file, while reading xliff(xml) file, want retrieve text inside both nodes visible now, without exclusive conversion or processing.
the problem xliff(xml) data have, contains both '
or "
'
, "
, goal detect these entity references error because not supposed have in our data. in other words, '
or "
shall permitted in our data.
try using webutility.htmlencode()
method on innerxml
or innertext
Comments
Post a Comment