Certain doXPath not working in IE9

I have the following xml in a variable called newAvail:

<?xml version="1.0" encoding="UTF-8"?>
<Response ResponseReference="REF_D_010_1152-1322142921212">
  <ResponseDetails Language="en">
    <SearchHotelPriceResponse>
      <HotelDetails>
        <Hotel HasExtraInfo="true" HasMap="true" HasPictures="true">
          <City Code="ROM"><![CDATA[Rome]]></City>
          <Item Supp="1"  Category="First Class Modern Hotel" Img="http://images.gta-travel.com/HH/Images/I/ROMth/ROM-ART4-1.jpg" Code="ART4"><![CDATA[Artis]]></Item>
          <LocationDetails>
            <Location Code="G8"><![CDATA[Suburbs]]></Location>
          </LocationDetails>
          <StarRating>4</StarRating>
          <HotelRooms>
            <HotelRoom Code="TB" NumberOfRooms="1"/>
          </HotelRooms>
          <RoomCategories>
            <RoomCategory Id="001:ART5">
              <Description><![CDATA[Standard]]></Description>
              <ItemPrice Currency="EUR">141.00</ItemPrice>
              <Confirmation Code="IM"><![CDATA[AVAILABLE]]></Confirmation>
              <Meals>
                <Basis Code="B"><![CDATA[Breakfast]]></Basis>
                <Breakfast Code="B"><![CDATA[Buffet]]></Breakfast>
              </Meals>
              <HotelRoomPrices>
                <HotelRoom Code="TB">
                  <RoomPrice Gross="141.00"/>
                  <PriceRanges>
                    <PriceRange>
                      <DateRange>
                        <FromDate>2011-11-27</FromDate>
                        <ToDate>2011-11-29</ToDate>
                      </DateRange>
                      <Price Gross="47.00" Nights="3"/>
                    </PriceRange>
                  </PriceRanges>
                </HotelRoom>
              </HotelRoomPrices>
            </RoomCategory>
            <RoomCategory Id="001:ART4">
              <Description><![CDATA[Standard]]></Description>
              <ItemPrice Currency="EUR">156.00</ItemPrice>
              <Confirmation Code="IM"><![CDATA[AVAILABLE]]></Confirmation>
              <Meals>
                <Basis Code="B"><![CDATA[Breakfast]]></Basis>
                <Breakfast Code="B"><![CDATA[Buffet]]></Breakfast>
              </Meals>
              <HotelRoomPrices>
                <HotelRoom Code="TB">
                  <RoomPrice Gross="156.00"/>
                  <PriceRanges>
                    <PriceRange>
                      <DateRange>
                        <FromDate>2011-11-27</FromDate>
                        <ToDate>2011-11-29</ToDate>
                      </DateRange>
                      <Price Gross="52.00" Nights="3"/>
                    </PriceRange>
                  </PriceRanges>
                </HotelRoom>
              </HotelRoomPrices>
            </RoomCategory>
          </RoomCategories>
        </Hotel>
      </HotelDetails>
    </SearchHotelPriceResponse>
  </ResponseDetails>
</Response>

The following statement works fine in FF but dies silently in IE9. Used to work in IE7.

tmproomsuppnightprice = newAvail.doXPath("//RoomCategory[@Id='001:ART5']/HotelRoomPrices/HotelRoom[@Code='TB']/PriceRanges/PriceRange[1]/Price")[0].getAttribute('Gross');

Please can you help urgently as this is on a production system.

Thanks

Purvez

Sorry I forgot to say that I’m on Prof Vers 2.6

The issue does not relate dhtmlxAjax. BTW, the following works correctly:

tmproomsuppnightprice = newAvail.doXPath("//RoomCategory[@Id=‘001:ART5’]/HotelRoomPrices/HotelRoom[@Code=‘TB’]/PriceRanges/PriceRange/Price")[0].getAttribute(‘Gross’);

…/PriceRange/… instead of …/PriceRange[1]/…

Alexandra, thanks very much for your response. I am a bit confused about what you say because there is MORE than ONE PriceRange within PriceRanges and therefore I HAVE to use a subscript to define which one I want.

Also the doXPath statement that I currently have works properly with FireFox.

Perhaps I have misunderstood your message.

Please help.

Thanks

Purvez

Alexandra I should have said that I did try what you had suggested and it does take the first PriceRange if we don’t put in a PriceRange suffix. However I need to iterate over all of them and therefore I need to be able to put in a suffix.

Thanks

Purvez

Please I need URGENT help with this.

Thanks

Purvez

I am sorry to hassle you like this but this is now VERY URGENT and needs to be resolved.

Thanks

Purvez

This problem doesn’t relate dhtmlxAjax. It is more about XPath (please see XPath docs). In case of IE you will probably need to use 0 instead of 1 to select the 1st element

var firstIndex = (_isIE?0:1);
tmproomsuppnightprice = newAvail.doXPath("//RoomCategory[@Id=‘001:ART5’]/HotelRoomPrices/HotelRoom[@Code=‘TB’]/PriceRanges/PriceRange["+firstIndex+"]/Price")[0].getAttribute(‘Gross’);

Hi Alexandra

Thanks VERY VERY MUCH for your response and I can confirm that this now works. I do appreciate your HELP with this matter and wish You and everyone else at DHTMLX a Happy and Successful New Year.

Kind regards

Purvez Desai

Hi Purvez,

Thanks! We wish you a happy New Year too )