View comments | RSS feed
Contents > CFML Reference > ColdFusion Functions > IsXmlElem PreviousNext

IsXmlElem

Determines whether a function parameter is an Extended Markup language (XML) document object element.

True, if the function argument is an XML document object element; False, otherwise.

Decision functions, XML functions

IsXmlElem(value)

IsXmlDoc, IsXmlRoot, XmlChildPos, XmlNew, XmlParse, XmlSearch, XmlTransform

ColdFusion MX: Added this function.

Parameter

Description

value

name of an XML document object element


Contents > CFML Reference > ColdFusion Functions > IsXmlElem PreviousNext

ColdFusion 9 | ColdFusion 8 | ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | Bug Reporting

Version 6.1

Comments are no longer accepted for ColdFusion MX 6.1. ColdFusion 8 is the current version.

Comments


grotycom said on Jul 31, 2004 at 9:47 PM :
How do I use this? This example throws an error. I'm trying to test for the existence of a node.

<cfscript>
myXMLDoc = XmlNew();
myXMLDoc.xmlRoot = XmlElemNew(myXMLDoc,"people");
myXMLDoc.people.XmlText = "bla bla bla";
myXMLDoc.people.XmlChildren[1] = XmlElemNew(myXMLDoc,"name");
myXMLDoc.people.XmlChildren[1].XmlAttributes.id = 1;
myXMLDoc.people.XmlChildren[1].XmlAttributes.sexo = "M";
myXMLDoc.people.XmlChildren[1].XmlText = "Marcello";
myXMLDoc.people.XmlChildren[2] = XmlElemNew(myXMLDoc,"name");
myXMLDoc.people.XmlChildren[2].XmlAttributes.id = 2;
myXMLDoc.people.XmlChildren[2].XmlAttributes.sexo = "F";
myXMLDoc.people.XmlChildren[2].XmlText = "Maria";
</cfscript>

<cfoutput>
IsXmlRoot(myXMLDoc.people): #IsXmlRoot(myXMLDoc.people)#<br>
IsXmlElem(myXMLDoc.people): #IsXmlElem(myXMLDoc.people)#<br>
IsXmlElem(myXMLDoc.people.name): #IsXmlElem(myXMLDoc.people.name)#<br>
IsXmlElem(myXMLDoc.people.blah): #IsXmlElem(myXMLDoc.people.blah)# - Shouldn't this return no? Instead of an error?<br>
</cfoutput>

What about testing for the existence of an XMLAttribute?
jasonmoon said on Sep 7, 2004 at 2:43 PM :
To test for the existance of an XML attribute, you can use the StructKeyExists function, since an XML node is a structure. Pass in the attribute name for the "key" parameter.

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/coldfusion/6.1/htmldocs/funct145.htm