hungryhippos
hungryhippos

Reputation: 637

Unable to set a null value when manipulating xml

I have the following xml:

<Company>
  <Section>ABC</Section>
</Company>

I am conducting a negative test of sorts and want to send a NULL value to the "Section" element of the xml.

I tried the following:

* set xml /Company/Section = (null)

However, what happens is that the opening tag of the element gets deleted altogether resulting in:

<Company>
  </Section>
</Company>

Expected result should be:
<Company>
  <Section></Section>
</Company>

I would've liked to try .replace but the value inside "Section" is dynamic and so I cannot effectively use .replace. I also tried an empty string ('') and the same behavior happens where the opening tag gets deleted.

Please advise.

Upvotes: 1

Views: 222

Answers (1)

Peter Thomas
Peter Thomas

Reputation: 58058

That is exactly what a null should do.

If an empty string does not work, that is a big surprise to me. Then the best option is you submit an issue and ideally contribute a PR to fix it also. Else consider what you ask for as not supported.

Upvotes: 1

Related Questions