Trying to pretty-print XML within pango markup language

I want to use the Pango markup language to display syntax-highlighted
XML in a GtkTreeView.  Unfortunately, XML looks a lot like the Pango
markup language.  Is there a way of "escaping" my "<" and ">" symbols,
perhaps using "&lt"; and "&gt"?

As a nasty example, consider the case where you want to display the text
"<span>", showing the enclosing symbols in a different colour to the
word "span".  A naive approach suggests something like: 
"<span foreground="red"><</span>span<span foreground="red">></span>"

In case it "just worked", I tried this, but I get errors like
(conge:31728): Gtk-WARNING **: Failed to set cell text from markup due
to error parsing markup: Error on line 1 char 33: '<' is not a valid
character following a '<' character; it may not begin an element name

Any ideas?  Can this be fixed without potentially breaking existing
apps.  Possibly by adding an attribute to the root "markup" tag?

Or am I missing something obvious?

Dave Malcolm

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]