<rooms>
<room>
<roomname>Single</roomname>
<roomid>1</roomid>
<Price>100</Price>
<Adult>1</Adult>
<child>0</child>
</room>
</rooms>
<rooms>
<room>
<roomname>Double</roomname>
<roomid>2</roomid>
<Price>200</Price>
<Adult>2</Adult>
<child>1</child>
</room>
</rooms>
<rooms>
<room>
<roomname>Single</roomname>
<roomid>3</roomid>
<Price>150</Price>
<Adult>1</Adult>
<child>0</child>
</room>
</rooms>
</hotel>
我需要像这样......(在经典的asp中使用vbscript)
酒店:
单100,
双200,
总计300
单150, 双200, 总计350
概念是: 1.客户需要2个房间,第1个房间1个成人房间和2个房间2个成人+ 1个孩子(基于xml以上) 2.客户最多可以选择4个房间,每个房间最大成人4个,最大孩子2个,因为每个客户请求xml都是这样生成的
例如:客户需要3个房间,第1个房间1个成人,第2个房间2个成人+ 1个孩子和3个房间3个人,xml是这样的(房间是根据可用性生成的)...
<rooms>
<room>
<roomname>Single</roomname>
<roomid>1</roomid>
<Price>100</Price>
<Adult>1</Adult>
<child>0</child>
</room>
</rooms>
<rooms>
<room>
<roomname>Double</roomname>
<roomid>2</roomid>
<Price>200</Price>
<Adult>2</Adult>
<child>1</child>
</room>
</rooms>
<rooms>
<room>
<roomname>Single</roomname>
<roomid>3</roomid>
<Price>150</Price>
<Adult>1</Adult>
<child>0</child>
</room>
</rooms>
<rooms>
<room>
<roomname>Triple</roomname>
<roomid>4</roomid>
<Price>300</Price>
<Adult>3</Adult>
<child>0</child>
</room>
</rooms>
</hotel>
在这个原因出来我需要这样
酒店:
单100,
双200,
三300,
总计600
单150, 双200, 三300, 总计650
我尝试使用vbscript取出,但有些原因被接受但有些原因不是
<%@ Language="VBScript" CodePage="65001"%>
<%
Response.ContentType = "text/plain; charset=UTF-8"
Dim doc
Set doc = Server.CreateObject("Msxml2.DOMDocument.3.0")
doc.async = False
If doc.load(Server.MapPath("ee.xml")) Then
doc.setProperty "SelectionLanguage", "XPath"
for i= 1 to 3 '2 is noofrooms
adult1 ="1"
child1 ="0"
adult2 ="2"
child2 ="1"
adult3 ="3"
child3 ="0"
'adult4 ="4"
'child4 ="0"
for d=0 to 4 ' total nodes ( /rooms)
' this for 2 room cause
'ds ="(//HotelDetails/hotel/rooms/room[Adult='"&adult1&"' and child='"&child1&"'])["&i&"]|(//HotelDetails/hotel/rooms/room[Adult='"&adult2&"' and child='"&child2&"'])["&d&"]"
' this for 3 room cause
ds ="(//HotelDetails/hotel/rooms/room[(Adult='"&adult1&"' and child='"&child1&"') ])["&i&"]|((//HotelDetails/hotel/rooms/room[(Adult='"&adult2&"' and child='"&child2&"')])|(//HotelDetails/hotel/rooms/room[(Adult='"&adult3&"' and child='"&child3&"')]))["&d&"]"
' this for 4 room cause
'ds ="(//HotelDetails/hotel/rooms/room[(Adult='"&adult1&"' and child='"&child1&"') ])["&i&"]|((//HotelDetails/hotel/rooms/room[(Adult='"&adult2&"' and child='"&child2&"')])|(//HotelDetails/hotel/rooms/room[(Adult='"&adult3&"' and child='"&child3&"')])|(//HotelDetails/hotel/rooms/room[(Adult='"&adult3&"' and child='"&child3&"')]))["&d&"]"
Set colNodes=doc.selectNodes (ds)
For Each objNode in colNodes
response.write objNode.Text & VbCrLf
Next
next
next
Else
Response.Write doc.parseError.reason
End If
Plz帮我(拿输出)解决这个问题 感谢