Is std.xml seriously broken, or is it me?
Joakim via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Jul 30 12:38:50 PDT 2017
On Sunday, 30 July 2017 at 03:16:35 UTC, Mike wrote:
> On Sunday, 30 July 2017 at 02:58:09 UTC, Mike wrote:
>
>> [...]
>
> It appears `onStartTag` does not handle the root element. For
> example, this code seems to work:
>
> 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();
> }
>
> Mike
You may want to try the experimental candidate for Phobos
instead, which was developed as a GSoC project but never finished:
http://code.dlang.org/packages/std-experimental-xml
More information about the Digitalmars-d-learn
mailing list