Replacing empty elements in XML (using NP++ replace)

Created by Jeremy Burgess, Modified on Thu, 20 Oct, 2022 at 11:08 AM by Jeremy Burgess

Symptom

Your XML file may contain empty elements indicating a null value in XML. SAGE formatted CSV (which we use with Zynk) will be rejected with these elements because null is not a valid value. Having no tag at all is, however, acceptable.

Cause

n/a

Resolution

Use a search for the following regular expression in NP++.

<[^=/>]+/>

This is the regular expression for finding any self-closed element containing no attributes (cannot contain an = character).



The resulting XML looks like this:

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article