Re: xml preformated text & db2html != gnome-db2html



Buvo Pn, 2001-05-04 09:42-0400, kai Havoc Pennington rašė:
> > 1) How can I put preformated text (that may contain "</>" etc)
> > without confusing the xml parser? Last time I tried, it was
> > producing errors and core dumped. May be I'm missing something
> > here, but I just couldn't make it.
> 
> You just escape the text, along these lines:
> 
> static void
> append_escaped_text (GString     *str,
>                      const gchar *text,
>                      gint         length)
> {
>   const gchar *p;
>   const gchar *end;
> 
>   p = text;
>   end = text + length;
> 
>   while (p != end)
>     {
>       const gchar *next;
>       next = g_utf8_next_char (p);
> 
>       switch (*p)
>         {
>         case '&':
>           g_string_append (str, "&amp;");
>           break;

I have seen this code today in xmlEncodeEntities function from
gnome-xml/entities.c

It encodes not only & < >  but > 0x7f characters also. You may not like
this.

-- 
Gediminas Paulauskas  ---  ICQ 24859336  ---  tel. (8-27) 321793




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