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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jul 21 18:01:43 PDT 2009


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

           Summary: std.xml doesn't follow spec for Tag.text
           Product: D
           Version: 2.031
          Platform: Other
               URL: http://digitalmars.com/d/2.0/phobos/std_xml.html#text
        OS/Version: Linux
            Status: NEW
          Severity: minor
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: Jesse.K.Phillips+D at gmail.com
                CC: Jesse.K.Phillips+D at gmail.com


According to the documentation having & in a tag will be turned to &. The
example code below will output:

Attr: What & Up
Elem: What & Up

*testfile.xml:*

<?xml version="1.0" encoding="utf-8"?> <Tests>
    <Test thing="What &amp; Up">What &amp; Up</Test>
</Tests>


*test.d:*

import std.stdio;
import std.xml;

void main() {
    auto file = "testfile.xml";

    auto s = cast(string)std.file.read(file);

    auto xml = new DocumentParser(s);

    xml.onStartTag["Test"] = (ElementParser xml) {
        writeln("Attr: ", xml.tag.attr["thing"]);
    };

    xml.onEndTag["Test"] = (in Element e) {
        writeln("Elem: ", e.text);
    };
    xml.parse();
}

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