[Issue 17709] New: std.xml doesn't parse the root element

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Jul 31 17:24:42 PDT 2017


https://issues.dlang.org/show_bug.cgi?id=17709

          Issue ID: 17709
           Summary: std.xml doesn't parse the root element
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: slavo5150 at yahoo.com

import std.xml;
import std.stdio;

void main()
{
    auto parser = new DocumentParser("<?xml version=\"1.0\"
encoding=\"utf-8\"?><device></device>");
    parser.onStartTag["device"] = (ElementParser parser)
    {
        writeln("device");
    };
    parser.parse();    
}

That code does not print "device",  However...

import std.xml;
import std.stdio;

void main()
{
    auto parser = new DocumentParser("<?xml version=\"1.0\"
encoding=\"utf-8\"?><device><peripheral></peripheral></device>");
    parser.onStartTag["peripheral"] = (ElementParser parser)
    {
        writeln("peripheral");
    };
    parser.parse();    
}

that code will print "peripheral".

--


More information about the Digitalmars-d-bugs mailing list