Forum Discussion

MakeMyTrip_Indi's avatar
MakeMyTrip_Indi
New Contributor
13 years ago

Dynamic tags in request XML.

I want to have some tags in the XML whose repetition count will be input driven. For ex. in below XML, the no. of tags <Age></Age> will be input driven.

<RoomStayCandidates>
<RoomStayCandidate>
<GuestCounts>
<GuestCount count="2" ageQualifyingCode="10"/>
<GuestCount count="2" ageQualifyingCode="8">
<Ages>
<Age>5</Age>
<Age>5</Age>
</Ages>
</GuestCount>
</GuestCounts>
</RoomStayCandidate>

</RoomStayCandidates>

Also, the no. of <RoomStayCandidate> </RoomStayCandidate> tags will be input driven. Please suugest how to hadble this scenario.
  • Hi,

    I guess this depends on from where will you be reading the data - but it will require some scripting from your side - if you can elaborate a little more I can suggest a way forward to try out..

    regards!

    /Ole
    SmartBear Software
  • The input data is in csv format which can have colums as "No. Of rooms","Adult count","Age". refer attachment.


    Here "No. Of rooms" specify the no. of <RoomStayCandidate> </RoomStayCandidate> tags.
    "Adult count" delimited value specifies the no. of <Age></Age> tags in each room.
    "Age" specify the value of "Age" tag in each each room.(Delimiter comma gives value of each room. Again the delimiter @ gives the value of ages in each room)


    So, for first room,
    <RoomStayCandidates>
    <RoomStayCandidate>
    <GuestCounts>
    <GuestCount count="2" ageQualifyingCode="10"/>
    <GuestCount count="2" ageQualifyingCode="8">
    <Ages>
    <Age>21</Age>
    <Age>22</Age>
    </Ages>
    </GuestCount>
    </GuestCounts>
    </RoomStayCandidate>

    </RoomStayCandidates>

    So, for second room,

    <RoomStayCandidates>
    <RoomStayCandidate>
    <GuestCounts>
    <GuestCount count="2" ageQualifyingCode="10"/>
    <GuestCount count="1" ageQualifyingCode="8">
    <Ages>
    <Age>25</Age>
    </Ages>
    </GuestCount>
    </GuestCounts>
    </RoomStayCandidate>

    </RoomStayCandidates>

    So, for third room,

    <RoomStayCandidates>
    <RoomStayCandidate>
    <GuestCounts>
    <GuestCount count="2" ageQualifyingCode="10"/>
    <GuestCount count="3" ageQualifyingCode="8">
    <Ages>
    <Age>43</Age>
    <Age>23</Age>
    <Age>31</Age>
    </Ages>
    </GuestCount>
    </GuestCounts>
    </RoomStayCandidate>

    </RoomStayCandidates>
  • Hi,

    I'm sorry for the delayed response; you will need to resort to some kind of scripting for this, probably a groovy script step that builds and inserts the desired block of XML from the datasource for you.

    regards,

    /Ole
    SmartBear Software