Is std.xml seriously broken, or is it me?

Meta via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Jul 29 21:38:23 PDT 2017


On Sunday, 30 July 2017 at 02:58:09 UTC, Mike wrote:
> I'm trying to use std.xml, and I can't get it to work.
>
> I tried the simplest program I could think of:
>
> 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();	
> }
>
> https://dpaste.dzfl.pl/262597d2fda6
>
> I used it before without any trouble.  Is it somehow seriously 
> broken?  If not, what am I doing wrong?
>
> Thanks,
> Mike

I don't know about your code specifically, but std.xml has been 
on the chopping block for many years and is pretty much still 
around because nobody has written a replacement yet. I'd 
recommend using Adam Ruppe's DOM library instead:

https://github.com/adamdruppe/arsd/blob/master/dom.d


More information about the Digitalmars-d-learn mailing list