ColdFusion provides the following methods for validating a document against a DTD or an XML Schema:
The XmlParse function can validate XML text that it is parsing against a DTD or Schema. It the function encounters a validation error, ColdFusion generates an error and stops parsing the text. If the validator generates warnings, but no errors, ColdFusion parses the document and returns the result.
The XmlValidate function can validate an XML text document or XML document object. against a DTD or Schema. The function returns a data structure with detailed information from the validator, including arrays of warning, error, and fatal error messages, and a Boolean status variable indicating whether the document is valid. Your application can examine the status information and determine how to handle it further.
For examples of XML validation, see XmlParse and XmlValidate in the CFML Reference. The XmlParse example validates a document using a DTD. The XmlValidate example validates the document using an XML Schema that represents the same document structure as the DTD.
Share this page
Was this page helpful?
We're glad. Tell us how this page helped.
We're sorry. Can you tell us what didn't work for you?
Thank you for your feedback. Your response will help improve this page.