c# - Regex to replace " with " only if it's not in another " -
i'm converting an encoded xml
document original format
string myxml = oldxml.replace("<", "<").replace("&", "&") .replace(">", ">") .replace(""", "\"") .replace("'", "'");
it works fine. want exclude "
if in "
.
example:
original xml
//note title value <v:shape id="_x0000_i1025" title="a" title "b"> </v:shape>
encoded xml
<v:shape id="_x0000_i1025" title="a" title "b"> </v:shape>
recovered xml after replace
//note title value <v:shape id="_x0000_i1025" title="a" title "b"> </v:shape>
as can see inside "
shouldn't convert "
. how can replace regex doesn't replace inside "
thank you
turned out don't need recover encoded xml
.
since nodelement.setattribute("myxmlattribute", myxml);
encodes original xml @ first place, when read attribute value , assign string, c#
recover original xml automatically.
string content = thenode.attributes["myxmlattribute"].value;
i don't need replacing.
Comments
Post a Comment