This is for a project for a very specific use.
I am trying to find how to find any empty text from the xml and replace it with a message.
regex = re.compile(r'>\s*</')
replaced = re.sub(regex, ">[!] JSON value does not exist, Check your Json!</", temp)
For example filename is blank
<file>
<fileType>Mezza</fileType>
<fileName></fileName>
<segments>0000</segments>
</file>
and the output would be:
<file>
<fileType>Mezza</fileType>
<fileName>[!] value does not exist!</fileName>
<segments>0000</segments>
</file>
However I am getting for other parts where there is white space and newline I dont want to have this message, both tag names are different there is a new line and they are closing tags how do I implement this in regex?:
</fileName>[!] value does not exist!</file>