XPATH Query String - Finding Duplicate Nodes

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • pg_11@rediffmail.com

    #1

    XPATH Query String - Finding Duplicate Nodes

    The xml looks like this
    <users>
    <user><username >User1</username></user>
    <user><username >User2</username></user>
    <user><username >User3</username></user>
    <user><username >User4</username></user>
    <user><username >User1</username></user>
    <user><username >User2</username></user>
    <user><username >User5</username></user>
    </users>

    I am trying for a xpath query that would tell me whether there are any
    duplicate user\username node in the xml. I dont event want what are
    they. I just need whether there are any duplicates.
    Can any one help me please

  • pg_11@rediffmail.com

    #2
    Re: XPATH Query String - Finding Duplicate Nodes

    0 != count(/ns1:Users/ns1:User[ns1:UserName =
    preceding-sibling::ns1:Us er/ns1:UserName])

    This works. but this is case sensitive. If I have 'user1' and 'USER1',
    this wont catch it.
    Actually I need a case-insensitive search. I am using msxml parser. I

    Comment

    • pg_11@rediffmail.com

      #3
      Re: XPATH Query String - Finding Duplicate Nodes

      0 != count(/ns1:Users/ns1:User[ns1:UserName =
      preceding-sibling::ns1:Us er/ns1:UserName])

      This works. but this is case sensitive. If I have 'user1' and 'USER1',
      this wont catch it.
      Actually I need a case-insensitive search. I am using msxml parser. I

      Comment

      Working...