CFUN-04 is this weekend!

If you’re in the Washington, DC metro area and haven’t signed up for CFUN-04 you should do so now–it’s this weekend! Even if you’re not in the immediate area, this is a great conference for ColdFusion developers with content addressing all skill levels and a variety of topics with five different tracks.

Chafic and I are both speaking at the conference on Component Development in Flash MX 2004 and Integrating ColdFusion with Microsoft Office.

Speaking at MXEurope: CFMX E-Mail Agents

I just received notice that my proposal for MXEurope 2005 has been accepted. I’ll be speaking on creating e-mail agents in ColdFusion MX to assist with customer support. MXEurope is in London from January 31 through Februrary 2 next year.

Read more about my topic, CFMX E-Mail Agents.

Read more about MXEurope 2005.

This will also be my first time attending MXEurope so I’m really excited for the opportunity.

CFUN-04 Interview online

Both Chafic and I are speaking at CFUN-04 this year. One thing they’re doing new to provide more information about the conference is interviews with all the speakers. My interview is now available online.

Read my interview about integrating ColdFusion with Microsoft Office.

Last year was my first time at CFUN and I thought it was a great conference with lots of topics covering all skill levels in a variety of CF-related areas. If you’re in the DC-metro area or are just looking for a great CF-specific conference, I highly suggest it. This year it’s June 26 & 27 in Rockville, MD. Read more about the conference.

FYI: If you’re coming from out of town, the conference is at the DoubleTree which is fairly expensive. There’s a Ramada Inn across the street.

Can’t remember COM Program ID’s? PrimalScript to the rescue!

Sapien released a new build of our favorite IDE over the weekend, PrimalScript 3.1.437. This minor update adds PrimalSense (aka Tag-Insight or Intellisense) to createObject calls to list all installed COM ProgID’s. This is a pretty nifty feature if you work with COM in ColdFusion.

ComSense.jpg

PrimalScript users can download the latest software by using the Help: Check for Updates… command inside PrimalScript.

UDF to validate XML against XSD in CFMX

We’re working on an XML import routine and needed to first validate the incoming documents against an XML Schema. Since I wasn’t able to find a working example on the web I pieced together this UDF from the many posts on the subject.

xmlPath
A URI to the XML file to be validated. Required.
noNamespaceXsdUri
A URI to the XML Schema file to validate content that is not namespace qualified. Optional.
namespaceXsdUri
A list of whitespace delimited namespaces and XSD URI pairs to provide schemas for validating namespace qualified content. Optional.
parseError
An empty structure that is populated with details about the validation error, if any. This argument can be ommitted if all you want is the boolean result.

The URI parameters must be valid URLs and not OS file names. To facilitate this I’m also including a UDF, makeUriFromPath, that convers a fully-qualified OS file name to a true URI.

To use this UDF you must have the Xerces parser installed which can be downloaded here.

var parser = createObject("java","org.apache.xerces.parsers.SAXParser");

var err = structNew();
var k = "";
var success = true;

var eHandler = createObject(
"java",
"org.apache.xml.utils.DefaultErrorHandler");

var apFeat = "http://apache.org/xml/features/";
var apProp = "http://apache.org/xml/properties/";

eHandler.init();

if (structKeyExists(arguments, "parseError")) {
err = arguments.parseError;
}

try {
parser.setErrorHandler(eHandler);

parser.setFeature(
"http://xml.org/sax/features/validation",
true);

parser.setFeature(
apFeat & "validation/schema",
true);

parser.setFeature(
apFeat & "validation/schema-full-checking",
true);

if (structKeyExists(arguments, "noNamespaceXsdUri") and
arguments.noNamespaceXsdUri neq "") {

parser.setProperty(
apProp & "schema/external-noNamespaceSchemaLocation",
arguments.noNamespaceXsdUri

);
}

if (structKeyExists(arguments, "namespaceXsdUri") and
arguments.namespaceXsdUri neq "") {

parser.setProperty(
apProp & "schema/external-schemaLocation",
arguments.namespaceXsdUri
);
}

parser.parse(arguments.xmlPath);
} catch (Any ex) {
structAppend(err, ex, true);
success = false;
}

function makeUriFromPath(path) {
var uri = path;

// make all backslashes into slashes
uri = replace(uri, "", "/", "all");
if (left(uri,1) is "/") {
uri = right(uri, len(uri) - 1);
}

uri = "file:///" & uri;

return uri;
}

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

This UDF was put together primarily from information in Rob Rohan’s post on this cf-talk thread and from Massimo Foti’s UDF to validate an XML file against a DTD.

I’ll submit both of the above to cflib shortly.