Validating xml with perl
However, the complete working application is available in this month's sample code for you to peruse, install, or extend as desired.First, we will create the application's method is wrapped in an eval block.Content models may be open or closed; you can declare a document structurally valid based on a single all-important rule; or you can create rules for each and every element and attribute that may appear in the document -- the choice is yours.
DTDs and W3C Schemas have their place, but the learning curve involved in getting it right in order provide a useful level of content validation make their use for most applications impractical. Created by Rick Jelliffe, Schematron is a simple XML application language designed to make validating the structures of XML documents as straightforward and painless as possible.
Example 22-7 is a DTD for the element didn't follow the DTD, but it couldn't tell us precisely what it violated in the DTD or how.