XML : How to select first element anywhere in the document

I have the following xml:

  <?xml version="1.0" encoding="utf-8"?>  <BooksInfo>      <Publisher>          <PublisherName>Publisher One</PublisherName>      </Publisher>        <Publisher>          <PublisherName>Publisher Two</PublisherName>      </Publisher>  </BooksInfo>    

If I use this: //PublisherName[1] then I get both the PublisherName elements in the result. I want only the first one.

No comments:

Post a Comment