<?xml version="1.0" encoding="GB2312" ?>  
-  <OTResponse> 
-  <ErrorInfo> 
   <Code>20000 </Code>  
   <Description>查询酒店房型成功 </Description>  
   </ErrorInfo> 
   <TransactionName>SingleHotelRoomTypeSearch </TransactionName>  
-  <Data> 
-  <HotelRoomTypeInfo> 
   <HotelId>1E74V </HotelId>  
   <HotelName>上海华港雅阁酒店 </HotelName>  
-  <RoomTypes> 
-  <RoomType> 
   <RoomCode>DB001 </RoomCode>  
   <RoomName>高级大床房 </RoomName>  
   <Exceptive>Y </Exceptive>  
   <AgentCommisionRate>0.09 </AgentCommisionRate>  
   <TeamRoom>N </TeamRoom>  
   <TeamRoomNum>0 </TeamRoomNum>  
   <Floor>3-9 </Floor>  
   <RoomArea>28 </RoomArea>  
   <NotAddBed>N </NotAddBed>  
   <BedType>大床 </BedType>  
   <Internet>宽带收费 </Internet>  
-  <RoomRates> 
-  <RoomRate> 
   <StartDay>20080501 </StartDay>  
   <EndDay>20080501 </EndDay>  
   <PaymentType>T </PaymentType>  
   <DisplayPrice>1600.0 </DisplayPrice>  
   <RateAmount>550.0 </RateAmount>  
   <BalPrice>550.0 </BalPrice>  
   <Meal>2 </Meal>  
-  <RoomQuotas> 
-  <RoomQuota> 
   <TheDate>20080501 </TheDate>  
   <CurrentNum>1 </CurrentNum>  
   </RoomQuota> 
   </RoomQuotas> 
   </RoomRate>  
-  <RoomQuota> 
   <TheDate>20080513 </TheDate>  
   <CurrentNum>1 </CurrentNum>  
   </RoomQuota> 
-  <RoomQuota> 
   <TheDate>20080514 </TheDate>  
   <CurrentNum>-3 </CurrentNum>  
   </RoomQuota> 
-  <RoomRate> 
   <StartDay>20080516 </StartDay>  
   <EndDay>20080518 </EndDay>  
   <PaymentType>T </PaymentType>  
   <DisplayPrice>1600.0 </DisplayPrice>  
   <RateAmount>500.0 </RateAmount>  
   <BalPrice>500.0 </BalPrice>  
   <Meal>2 </Meal>  
-  <RoomQuotas> 
-  <RoomQuota> 
   <TheDate>20080516 </TheDate>  
   <CurrentNum>1 </CurrentNum>  
   </RoomQuota> 
-  <RoomQuota> 
   <TheDate>20080517 </TheDate>  
   <CurrentNum>1 </CurrentNum>  
   </RoomQuota> 
-  <RoomQuota> 
   <TheDate>20080518 </TheDate>  
   <CurrentNum>1 </CurrentNum>  
   </RoomQuota> 
   </RoomQuotas> 
   </RoomRate> 
-  <RoomRate> 
   <StartDay>20080519 </StartDay>  
   <EndDay>20080522 </EndDay>  
   <PaymentType>T </PaymentType>  
   <DisplayPrice>1600.0 </DisplayPrice>  
   <RateAmount>550.0 </RateAmount>  
   <BalPrice>550.0 </BalPrice>  
   <Meal>2 </Meal>  
-  <RoomQuotas> 
-  <RoomQuota> 
   <TheDate>20080519 </TheDate>  
   <CurrentNum>1 </CurrentNum>  
   </RoomQuota> 
-  <RoomQuota> 
   <TheDate>20080520 </TheDate>  
   <CurrentNum>1 </CurrentNum>  
   </RoomQuota> 
-  <RoomQuota> 
   <TheDate>20080521 </TheDate>  
   <CurrentNum>-3 </CurrentNum>  
   </RoomQuota> 
-  <RoomQuota> 
   <TheDate>20080522 </TheDate>  
   <CurrentNum>1 </CurrentNum>  
   </RoomQuota> 
   </RoomQuotas> 
   </RoomRate> 
-  <RoomRate> 
   <StartDay>20080523 </StartDay>  
   <EndDay>20080525 </EndDay>  
   <PaymentType>T </PaymentType>  
   <DisplayPrice>1600.0 </DisplayPrice>  
   <RateAmount>500.0 </RateAmount>  
   <BalPrice>500.0 </BalPrice>  
   <Meal>2 </Meal>  
-  <RoomQuotas> 
-  <RoomQuota> 
   <TheDate>20080523 </TheDate>  
   <CurrentNum>1 </CurrentNum>  
   </RoomQuota> 
-  <RoomQuota> 
   <TheDate>20080524 </TheDate>  
   <CurrentNum>1 </CurrentNum>  
   </RoomQuota> 
-  <RoomQuota> 
   <TheDate>20080525 </TheDate>  
   <CurrentNum>1 </CurrentNum>  
   </RoomQuota> 
   </RoomQuotas> 
   </RoomRate> 
-  <RoomRate> 
   <StartDay>20080526 </StartDay>  
   <EndDay>20080529 </EndDay>  
   <PaymentType>T </PaymentType>  
   <DisplayPrice>1600.0 </DisplayPrice>  
   <RateAmount>550.0 </RateAmount>  
   <BalPrice>550.0 </BalPrice>  
   <Meal>2 </Meal>  
-  <RoomQuotas> 
-  <RoomQuota> 
   <TheDate>20080526 </TheDate>  
   <CurrentNum>1 </CurrentNum>  
   </RoomQuota> 
-  <RoomQuota> 
   <TheDate>20080527 </TheDate>  
   <CurrentNum>1 </CurrentNum>  
   </RoomQuota> 
-  <RoomQuota> 
   <TheDate>20080528 </TheDate>  
   <CurrentNum>1 </CurrentNum>  
   </RoomQuota> 
-  <RoomQuota> 
   <TheDate>20080529 </TheDate>  
   <CurrentNum>1 </CurrentNum>  
   </RoomQuota> 
   </RoomQuotas> 
   </RoomRate> 
-  <RoomRate> 
   <StartDay>20080530 </StartDay>  
   <EndDay>20080601 </EndDay>  
   <PaymentType>T </PaymentType>  
   <DisplayPrice>1600.0 </DisplayPrice>  
   <RateAmount>500.0 </RateAmount>  
   <BalPrice>500.0 </BalPrice>  
   <Meal>2 </Meal>  
-  <RoomQuotas> 
-  <RoomQuota> 
   <TheDate>20080530 </TheDate>  
   <CurrentNum>1 </CurrentNum>  
   </RoomQuota> 
-  <RoomQuota> 
   <TheDate>20080531 </TheDate>  
   <CurrentNum>1 </CurrentNum>  
   </RoomQuota> 
-  <RoomQuota> 
   <TheDate>20080601 </TheDate>  
   <CurrentNum>1 </CurrentNum>  
   </RoomQuota> 
   </RoomQuotas> 
   </RoomRate> 
-  <RoomRate> 
   <StartDay>20080602 </StartDay>  
   <EndDay>20080605 </EndDay>  
   <PaymentType>T </PaymentType>  
   <DisplayPrice>1600.0 </DisplayPrice>  
   <RateAmount>550.0 </RateAmount>  
   <BalPrice>550.0 </BalPrice>  
   <Meal>2 </Meal>  
-  <RoomQuotas> 
-  <RoomQuota> 
   <TheDate>20080602 </TheDate>  
   <CurrentNum>1 </CurrentNum>  
   </RoomQuota> 
   </RoomQuotas> 
   </RoomRate> 
   </RoomRates> 
-  <RoomTypeDesc> 
-  <![CDATA[ 所在楼层:3-9;房型面积:28;床型:大床;床面积:1.5*2m;宽带收费; 
  ]]>  
   </RoomTypeDesc> 
   </RoomType> 
   </RoomTypes> 
-  <Additions> 
-  <Addition> 
   <Catogory>加床费用 </Catogory>  
   <RoomTypeCode>ALL </RoomTypeCode>  
   <SalePrice>100.0 </SalePrice>  
   </Addition> 
-  <Addition> 
   <Catogory>早餐费用 </Catogory>  
   <RoomTypeCode>ALL </RoomTypeCode>  
   <SalePrice>101.0 </SalePrice>  
   </Addition> 
   </Additions> 
   </HotelRoomTypeInfo> 
   </Data> 
   </OTResponse> 
怎么遍历- <RoomRates> 
-  <RoomRate>节点下的值.当时期等于EndDay>20080501 </EndDay>跳到下个节点.  

解决方案 »

  1.   

    示例如下:XML: 
    <?xml version="1.0" encoding="gb2312"?> 
    <MusicMenu> 
     <SingerType type="男歌手"> 
       <Singer name="林俊杰"> 
         <Music>江南</Music> 
         <Music>冻结</Music> 
       </Singer> 
       <Singer name="张敬轩"> 
         <Music>断点</Music> 
       </Singer> 
       <Singer name="唐磊"> 
         <Music>丁香花</Music> 
       </Singer> 
     </SingerType> 
     <SingerType type="女歌手"> 
       <Singer name="孙燕姿"> 
         <Music>坏天气</Music> 
         <Music>遇见</Music> 
         <Music>爱情证书</Music> 
       </Singer> 
       <Singer name="范玮琪"> 
         <Music>启程</Music> 
         <Music>因为</Music> 
       </Singer> 
     </SingerType> 
    </MusicMenu> 
    C#: 
    private void BTN_ShowTree_Click(object sender, System.EventArgs e) 

     XmlNodeList nodeListMenu = xmlDoc.SelectSingleNode( "MusicMenu" ).ChildNodes;  int indexType = 0; 
     foreach ( XmlNode nodeType in nodeListMenu ) 
     { 
       XmlElement elementType = (XmlElement)nodeType; 
       this.TVW_Menu.Nodes.Add( elementType.GetAttribute("type") );    int indexSinger = 0; 
       XmlNodeList nodeListSinger = nodeType.ChildNodes; 
       foreach ( XmlNode nodeSinger in nodeListSinger ) 
       { 
         XmlElement elementSinger = (XmlElement)nodeSinger; 
         this.TVW_Menu.Nodes[indexType].Nodes.Add( elementSinger.GetAttribute( "name" ) );      XmlNodeList nodeListMusic = nodeSinger.ChildNodes; 
         foreach ( XmlNode nodeMusic in nodeListMusic ) 
         { 
           XmlElement elementMusic = (XmlElement)nodeMusic; 
           if ( elementMusic.Name == "Music" ) 
             this.TVW_Menu.Nodes[indexType].Nodes[indexSinger].Nodes.Add( elementMusic.InnerText ); 
         } 
         indexSinger++; 
       } 
       indexType++; 
     } 
    }