diff options
-rw-r--r-- | colm/tree.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/colm/tree.cpp b/colm/tree.cpp index dce1e5e8..fafef8b0 100644 --- a/colm/tree.cpp +++ b/colm/tree.cpp @@ -479,7 +479,13 @@ void print_tree( ostream &out, Tree **&sp, Program *prg, Tree *tree ) void xml_escape_data( const char *data, long len ) { for ( int i = 0; i < len; i++ ) { - if ( 32 <= data[i] && data[i] <= 126 ) + if ( data[i] == '<' ) + cout << "<"; + else if ( data[i] == '>' ) + cout << ">"; + else if ( data[i] == '&' ) + cout << "&"; + else if ( 32 <= data[i] && data[i] <= 126 ) cout << data[i]; else cout << "&#" << ((unsigned)data[i]) << ';'; |