[xml] default entities



Hi,

I did a small change in xmlEscapeEntities() from xmlsave.c to take account of the xmlSubstituteEntitiesDefaultValue parameter. So, now I can control if default entities will be substitute or not by xmlSubstituteEntitiesDefault() in tree serialization like with the parser.

I wanna now if this behavior can be added to libxml2 ? If yes, how is the process ?
Bellow is a diff from my xmlsave.c against the libxml2-2.6.23 xmlsave.c.

cheers,
Guilherme Balestieri Bedin [gbedin]



--- ../xmlsave.c    2005-11-09 06:51:56.000000000 -0200
+++ xmlsave.c    2006-02-14 16:00:36.000000000 -0200
@@ -212,7 +212,7 @@
    inend = in + (*inlen);
while ((in < inend) && (out < outend)) {
-        if (*in == '<') {
+        if (xmlSubstituteEntitiesDefaultValue && *in == '<') {
        if (outend - out < 4) break;
        *out++ = '&';
        *out++ = 'l';
@@ -220,7 +220,7 @@
        *out++ = ';';
        in++;
        continue;
-    } else if (*in == '>') {
+    } else if (xmlSubstituteEntitiesDefaultValue && *in == '>') {
        if (outend - out < 4) break;
        *out++ = '&';
        *out++ = 'g';
@@ -228,7 +228,7 @@
        *out++ = ';';
        in++;
        continue;
-    } else if (*in == '&') {
+    } else if (xmlSubstituteEntitiesDefaultValue && *in == '&') {
        if (outend - out < 5) break;
        *out++ = '&';
        *out++ = 'a';





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