Forum Discussion

Testranger's avatar
Testranger
Contributor
12 years ago

soapUI stripping comments

Hi all,

I'm using groovy to generate xml request content, however it is seems to be ignoring blank comment elements. Leaving:
<ns18:riskAnalysis>
<ns18:risk>LOCATION</ns18:risk>
<ns18:type>PROPERTY</ns18:type>

<ns18:rating>1</ns18:rating>
</ns18:riskAnalysis>

Should be:
<ns18:riskAnalysis>
<ns18:risk>LOCATION</ns18:risk>
<ns18:type>PROPERTY</ns18:type>
<ns18:comment/>
<ns18:rating>1</ns18:rating>
</ns18:riskAnalysis>

Is there a setting to stop this happening? I need to have this here, so that testers are aware of the option to add a comment.

Regards,
Testranger

1 Reply

  • Aaronliu's avatar
    Aaronliu
    Frequent Contributor
    Would you please post your scripts to build xml?
    which class you use to create xml, MarkupBuilder or StreamingMarkupBuilder?

    def sw = new StringWriter()
    def xml = new groovy.xml.MarkupBuilder(sw)
    def xml.person = {
    firstname("Kobe")
    lastname("Bryant")
    Age(34)
    }

    log.info sw


    //output
    <person>
    <firstname>Kobe</firstname>
    <lastname>Bryant</lastname>
    <Age>34</Age>
    </person>