Forum Discussion

AngieD's avatar
AngieD
Occasional Contributor
13 years ago

[Resolved] Need to reestablish XML sections

Hi. I have a large XML request that has several optional sections. I would like to create a loop that randomly removes sections and populates other sections. I am good with removing sections and populating sections, but on the next loop I am having problems reestablishing the sections that were removed with the previous loop.

Here is a sample of my XML. The first loop will have owner and feline information, so I want to remove the canine and exotic sections. The second loop will have the owner, canine and feline sections. But since the first loop removed the canine section I need to get it back. That is the big problem that I am having. I am using xmlHolder to set and remove the nodes. Is there some trick, similar to the "Recreates default request from schema" button, that will recreate the request adding back the removed sections? I've tried several strategies without success.

<vet>
<owner>
<ownerName></ownerName>
<address1></ownerName>
<address2></address2>
<city></city>
<state></state>
<zip></zip>
<phone1></phone1>
</owner>
<animal>
<canine>
<name></name>
<breed></breed>
</canine>
<feline>
<name></name>
<breed></breed>
</feline>
<exotic>
<name></name>
<type></type>
</exotic>
</animal>
</vet>


Thank you,
Angie
  • Hi!

    I would suggest your write the entire request to a TestCase Property and restore it from there for each iteration... does that make sense?

    /Ole
    SmartBear Software
  • AngieD's avatar
    AngieD
    Occasional Contributor
    Hi Ole,
    Wonderful! Thank you very much. I think this will work for me.
    Angie