digitalmars.D.learn - Is std.xml seriously broken, or is it me?
- Mike (19/19) Jul 29 2017 I'm trying to use std.xml, and I can't get it to work.
- Mike (16/31) Jul 29 2017 It appears `onStartTag` does not handle the root element. For
- Joakim (4/21) Jul 30 2017 You may want to try the experimental candidate for Phobos
- Kagamin (3/4) Jul 31 2017 Looks like a bug. Until the module is replaced, bug reports are
- Meta (6/25) Jul 29 2017 I don't know about your code specifically, but std.xml has been
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
Jul 29 2017
On Sunday, 30 July 2017 at 02:58:09 UTC, Mike wrote: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?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
Jul 29 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: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[...]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
Jul 30 2017
On Sunday, 30 July 2017 at 03:16:35 UTC, Mike wrote:It appears `onStartTag` does not handle the root element.Looks like a bug. Until the module is replaced, bug reports are still accepted for it.
Jul 31 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, MikeI 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
Jul 29 2017