Question

I'm working on the beginnings of porting my php based OOP web framework to the d language and I'm having some trouble figuring out if it is safe to rely on phobos' std.xml classes to read xml from files and/or streams. There seems to be quite a bit of chatter on replacing std.xml, so much even that I'm considering rolling my own 100% d xml parser.

Since this is very much a hobby project, I don't mind designing my own wheels all that much, it'd be a fun exercise and give me a chance to learn more about the language faster. On the other hand, If I don't have to roll my own, I could potentially be up and running much faster.

I'll need to support basically a nearly full xml 1.0 spec, most notably I'll need xml namespaces and xincludes to work properly. I'd also want my API to be more or less consistent with php's DOMDocument, c#'s System.Xml.XmlDocument and javascript's DOM implementation. especially that last bit seems missing from phobos. Also phobos still seems to be at least somewhat in flux and I'm not up to speed on the level of flux it is in.

The big question therefor is: is it safe to rely on the parsing tools in phobos' std.xml being able to provide the lions share of my requirements, or should I write something from the ground up in my own library to be safe?

When answering please do consider my requirements:

  1. full xmlns support
  2. xincludes
  3. should be able to read from file, stream or string
  4. needs to be as similar as possible to the big DOM implementations and spec
Was it helpful?

Solution

Don't use std.xml. Aside from the fact that it is a terrible library, it's going to be replaced at some point.

OTHER TIPS

std.xml is going to be replaced. But there a DOM XML parser for D2, perhaps you should try it. It's in github (dom.d) : https://github.com/adamdruppe/misc-stuff-including-D-programming-language-web-stuff

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top