Skip to main content

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

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++.

\${NL}]+/> \${NL} This is the regular expression for finding any self-closed element containing no attributes (cannot contain an = character).

The resulting XML looks like this: