# Xpath question

**URL:** <https://forum.kirupa.com/t/xpath-question/240038>\
**Category:** Uncategorized\
**Created:** [September 28, 2007, 2:30pm UTC](https://forum.kirupa.com/t/xpath-question/240038 "2007-09-28T14:30:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![antizip](https://avatars.discourse-cdn.com/v4/letter/a/c5a1d2/32.png) [@antizip](https://forum.kirupa.com/u/antizip)\
**Post date:** [September 28, 2007, 2:30pm UTC](https://forum.kirupa.com/t/xpath-question/240038/1 "2007-09-28T14:30:43Z")

</div>

Howdy all,

In the following XML I’m trying to retrieve /ads/rotator/ad node that doesnt have ‘US’ in a “restricted” node.

```auto

<?xml version="1.0" encoding="utf-8" ?>
    <ads>
      <rotator appId="IframeRotatingAd">                  
        <ad weight="1" isControl="false" src="">
          <text>##AD0##</text>
          <restricted />
        </ad>
        <ad weight="1" isControl="false" src="">
          <text>##AD1##</text>
          <restricted>US</restricted>
          <restricted>MX</restricted>
        </ad>
      </rotator>
    </ads>

```

I’ve been trying to use the xpath:

```auto
/ads/rotator[@appId='IframeRotatingAd']/ad[restricted!='US']/text

```

But alas, as you can see here: [http://www.xmlme.com/XpathTool.aspx](http://www.xmlme.com/XpathTool.aspx) I keep getting it despite my efforts. If i get rid of the

```auto

<restricted>MX</restricted>

```

in the 2nd “ad” node it works, but I need to be able to restrict other countries.

If anyone knows a better way to go about this, please … let me in on it.
