[Issue 4069] New: std.xml.Document.pretty saves empty elements with spaces and line breaks

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Apr 5 10:11:35 PDT 2010


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

           Summary: std.xml.Document.pretty saves empty elements with
                    spaces and line breaks
           Product: D
           Version: unspecified
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: r.sagitario at gmx.de


--- Comment #0 from Rainer Schuetze <r.sagitario at gmx.de> 2010-04-05 10:11:32 PDT ---
Test case:

import std.stdio;
import std.xml;
import std.string;

void main() {

    auto doc = new Document(new Tag("root"));
    doc ~= new Element("elem", "");
    string s = join(doc.pretty(1),"");
    writefln("doc: '%s'", s);

    auto xml = new Document(s);

    string t = xml.elements[0].text();

    writefln("elem: '%s'", t);
    assert(t == "");
}

outputs:

doc: '<root> <elem> </elem></root>'
elem: ' '
core.exception.AssertError at test(17): Assertion failure

This does not happen with non-empty elements or with Document.toString

-- 
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