Re: [xml-dev] Internal entities removed from XML?

From
Rich Salz <>
To
Rick Jelliffe <>
Date
2002-12-19T21:06:49Z
ID
<>
Thread
Re: [xml-dev] Internal entities removed from XML?
> Only benchmarking/profiling can tell

It's hard to beat this:
int
expand_entities_in_text_node(char* buff, int size)
{
     char *start, *src;
     for (start = src = buff; --size >= 0; )
     {
         if ((*buff++ = *src++) == '&')
         {
             if (size >= 3
             && src[0] == 'l' && src[1] == 't' && src[2] == ';')
                 buff[-1] = '<', src += 3, size -= 2;
             else if (size >= 4
                  && src[0] == 'a' && src[1] == 'm' && src[2] == 'p'
                  && src[3] == ';')
                 src += 4, size -= 3;
         }
     }
     return buff - src;
}