Search XML Tree help

View: New views
3 Messages — Rating Filter:   Alert me  

Search XML Tree help

by Christopher Chin-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

First off, I'm an XML newbie, but not a CF newbie :)

I'm trying to figure out how to search an xml document that is being handed to me by another process within the company.  Basically it's a small database.

Here's a sample:
<employee id="jsmith">
<fname>John</fname>
<lname>Smith</lname>
</employee>
<employee id="jjones">
<fname>Jack</fname>
<lname>Jones</lname>
</employee>

How do I search the tree and get all of the childnodes for id="jjones"?  ID is an attribute of employee and I'm having trouble figuring this out with CF.

Any help is much appreciate.
thanks!
Chris

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four times a year.
http://www.fusionauthority.com/quarterly

Archive: http://www.houseoffusion.com/groups/XML/message.cfm/messageid:207
Subscription: http://www.houseoffusion.com/groups/XML/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.3

Re: Search XML Tree help

by musetracks :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Something like

XMLSearch ( myXML, '/employee[@id='jjones']/*' )

Should do the trick.  I didn't test this and I'm not certain of the  
"*", but that should get you in the neighborhood.

Rob Wilkerson



On Oct 18, 2006, at 6:23 PM, Christopher Chin wrote:

> First off, I'm an XML newbie, but not a CF newbie :)
>
> I'm trying to figure out how to search an xml document that is  
> being handed to me by another process within the company.  
> Basically it's a small database.
>
> Here's a sample:
> <employee id="jsmith">
> <fname>John</fname>
> <lname>Smith</lname>
> </employee>
> <employee id="jjones">
> <fname>Jack</fname>
> <lname>Jones</lname>
> </employee>
>
> How do I search the tree and get all of the childnodes for  
> id="jjones"?  ID is an attribute of employee and I'm having trouble  
> figuring this out with CF.
>
> Any help is much appreciate.
> thanks!
> Chris
>
>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four times a year.
http://www.fusionauthority.com/quarterly

Archive: http://www.houseoffusion.com/groups/XML/message.cfm/messageid:208
Subscription: http://www.houseoffusion.com/groups/XML/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.3

Re: Search XML Tree help

by Christopher Chin-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks Rob!  I'll give this a try and let you know how I fare.

--Chris

>Something like
>
>XMLSearch ( myXML, '/employee[@id='jjones']/*' )
>
>Should do the trick.  I didn't test this and I'm not certain of the  
>"*", but that should get you in the neighborhood.
>
>Rob Wilkerson
>
>
>
>On Oct 18, 2006, at 6:23 PM, Christopher Chin wrote:
>
>>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four times a year.
http://www.fusionauthority.com/quarterly

Archive: http://www.houseoffusion.com/groups/XML/message.cfm/messageid:209
Subscription: http://www.houseoffusion.com/groups/XML/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.3