dxml 0.1.0 released

Jonathan M Davis newsgroup.d at jmdavisprog.com
Fri Feb 9 22:23:58 UTC 2018


On Friday, February 09, 2018 13:47:52 H. S. Teoh via Digitalmars-d-announce 
wrote:
> As for DTDs, perhaps it might be enough to make normalize() configurable
> with some way to specify additional entities that may be defined in the
> DTD?  Once that's possible, I'd say it's Good Enough(tm), since the user
> will have the tools to build DTD support from what they're given.  Of
> course, "standard" DTD support can be added later, built on the current
> StAX parser.

As I understand it (though IMHO, the spec isn't clear enough, and I'd have
to go over it with a fine-tooth comb to make sure that I got it right), as
soon as you start dealing with entity references, you can pretty much just
drop whole sections of XML into your document, fundamentally, changing the
document. So, I don't think that it's possible to deal with the entity
references after the fact. They're basically macros that have to be expanded
while you're parsing, which is part of why they're so disgusting IMHO - even
without getting into any of the document validation stuff.

Though honestly, the part about the DTD section that I find truly offensive
is that the document itself is defining what constitutes valid input. Since
when does it make any sense for the _input_ for a program to tell the
program what constitutes valid input? That's for the program to decide. And
considering how much more complicated the parser has to be to properly deal
with the DTD makes its inclusion in the spec seem absolutely insane to me.

And none of that mess is necessary for simple, sane XML documents that are
just providing data.

I _might_ add a DTD parser later, but if I do, it will almost certainly be
its own separate parser. However, given how much of my life I would then be
wasting on something that I consider to be of essentially zero value (if not
negative value), I don't see myself doing it without someone paying me to.
IMHO, the only reason that it makes any sense to fully support the DTD
section is for those poor folks who have to deal with XML documents where
someone else decided to use those features, and they don't have any choice.
I would hope that few programmers would actually _want_ to be using those
features.

> I would support it if you proposed dxml to be added to Phobos.

I've thought about it, but I'd like to complete the writers and the DOM
parser first as well as see it get at least somewhat battle-tested. Right
now, it's just been used in a couple of my personal projects, which did
affect some of my design choices (for the better, I think), but since no one
else has done anything with it, there may be something that it needs that
I've completely missed. The API is simple enough that I _think_ that it's
good as-is and that improvements are largely a question of adding helper
functions, but the library does need more widespread use and feedback.

- Jonathan M Davis



More information about the Digitalmars-d-announce mailing list