in reply to Re: What does this comment mean (Are DTDs of any use to XML::Parser?)
in thread What does this comment mean (Are DTDs of any use to XML::Parser?)

I guess I wasn't clear -- what I wanted to say was how would a DTD actually be used in the code. That is, if I were to validate some XML, wouldn't that require some sort of if-elsif anyway? I don't see why having a DTD in particular would help. I was hoping that the comment meant something analogous to "We wouldn't need a bike if we had a car", not something like "We wouldn't need a bike if we had instructions"

Replies are listed 'Best First'.
Re^3: What does this comment mean (Are DTDs of any use to XML::Parser?)
by ikegami (Patriarch) on May 04, 2018 at 00:38 UTC

    As I said, they would use an *existing* validator.

    my $dtd = XML::LibXML::Dtd->new(...); $doc->validate($dtd);

    Less code means less to maintain. It also means you can use a faster, tested solution (such as the C++ library libxml2 used by XML::LibXML).