lib/xmlEscape.c File Reference

#include "common.h"
#include "hash.h"
#include "xmlEscape.h"

Include dependency graph for xmlEscape.c:

Go to the source code of this file.

Functions

hashxmlEscapeSymHash ()
void xmlEscapeBytesToFile (unsigned char *buffer, int len, FILE *f)
void xmlEscapeStringToFile (char *s, FILE *f)


Function Documentation

void xmlEscapeBytesToFile ( unsigned char *  buffer,
int  len,
FILE *  f 
)

Definition at line 20 of file xmlEscape.c.

Referenced by xmlEscapeStringToFile().

00022 {
00023 unsigned char c;
00024 int i;
00025 for (i=0; i<len; ++i)
00026     {
00027     c = buffer[i];
00028     if (isalnum(c))
00029         fputc(c, f);
00030     else
00031         {
00032         switch (c)
00033             {
00034             case '&':
00035                 fputs("&amp;", f);
00036                 break;
00037             case '\'':
00038                 fputs("&apos;", f);
00039                 break;
00040             case '"':
00041                 fputs("&quot;", f);
00042                 break;
00043             case '<':
00044                 fputs("&lt;", f);
00045                 break;
00046             case '>':
00047                 fputs("&gt;", f);
00048                 break;
00049             case ' ':
00050             case '-':
00051             case '\t':
00052             case '\n':
00053             case ',':
00054             case '.':
00055             case ';':
00056             case ':':
00057             case '(':
00058             case ')':
00059             case '[':
00060             case ']':
00061             case '#':
00062             case '/':
00063                 fputc(c, f);
00064                 break;
00065             default:
00066                 fprintf(f, "&#%d;", c);
00067                 break;
00068             }
00069         }
00070     }
00071 }

Here is the caller graph for this function:

void xmlEscapeStringToFile ( char *  s,
FILE *  f 
)

Definition at line 73 of file xmlEscape.c.

References xmlEscapeBytesToFile().

00075 {
00076 int len = strlen(s);
00077 xmlEscapeBytesToFile((unsigned char *)s, len, f);
00078 }

Here is the call graph for this function:

struct hash* xmlEscapeSymHash (  )  [read]

Definition at line 8 of file xmlEscape.c.

References hashAdd(), and newHash().

Referenced by xpNew().

00010 {
00011 struct hash *symHash = newHash(6);
00012 hashAdd(symHash, "lt", "<");
00013 hashAdd(symHash, "gt", ">");
00014 hashAdd(symHash, "amp", "&");
00015 hashAdd(symHash, "apos", "'");
00016 hashAdd(symHash, "quot", "\"");
00017 return symHash;
00018 }

Here is the call graph for this function:

Here is the caller graph for this function:


Generated on Tue Dec 25 20:23:32 2007 for blat by  doxygen 1.5.2