digitalmars.D.bugs - [Issue 4069] New: std.xml.Document.pretty saves empty elements with spaces and line breaks
- d-bugmail puremagic.com (36/36) Apr 05 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4069
- d-bugmail puremagic.com (24/24) Apr 05 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4069
- d-bugmail puremagic.com (12/12) Feb 07 2011 http://d.puremagic.com/issues/show_bug.cgi?id=4069
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 puremagic.com ReportedBy: r.sagitario gmx.de 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 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: -------
Apr 05 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4069 Rainer Schuetze <r.sagitario gmx.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch, wrong-code PDT --- Here's a patch that switches to the short form of an empty element: Index: xml.d =================================================================== --- xml.d (revision 1476) +++ xml.d (working copy) -887,7 +887,7 return buffer; } - override bool isEmptyXML() { return false; } /// Returns false always + override bool isEmptyXML() { return items.length == 0; } } } The resulting output is: doc: '<root> <elem /></root>' elem: '' -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Apr 05 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4069 Walter Bright <bugzilla digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |bugzilla digitalmars.com Resolution| |FIXED 00:45:13 PST --- https://github.com/D-Programming-Language/phobos/commit/b3ad939cf41adfefd33b16d2d91ca56d568cddac -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 07 2011