[Issue 3201] New: std.xml incorrectly converts symbols in attributes, & -> & amp

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jul 21 18:05:17 PDT 2009


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

           Summary: std.xml incorrectly converts symbols in attributes,
                    & -> &amp
           Product: D
           Version: 2.031
          Platform: Other
        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


The example code below will output:

Attr: What & Up
Elem: What & Up

Expected:

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