html - How can I take an xml string and display it on my page similiar to how StackOverflow does it with 'insert code'? -
i'm using datacontractserializer convert , object returned wcf call xml. client see xml string in webpage. if output string directly label, browser strips out angle brackets obviously. question how can similar stackoverflow? doing find & replace replace angle brackets html entities? see doing code tag inside pre tag , making spans appropriate class. there existing utility out there can use instead of writing kind of parsing routine. i'm sure free must out there. if can direct right place or code can accomplish this, appreciate it. apologize if more of meta.stackoverflow question. tips.
the basic answer html displayed typed, special characters , all, need replace special characters (<
, >
etc.), escaped equivalents (>
, <
etc.). beyond if want syntax colouring you'll have parse input identify keywords etc.
a full list of special characters , escape codes can found here, 1 site of many.
Comments
Post a Comment