Both of these features (and Relax NG validation) are planned for XML:: Lib XML, but weren't available at the time of printing. Always validating raises an error if the file does not have a DTD or Schema.Auto raises an error only if the file has a DTD or Schema, but it fails to validate against that DTD or Schema.Validation lists: Validates the current element, and recursively validates all child elements.
Checks against the list of attributes possible for this element (taken from @oattr and @rattr) to ensure that all of the parsed attributes are valid.
Personally if I need to generate a schema from an existing XML document I use the that is part of the .
NET framework, this is also available for mono if you are not on Windows and the mono implementation is described here.
If any parsed attributes are not in the list of possible attributes for this element, err_handler will be called with a message stating the error.
Checks against the list of required attributes (taken from @rattr) to ensure that all of the required attributes are present and have been parsed.
Expert: Steven Mc Dougall - 9/30/2004 Question Hi i need to validate an external xml document against a dtd and return whether it is valid or not.