I'm taking a guess (based on the books I have) that you only get the
elements. I didn't dig deep into xPath docs, however. I used the CFMX
WACK (advanced volume) as a reference. I only see that you can search
for elements or for attributes WITH certain attribute values. I don't
see an operator to just pull only attributes without specifying a value.
Just remember, I'm sort of xPath-ignorant.
Here is an example of what I did to get those values...
<cfxml variable="myXML">
<parent>
<child name="jo">
<weight value="100lbs"/>
</child>
<child name="mike">
<weight value="180lbs"/>
</child>
</parent>
</cfxml>
<cfset xPath = "//parent/child/[EMAIL PROTECTED]'100lbs']">
<cfset xSearch = XMLSearch(myXML, xPath)>
<p><cfdump var="#xSearch#" label="xSearch for specific attribute
value"></p>
<cfset xPath = "//parent/child/weight">
<cfset xSearch = XMLSearch(myXML, xPath)>
<p><cfdump var="#xSearch#" label="xSearch for all weight elements"></p>
<p>Loop over returned elements<br>
<cfloop from="1" to="#ArrayLen(xSearch)#" index="ii">
<cfoutput>#xSearch[ii].xmlAttributes.value#</cfoutput><br>
</cfloop>
</p>
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Justin Balog
Sent: Tuesday, February 03, 2004 2:54 PM
To: '[EMAIL PROTECTED]'
Subject: [CFCDev] OT: XPath() and getting attributes
Would an XPathQueryString look like to find the attributes of an XML
tag?
Basically, is it possible to return the value attribute of the weight
tag, or does xmlSearch() only return the text elements?
<parent>
<child name="jo">
<weight value="100lbs"/>
</child>
</parent>
Thanks,
Justin
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to
[EMAIL PROTECTED] with the words 'unsubscribe cfcdev'
in the message of the email.
CFCDev is run by CFCZone (www.cfczone.org) and supported by Mindtool,
Corporation (www.mindtool.com).
An archive of the CFCDev list is available at
www.mail-archive.com/[EMAIL PROTECTED]
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev'
in the message of the email.
CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).
An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED]