Good to know.  I need my wildcard to be WITHIN the text though.  
For instance, give me all nodes whose xmltext includes the text
"spid=100".

Can you do:
<cfset arrNodes = XmlSearch( xmlData, "//*[ text() = '*spid=100*' ]" )
/>

~Brad

-----Original Message-----
From: Ben Nadel [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, July 24, 2007 3:34 PM
To: CF-Talk
Subject: RE: xpaths and regex

Yeah, this does work:

<cfxml variable="xmlData">
        
        <root>
                <a1>Meep</a1>
                <a2>Meep</a2>
                <a3>
                        <b1>Dink</b1>
                        <b2>Meep</b2>
                </a3>
                <a4>Blam</a4>
        </root>

</cfxml>


<cfset arrNodes = XmlSearch( xmlData, "//*[ text() = 'Meep' ]" ) />

<cfdump var="#arrNodes#" /> 

Gets any node with value = "Meep".


.......................
Ben Nadel
Certified Advanced ColdFusion MX7 Developer
www.bennadel.com
 
Need ColdFusion Help?
www.bennadel.com/ask-ben/

-----Original Message-----
From: Ben Nadel [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, July 24, 2007 4:28 PM
To: CF-Talk
Subject: RE: xpaths and regex

Brad,

You can use * for the node name, but not sure about any regular
expressions. If you are interested, I just wrote an introductory
tutorial on Xpath in XmlSearch() and I don't remember seeing anything
about RegEx as I was learning:

http://www.bennadel.com/index.cfm?dax=blog:827.view

If you are looking for a value-based node, you might be able to rock
something like:

//*[ text() = 'TARGET_TEXT' ]

Not sure if you can use Text() predicate in conjunction with a * wild
card - haven't tried it.



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Download the latest ColdFusion 8 utilities including Report Builder,
plug-ins for Eclipse and Dreamweaver updates.
http;//www.adobe.com/cfusion/entitlement/index.cfm?e=labs%5adobecf8%5Fbeta

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:284462
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to