How to make tests for empty xml elements?

I’m trying to create tests to make sure our API returns expected xml structure.

For that I’m using xml2Json(responseBody) which works great but I have trouble when I try to assert the existence of am empty element.

My xml could look like this

<root>
  <name>Henrik</name>
  <address />
</root>

jsonObject.root.name works but jsonObject.root.address makes my test fail.

How to I make tests for empty elements?

I’m thinking your copy/paste failed for your xml. Looks like maybe you pasted ‘Henrik’ instead of the xml structure.

This forum board just ate my XML text.

But no matter. Got it fixed. Thanks