[Webinar] Streamline your web hosting managementRegister Today


Validating XML against DTD with Perl???

Posted on 2000-01-04
Medium Priority
Last Modified: 2013-11-19
I have a program that generates XML files and I want
to do some automated testing.

Ideally, I'd like to use perl to validate the XML files created
against a DTD.

Is there any perl module that can do this easily??


I am aware of XML::Parser module from CPAN, however
this can not validate XML against a DTD (its built
on top of a non-validating parser (expat).
Question by:mweiler
1 Comment

Accepted Solution

s_franklin earned 300 total points
ID: 2375344
There are a few options that I can think of:

HTML::Validator is beta but does dtd-based validation. Furthermore, it lets you override the DTD definition to use your own file if you wish.


You could write a C++ app using one of the many toolkits that you called from your Perl code. I haven't checked IBM's xml4c recently (www.alphaworks.ibm.com) but it did support DTD-validation although it didn't give you much control over this functionality - pass or fail.

There are command-line SGML parsers that you could call. One you might want to look at is: http://www.jclark.com/sp/

Also, I did a quick check at CPAN and saw XML::ESISParser which indicates that it does DTD-based validation. It looks like it just uses the command-line XML validator mentioned above, providing some convenient interfaces for you as a perl programmer.

You may also want to peek at libxml-enno for XML:Checker and XML:DOM:ValParser. I think these are alpha.



Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface This article introduces an authentication and authorization system for a website.  It is understood by the author and the project contributors that there is no such thing as a "one size fits all" system.  That being said, there is a certa…
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
Suggested Courses

591 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question