House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Mailing Lists
Home /  Groups /  ColdFusion Talk (CF-Talk)

XPath Help

  << Previous Post |  RSS |  Sort Oldest First |  Sort Latest First |  Subscribe to this Group Next >> 
Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Tony Pimm
05/21/2004 07:04 AM

Hi, I'm trying to get some XPath to work with respect to a navigation tree. <?xml version="1.0" encoding="utf-8" ?> <tree>   <node objectid="3456" title="Informationa">     <node objectid="2134" title="Contact" />     <node objectid="5656" title="Top 1.2" />     <node objectid="5672" title="Top 1.3" />     <node objectid="123" title="Top 1.4" />     <node objectid="8357" title="Top 1.5" />   </node>   <node objectid="9834" title="Banks" circuit="banks" />   <node objectid="2245" title="Corporates" circuit="corporates">     <node objectid="45688" title="Top 3.1" />     <node objectid="9567" title="Top 3.2" />     <node objectid="4633" title="Top 3.3" />   </node>   <node objectid="1554" title="Managers" />   <node objectid="6734" title="Library" /> </tree> I can use Xpath to return all the child nodes within a node using //node[@objectid="3"] However, how can I do this in reverse?  How can I retrieve the node that is the parent of a particular node?  How can I get the objectid of the parent of 2134? Any help you could share would be great! Thanks Tony

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Ian Sheridan
05/21/2004 07:58 AM

I found this site to be an excellent eye opener for xPath. http://www.zvon.org/xxl/XPathTutorial/General/examples.html Ian - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Ian Sheridan isheridan@savagevines.com http://www.savagevines.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Ian Sheridan
05/21/2004 08:02 AM

I shot that off to fast here is a more focused link. the site is a little confusing. http://www.zvon.org/xxl/XPathTutorial/Output/example1.html On May 21, 2004, at 7:56 AM, Ian Sheridan wrote: > I found this site to be an excellent eye opener for xPath. > > http://www.zvon.org/xxl/XPathTutorial/General/examples.html Ian - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Ian Sheridan isheridan@savagevines.com http://www.savagevines.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Alexander Sherwood
05/21/2004 08:30 AM

At 07:04 AM 5/21/2004, you wrote: ----- Excess quoted text cut - see Original Post for more ----- Couple of things here, Tony. 1) You can "chain" xpaths together. 2) Learn all of the Xpaths Axes (sp?)! In this case, you could grab the objectID of the node element with an objectID of 2134 like this: //node[@objectid=2134]/parent::node Notice the reference to the exact node, and then a reference to the "parent" axis, asking for a "node" element. Hope this helps. ---------------------------------- Alex Sherwood PHS Collection Agency THE COLLECTORS P:   813-283-4579 F:   301.664.6834 W: www.phs-net.com


<< Previous Thread Today's Threads Next Thread >>

Search cf-talk

September 22, 2014

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
   1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30         

Designer, Developer and mobile workflow conference