XSD validation in CFMX 6.1


By David Fekke
January 17th, 2011

CFMX 7 has builtin xsd validation using the xmlParse function. What about CFMX 6.1. There is a very neat udf on cflib.org site called xsdValidate.

Here is an example using this udf in cfmx 6.1.

<cfset xmlUri = "file:///c:/test/bad.xml">
<cfset xsdUri = "file:///c:/test/test.xsd">


Valid: #xsdValidate(xmlUri, xsdUri, "", err)#

<cfdump var="#err#" label="Information about the error, if any">

This udf requires the Xerces XML parser. It works by calling the underlying Java classes to validate the xml against the xsd file.

Kudos to Sameul Neff who wrote this udf.

← Previous Page  Next Page →