00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00031
00032 #ifdef HAVE_CONFIG_H
00033 #include "autoconfig.h"
00034 #endif
00035
00036 #include "mxml.h"
00037
00038 #include <string.h>
00039
00040 using namespace zmm;
00041 using namespace mxml;
00042
00043 String Node::print()
00044 {
00045 Ref<StringBuffer> buf(new StringBuffer());
00046 print_internal(buf, 0);
00047 return buf->toString();
00048 }
00049
00050 String Node::escape(String str)
00051 {
00052 Ref<StringBuffer> buf(new StringBuffer(str.length()));
00053 signed char *ptr = (signed char *)str.c_str();
00054 while (ptr && *ptr)
00055 {
00056 switch (*ptr)
00057 {
00058 case '<' : *buf << "<"; break;
00059 case '>' : *buf << ">"; break;
00060 case '&' : *buf << "&"; break;
00061 case '"' : *buf << """; break;
00062 case '\'' : *buf << "'"; break;
00063
00064 default : if (((*ptr >= 0x00) && (*ptr <= 0x1f) &&
00065 (*ptr != 0x09) && (*ptr != 0x0d) &&
00066 (*ptr != 0x0a)) || (*ptr == 0x7f))
00067 {
00068 *buf << '.';
00069 }
00070 else
00071 *buf << *ptr;
00072 break;
00073 }
00074 ptr++;
00075 }
00076 return buf->toString();
00077 }
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087