Okay, but then that looks like there's no way to see if deliveryMethod
exists. Is that the case? The string element has multiple children,
deliveryMethod is just one I showed in my example.

If that function is checking for the existence of child tags, then wouldn't
hasXMLElem() be a more accurate name? Also, the docs seem to to say it's
looking to see if what was specified is an actual element.

Thanks.

 Jay


-----Original Message-----
From: JCQ [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 27, 2002 4:35 PM
To: CF-Talk
Subject: RE: Need help with isXMLElem() function


Pretty sure it's because isXMLelem() refers to direct child tags nested
below the spot you're pointed at. (Just like XMLattributes points to the
array of attributes).

Try pointing it at <string> and see what happens!
That tag *does* have at least one elements so you should get a TRUE

Another way to test it, is to do some Xpath on it:

<cfset myXMLnode = XMLsearch(myXMLdoc, "//string")>

You should be able to cfdump myXMLnode and see all the attributes and
children of the <string> element (plus a lot more you don't care to see)


Hope that helps,

John Quarto-vonTivadar
Techspedition, Inc.
www.techspedition.com
"Master CFCs with our newest book, 'Discovering CFCs', available now"


-----Original Message-----
From: Jay jennings [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 27, 2002 7:11 PM
To: CF-Talk
Subject: Need help with isXMLElem() function


Given this XML in a file...

<?xml version="1.0" encoding="utf-8"?>
<string>
   <deliveryMethod type="fax" />
</string>

And this CF code in a cfm file...

<cffile action="READ" file=#ExpandPath("./test.xml")# variable="rawXML">
<cfscript> myXMLDoc = XMLParse(rawXML);

if (isXMLElem("myXMLDoc.string.deliveryMethod"))
   WriteOutput("element found");
else
   WriteOutput("element was not found");
</cfscript>

Why does isXMLElem() never come back as true? I've tried every
permutation that I can think of as the parameter for that function --
with slashes instead of periods, with and without quote marks, etc.

Could someone please tell me how this function is supposed to work?
Thanks!

jay



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Reply via email to