www.digitalmars.com         C & C++   DMDScript  

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

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 puremagic.com
          Reporter: slavo5150 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".

--
Jul 31