Let me re-ask my question...

What's the best way to insert a child element under <page id="2">, when you
don't know where it's at in the XML doc?  All you know is that it has an
attribute "id" and the value is "2".

Another thought (along the same lines), if you wanted to show the ancestors
of a specific element, how would this be accomplished?  An example would be
displaying "breadcrumbs".  Again, all you would know is the page id.  Would
this require a recursive udf/tag?  And if so, how do you get the parent
element of a given element.  I can't find this anywhere in the docs (or
web).

Get the children of an element, easy... get the parent of an element, I have
no clue...

Thanks,

Brad

-----Original Message-----
From: Joe Eugene [mailto:[EMAIL PROTECTED]
Sent: Thursday, September 11, 2003 12:28 AM
To: CF-Talk
Subject: RE: XML Question


Do an xml search for the attribute with XPath..
xmlSearch(xmlDocObject, "Pages/[EMAIL PROTECTED]'2']");

Or Iterate through the node to find "id=2"

Joe Eugene


> -----Original Message-----
> From: Brad Roberts [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, September 10, 2003 8:15 PM
> To: CF-Talk
> Subject: XML Question
>
>
> Give the following XML, how can I get the full path to a given element?
>
> <pages>
>   <page id="1" name="Home Page">
>     <page id="2" name="Products">
>       <page id="5" name="ColdFusion"/>
>       <page id="6" name="Dreamweaver"/>
>       <page id="7" name="Flash"/>
>     </page>
>     <page id="3" name="Support">
>       <page id="4" name="FAQ"/>
>     </page>
>   </page>
> </pages>
>
> Let's say I want to add a child element under page "2", but I don't know
> where 2 falls in the xml object.  All I know is I want to insert a child
> under the page with ID "2".
>
> Any ideas?
>
> Thanks,
>
> Brad
>
>
>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/lists.cfm?link=t:4
Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. 
http://www.fusionauthority.com/signup.cfm

Reply via email to