isXML

Determines whether a string is well-formed XML text.

isXML(value) → returns boolean

Argument Reference

value string
Required

A string containing the XML document text.

parserOptions struct

XML parsing options. No documentation available on usage.

Examples
Sample code invoking the isXML function

Returns true if the string is well-formed XML.

example = '<coldfusionengines>
 <engine>
  <name>Adobe ColdFusion</name>
 </engine>
 <engine>
  <name>Lucee</name>
 </engine>
 <engine>
  <name>Railo</name>
 </engine>
 <engine>
  <name>Open BlueDragon</name>
 </engine>
</coldfusionengines>';
writeOutput( isXml( example ) );

Expected Result: true

Returns false if the string is not well-formed XML.

example1 = '<coldfusionengines>
 <engine>
  <name>Adobe ColdFusion</name>
 </engine>
 <engine>
  <name>Lucee</name>';
writeOutput( isXml( example1 ) );

Expected Result: false

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub