isXML

Determines whether a string is well-formed XML text.

isXML(value) → returns boolean

isXML Argument Reference

value string
Required

A string containing the XML document text.

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


Fork me on GitHub