# How to make tests for empty xml elements?

**URL:** <https://community.postman.com/t/how-to-make-tests-for-empty-xml-elements/10612>\
**Category:** Help Hub\
**Tags:** tests\
**Created:** [February 6, 2020, 9:50am UTC](https://community.postman.com/t/how-to-make-tests-for-empty-xml-elements/10612 "2020-02-06T09:50:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![hfhInventio](https://avatars.discourse-cdn.com/v4/letter/h/5e9695/32.png) [@hfhInventio](https://community.postman.com/u/hfhInventio)\
**Post date:** [February 6, 2020, 9:50am UTC](https://community.postman.com/t/how-to-make-tests-for-empty-xml-elements/10612/1 "2020-02-06T09:50:54Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![allenheltondev](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/allenheltondev/32/31738_2.png) [@allenheltondev](https://community.postman.com/u/allenheltondev)\
**Post date:** [February 6, 2020, 2:26pm UTC](https://community.postman.com/t/how-to-make-tests-for-empty-xml-elements/10612/2 "2020-02-06T14:26:17Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![hfhInventio](https://avatars.discourse-cdn.com/v4/letter/h/5e9695/32.png) [@hfhInventio](https://community.postman.com/u/hfhInventio)\
**Post date:** [February 6, 2020, 5:07pm UTC](https://community.postman.com/t/how-to-make-tests-for-empty-xml-elements/10612/3 "2020-02-06T17:07:20Z")

</div>

This forum board just ate my XML text.

But no matter. Got it fixed. Thanks
