Is there a native WinAPI to call to escape a string for HTML/XML into <
>
etc?
Asked
Active
Viewed 292 times
0

Paul Dixon
- 295,876
- 54
- 310
- 348

CS.
- 1,845
- 1
- 19
- 38
-
Do you want entities? > to > et al – Alex K. Sep 26 '12 at 11:42
-
Yes, sorry, seems SO parsed & gt ; – CS. Sep 26 '12 at 11:48
-
1You could do it manually http://stackoverflow.com/questions/5665231/most-efficient-way-to-escape-xml-html-in-c-string – Alex K. Sep 26 '12 at 11:56
1 Answers
3
The Windows API does not provide any such simple function, to the very best of my knowledge. That sort of functionality is typically provided by libraries.
Normally you will be using an HTML or XML library to generate your HTML or XML. That's almost always a better strategy than trying to assemble it yourself. And those libraries will do the necessary escaping for you.
For example, a commonly used library to work with XML on Windows is MSXML. You can use that library to parse and emit XML and it will take care of escaping for you.

David Heffernan
- 601,492
- 42
- 1,072
- 1,490