XML nodes with same names

XML nodes with same names

Hello,

I'm sure I'm missing something basic, but I can't seem to find what I'm looking for. If I have an xml doc where the parent node and child nodes contain elements with the same name ("name" in this case), how would I go about just getting the client's name? Here is a slimmed down version of the structure:
  1. <client>
  2.     <name></name>
  3.     <url></url>
  4.     <contacts>
  5.         <contact>
  6.             <name></name>
  7.         </contact>
  8.         <contact>
  9.             <name></name>
  10.         </contact>
  11.     </contacts>
  12. </client>
There is a "client" object with a "name" element, and the client has a collection of "contact" objects, each with its own "name" element. Currently, when I do something like:
  1. $(xml).find('client').find('name').text()
I get a string that contains both the client's name (which is what I want) and each contact's name (which I don't want): "Some Client NameJoe SmithJane Doe".

Any thoughts? Thanks!