Personally, I'd just use a Xpath statement to see if any
<deliveryMethod> tags exist at all, something like:

xnPath = xmlSearch(myXML, "//string/deliverymethod")>

Would give a pointer within myXML to any <string> elements that have a
<deliverymerthod> element beneath them.  There's not a lot one cannot do
with Xpath

Of course there are other ways to go about all this. Xpath was just the
first one that popped into my head before the turkey hits my stomach

Good luck!


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


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
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm

Reply via email to