[Issue 3200] std.xml doesn't follow spec for Tag.text

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Apr 5 09:44:18 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=3200


Rainer Schuetze <r.sagitario at gmx.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch
                 CC|                            |r.sagitario at gmx.de


--- Comment #1 from Rainer Schuetze <r.sagitario at gmx.de> 2010-04-05 09:44:15 PDT ---
This is caused by encode and decode being inverted for attributes and the the
element text never being decoded. Here is a patch

Index: xml.d
===================================================================
--- xml.d    (revision 1476)
+++ xml.d    (working copy)
@@ -991,7 +991,7 @@
                 reqc(s,'=');
                 munch(s,whitespace);
                 reqc(s,'"');
-                string val = encode(munch(s,"^\""));
+                string val = decode(munch(s,"^\""));
                 reqc(s,'"');
                 munch(s,whitespace);
                 attr[key] = val;
@@ -1088,7 +1088,7 @@
             {
                 string s = "<" ~ name;
                 foreach(key,val;attr)
-                    s ~= format("
%s=\"%s\"",key,decode(val,DecodeMode.LOOSE));
+                    s ~= format(" %s=\"%s\"",key,encode(val.dup)); //
decode(val,DecodeMode.LOOSE));
                 return s;
             }

@@ -1945,7 +1945,7 @@
                     invariant(char)* p = startTag.tagString.ptr
                         + startTag.tagString.length;
                     invariant(char)* q = tag_.tagString.ptr;
-                    text = p[0..(q-p)];
+                    text = decode(p[0..(q-p)]);

                     auto element = new Element(startTag);
                     if (text.length != 0) element ~= new Text(text);

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list